Bug 176209 - WSL IntLiteral should have variable type so that it can unify with things like uint
Summary: WSL IntLiteral should have variable type so that it can unify with things lik...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGPU (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Filip Pizlo
URL:
Keywords: InRadar
Depends on:
Blocks: 176199
  Show dependency treegraph
 
Reported: 2017-08-31 19:38 PDT by Filip Pizlo
Modified: 2018-10-13 19:56 PDT (History)
9 users (show)

See Also:


Attachments
the patch (21.78 KB, patch)
2017-09-03 11:28 PDT, Filip Pizlo
no flags Details | Formatted Diff | Diff
the patch (23.22 KB, patch)
2017-09-03 12:38 PDT, Filip Pizlo
mmaxfield: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2017-08-31 19:38:03 PDT
Patch forthcoming.
Comment 1 Filip Pizlo 2017-09-03 10:55:36 PDT
I think that if you use an integer literal without any suffixes, then it should unify with any type in which that literal is representable.
Comment 2 Filip Pizlo 2017-09-03 11:28:17 PDT
Created attachment 319789 [details]
the patch
Comment 3 Filip Pizlo 2017-09-03 12:38:18 PDT
Created attachment 319796 [details]
the patch

Added more tests.
Comment 4 Myles C. Maxfield 2017-09-04 13:10:20 PDT
Comment on attachment 319796 [details]
the patch

View in context: https://bugs.webkit.org/attachment.cgi?id=319796&action=review

> Tools/ChangeLog:24
> +        Also updated Test.html so that it runs again and is better at printing things.

So the following wouldn't work:
int x = 4;
double y = x;

But the following would work:
double y = 4;

> Tools/WebGPUShadingLanguageRI/IntLiteralType.js:57
> +        print("Unified with: " + realThis);

print() :(

> Tools/WebGPUShadingLanguageRI/Intrinsics.js:67
> +                type.isInt = true;

I never see this read from. What is it used for?
Comment 5 Filip Pizlo 2017-09-04 14:06:44 PDT
Landed in https://trac.webkit.org/changeset/221593/webkit
Comment 6 Filip Pizlo 2017-09-04 14:08:50 PDT
(In reply to Myles C. Maxfield from comment #4)
> Comment on attachment 319796 [details]
> the patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=319796&action=review
> 
> > Tools/ChangeLog:24
> > +        Also updated Test.html so that it runs again and is better at printing things.
> 
> So the following wouldn't work:
> int x = 4;
> double y = x;
> 
> But the following would work:
> double y = 4;

Right.

> 
> > Tools/WebGPUShadingLanguageRI/IntLiteralType.js:57
> > +        print("Unified with: " + realThis);
> 
> print() :(

I removed it!

> 
> > Tools/WebGPUShadingLanguageRI/Intrinsics.js:67
> > +                type.isInt = true;
> 
> I never see this read from. What is it used for?

It's not used right now.  I added it because all compilers eventually need to ask their types if they are int or float.
Comment 7 Radar WebKit Bug Importer 2017-09-27 13:00:42 PDT
<rdar://problem/34694473>
Comment 8 Myles C. Maxfield 2018-10-13 19:56:39 PDT
Migrated to https://github.com/gpuweb/WHLSL/issues/200