-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[flang][cuda] Fix unittest #150136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[flang][cuda] Fix unittest #150136
Conversation
Fix building issue reported on #148717
| auto a{createAllocatable(TypeCategory::Real, 4)}; | ||
| EXPECT_EQ((int)kDefaultAllocator, a->GetAllocIdx()); | ||
| RTNAME(CUFSetAllocatorIndex)(*a, kDeviceAllocatorPos, __FILE__, __LINE__); | ||
| RTNAME(CUFSetAllocatorIndex)(a, kDeviceAllocatorPos, __FILE__, __LINE__); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| RTNAME(CUFSetAllocatorIndex)(a, kDeviceAllocatorPos, __FILE__, __LINE__); | |
| RTNAME(CUFSetAllocatorIndex)(a.get(), kDeviceAllocatorPos, __FILE__, __LINE__); |
../../../../_src/flang-rt/unittests/Runtime/CUDA/AllocatorCUF.cpp:82:3: error: no matching function for call to '_FortranACUFSetAllocatorIndex'
82 | RTNAME(CUFSetAllocatorIndex)(a, kDeviceAllocatorPos, __FILE__, __LINE__);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../_src/flang/include/flang/Runtime/entry-names.h:27:22: note: expanded from macro 'RTNAME'
27 | #define RTNAME(name) NAME_WITH_PREFIX_AND_REVISION(_Fortran, A, name)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../_src/flang/include/flang/Runtime/entry-names.h:26:3: note: expanded from macro 'NAME_WITH_PREFIX_AND_REVISION'
26 | prefix##revision##name
| ^~~~~~~~~~~~~~~~~~~~~~
<scratch space>:42:1: note: expanded from here
42 | _FortranACUFSetAllocatorIndex
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../_src/flang/include/flang/Runtime/CUDA/descriptor.h:45:6: note: candidate function not viable: no known conversion from 'OwningPtr<Descriptor>' to 'Descriptor *' for 1st argument
45 | void RTDECL(CUFSetAllocatorIndex)(Descriptor *, int index,
| ^ ~~~~~~~~~~~~
../../../../_src/flang/include/flang/Runtime/entry-names.h:31:35: note: expanded from macro 'RTDECL'
31 | #define RTDECL(name) RT_API_ATTRS RTNAME(name)
| ^
../../../../_src/flang/include/flang/Runtime/entry-names.h:27:22: note: expanded from macro 'RTNAME'
27 | #define RTNAME(name) NAME_WITH_PREFIX_AND_REVISION(_Fortran, A, name)
| ^
../../../../_src/flang/include/flang/Runtime/entry-names.h:26:3: note: expanded from macro 'NAME_WITH_PREFIX_AND_REVISION'
26 | prefix##revision##name
| ^
<scratch space>:16:1: note: expanded from here
16 | _FortranACUFSetAllocatorIndex
| ^
1 error generated.
My initial suggestion seems to have been wrong. createAllocatable returns an OwningPtr<Descriptor>, not a Descriptor *.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct. This is how we use it in the Memory.cpp unit tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't you running check-flang-rt yourself? The premerge-CI will not catch it because it does not enable CUF (FLANG_RT_INCLUDE_CUF).
Fix issue reported in #150136. `createAllocatable` returns an OwingPtr. Use `get()` to get the raw pointer has it is done in the `flang-rt/unittests/Runtime/CUDA/Memory.cpp` tests.
Fix issue reported in llvm#150136. `createAllocatable` returns an OwingPtr. Use `get()` to get the raw pointer has it is done in the `flang-rt/unittests/Runtime/CUDA/Memory.cpp` tests.
Fix building issue reported on #148717