yxsamliu wrote:
> @yxsamliu What's the plan here? This issue is blocking us. If there is no
> obvious fix very soon, we need to revert this.
fix by https://github.com/llvm/llvm-project/pull/73140
https://github.com/llvm/llvm-project/pull/72394
___
cf
yxsamliu wrote:
> @yxsamliu What's the plan here? This issue is blocking us. If there is no
> obvious fix very soon, we need to revert this.
I will fix it.
https://github.com/llvm/llvm-project/pull/72394
___
cfe-commits mailing list
cfe-commits@lists
alexfh wrote:
@yxsamliu What's the plan here? This issue is blocking us. If there is no
obvious fix very soon, we need to revert this.
https://github.com/llvm/llvm-project/pull/72394
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://list
yxsamliu wrote:
Thanks for reporting. A reduced testcase is https://godbolt.org/z/MY84az9xh
`template
struct ptr {
~ptr() { static int x = 1;}
};
template
struct Abc : ptr {
public:
Abc();
~Abc() {}
};
template
class Abc;
`
clang thinks Abc::~Abc() is trivial but it is not. It cou
bgra8 wrote:
@yxsamliu we found another problem with the patch.
https://godbolt.org/z/5M9eexKKM
```
#include
template
class Abc {
public:
Abc();
~Abc();
private:
struct Impl;
std::unique_ptr impl_;
};
template
struct Abc::Impl {
int x;
};
template
Abc::Abc() : impl_{std::
yxsamliu wrote:
> > We've found a problem with the patch. https://godbolt.org/z/jcKo34vzG
> > ```
> > template
> > class C {
> > explicit C() {};
> > };
> >
> > template <> C::C() {};
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > ```
> > :6
yxsamliu wrote:
> We've found a problem with the patch. https://godbolt.org/z/jcKo34vzG
>
> ```
> template
> class C {
> explicit C() {};
> };
>
> template <> C::C() {};
> ```
>
> ```
> :6:21: error: __host__ function 'C' cannot overload __host__
> __device__ function 'C'
> 6 | templ
Artem-B wrote:
We've found a problem with the patch. https://godbolt.org/z/jcKo34vzG
```
template
class C {
explicit C() {};
};
template <> C::C() {};
```
:6:21: error: __host__ function 'C' cannot overload __host__ __device__
function 'C'
6 | template <> C::C() {};
|
https://github.com/yxsamliu closed
https://github.com/llvm/llvm-project/pull/72394
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/yxsamliu updated
https://github.com/llvm/llvm-project/pull/72394
>From 0efce26340ce058cd2477f5dccbb6ab35cb1c2a0 Mon Sep 17 00:00:00 2001
From: "Yaxun (Sam) Liu"
Date: Tue, 14 Nov 2023 22:08:45 -0500
Subject: [PATCH] [CUDA][HIP] make trivial ctor/dtor host device
Make trivial
@@ -12,7 +12,7 @@ extern "C" void host_fn() {}
struct Dummy {};
struct S {
- S() {}
+ S() { x = 1; }
yxsamliu wrote:
will do
https://github.com/llvm/llvm-project/pull/72394
___
cfe-commits mailing list
cfe-commit
@@ -772,6 +772,26 @@ void Sema::maybeAddCUDAHostDeviceAttrs(FunctionDecl *NewD,
NewD->addAttr(CUDADeviceAttr::CreateImplicit(Context));
}
+// If a trivial ctor/dtor has no host/device
+// attributes, make it implicitly host device function.
+void Sema::maybeAddCUDAHostDevice
@@ -772,6 +772,26 @@ void Sema::maybeAddCUDAHostDeviceAttrs(FunctionDecl *NewD,
NewD->addAttr(CUDADeviceAttr::CreateImplicit(Context));
}
+// If a trivial ctor/dtor has no host/device
+// attributes, make it implicitly host device function.
+void Sema::maybeAddCUDAHostDevice
@@ -12,7 +12,7 @@ extern "C" void host_fn() {}
struct Dummy {};
struct S {
- S() {}
+ S() { x = 1; }
Artem-B wrote:
Can we make the purpose of non-trivial constructor more descriptive, here and
in other places?
E.g. `S() { static int nontrivial_ctor = 1; }
https://github.com/Artem-B approved this pull request.
LGTM with a couple of nits.
https://github.com/llvm/llvm-project/pull/72394
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Artem-B edited
https://github.com/llvm/llvm-project/pull/72394
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Yaxun (Sam) Liu (yxsamliu)
Changes
Make trivial ctor/dtor implicitly host device functions so that they can be
used to initialize file-scope
device variables to match nvcc behavior.
Fixes: https://github.com/llvm/llvm-project/issues/72261
https://github.com/yxsamliu created
https://github.com/llvm/llvm-project/pull/72394
Make trivial ctor/dtor implicitly host device functions so that they can be
used to initialize file-scope
device variables to match nvcc behavior.
Fixes: https://github.com/llvm/llvm-project/issues/72261
Fixes
18 matches
Mail list logo