Class instance with address space

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Class instance with address space

Hans Wennborg via cfe-dev
C++ source, compiled as clang++ --target=amdgcn-amd-amdhsa

struct t
{
  int v;
};
__attribute__((address_space(3))) t d;

// error: no matching constructor for initialization of '__attribute__((address_space(3)))

with  t() : v(0) {}, same error

with  t() __attribute__((address_space(3))) : v(0) {},
// error: function type may not be qualified with an address space

How should I be spelling this? I'm essentially trying to replicate cuda's __shared__. Ideally I'd like implicit conversions to a and from an int which is not address space qualified, but right now I'm stuck on the constructor.

Thanks,

Jon

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Class instance with address space

Hans Wennborg via cfe-dev

Hi Jon,

There's currently no way to qualify a method with an arbitrary address space. There is a work-in-progress patch on it:

https://reviews.llvm.org/D57464

and I have an experimental local patch that tries to alleviate some issues with the patch above, but it doesn't really work. Parsing this pattern properly is unfortunately rather difficult. There's also no real syntax support in C++ for qualified constructors/destructors, which is another problem.

/ Bevin

On 2020-01-22 04:51, Jon Chesterfield via cfe-dev wrote:
C++ source, compiled as clang++ --target=amdgcn-amd-amdhsa

struct t
{
  int v;
};
__attribute__((address_space(3))) t d;

// error: no matching constructor for initialization of '__attribute__((address_space(3)))

with  t() : v(0) {}, same error

with  t() __attribute__((address_space(3))) : v(0) {},
// error: function type may not be qualified with an address space

How should I be spelling this? I'm essentially trying to replicate cuda's __shared__. Ideally I'd like implicit conversions to a and from an int which is not address space qualified, but right now I'm stuck on the constructor.

Thanks,

Jon

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Class instance with address space

Hans Wennborg via cfe-dev
Hi Bevin,

Thanks for the link! I like the approach, though the complexity makes me nervous. I think that's more power than my immediate problems require.

An offline discussion suggested exposing the opencl qualifiers (e.g. __local) for other languages. I haven't written the patch yet but am cautiously optimistic.

Jon

On Wed, 22 Jan 2020, 14:50 Bevin Hansson, <[hidden email]> wrote:

Hi Jon,

There's currently no way to qualify a method with an arbitrary address space. There is a work-in-progress patch on it:

https://reviews.llvm.org/D57464

and I have an experimental local patch that tries to alleviate some issues with the patch above, but it doesn't really work. Parsing this pattern properly is unfortunately rather difficult. There's also no real syntax support in C++ for qualified constructors/destructors, which is another problem.

/ Bevin

On 2020-01-22 04:51, Jon Chesterfield via cfe-dev wrote:
C++ source, compiled as clang++ --target=amdgcn-amd-amdhsa

struct t
{
  int v;
};
__attribute__((address_space(3))) t d;

// error: no matching constructor for initialization of '__attribute__((address_space(3)))

with  t() : v(0) {}, same error

with  t() __attribute__((address_space(3))) : v(0) {},
// error: function type may not be qualified with an address space

How should I be spelling this? I'm essentially trying to replicate cuda's __shared__. Ideally I'd like implicit conversions to a and from an int which is not address space qualified, but right now I'm stuck on the constructor.

Thanks,

Jon

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev