[PATCH] D135060: [HLSL] Add groupshare address space.

Xiang Li via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 12 15:50:29 PDT 2022


python3kgae marked 2 inline comments as done.
python3kgae added inline comments.


================
Comment at: clang/test/SemaHLSL/group_shared.hlsl:57
+ // expected-error at +1 {{no matching function for call to 'tfoo'}}
+ GSF gs2 = tfoo<GSF>(gs);
----------------
aaron.ballman wrote:
> Some other Sema test cases that would be useful:
> ```
> // Do we reject it on a return type in a function pointer?
> groupshared void (*fp)();
> // What about on parameters in a function pointer?
> void (*fp2)(groupshared float);
> // Trailing return types?
> auto func() -> groupshared void;
> // What about in a novel qualifier order?
> void groupshared f();
> 
> struct S {
>   // Do we reject it as a function qualifier on a member function?
>   void f() groupshared;
> };
> 
> // Does it impact size or alignment?
> static_assert(sizeof(float) == sizeof(groupshared float));
> static_assert(alignof(double) == alignof(groupshared double));
> 
> // Does it impact type identity for templates?
> template <typename Ty>
> struct S {
>   static constexpr bool value = false;
> };
> 
> template <>
> struct S<groupshared float> {
>   static constexpr bool value = true;
> };
> static_assert(!S<float>::value);
> static_assert(S<groupshared float>::value);
> 
> // Can you overload based on the qualifier?
> void func(float f) {}
> void func(groupshared float f) {} // Error on redefinition?
> ```
> (Note, I'm taking guesses on some of these test cases; if I've guessed wrong, feel free to correct me!)
> 
> I'd also expect tests to show up in ParserHLSL testing the parsing behavior:
> ```
> // Do we accept novel qualifier orders?
> extern groupshared float f;
> extern float groupshared f; // Ok, redeclaration?
> 
> // Can we parse it on a lambda? Note, be sure to add more lambda tests with 
> // more complex parsing situations to make sure you're happy with the parsing
> // behavior.
> []() groupshared {};
> 
> // Can we still parse attributes written on the type?
> float groupshared [[]] i = 12;
> ```
Unfortunately, things like pointer and lambda are not supported in HLSL yet.
So some tests will not work.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135060/new/

https://reviews.llvm.org/D135060



More information about the cfe-commits mailing list