Skip to content

Commit

Permalink
Fix a VLA issue with CUDA graph API
Browse files Browse the repository at this point in the history
  • Loading branch information
caugonnet committed Oct 10, 2024
1 parent 03d0a33 commit 705502c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 0 additions & 4 deletions cudax/cmake/cudaxHeaderTesting.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ function(cudax_add_header_test label definitions)
# FIXME: error: possibly dangling reference to a temporary (stream_task.cuh:114)
cuda/experimental/__stf/stream/stream_task.cuh
cuda/experimental/__stf/stream/stream_ctx.cuh

# FIXME: -Wvla: Avoid VLAs (cudaMemAccessDesc desc[ndevices];), they're non-portable:
cuda/experimental/__stf/graph/graph_ctx.cuh
cuda/experimental/stf.cuh
)
target_link_libraries(${headertest_target} PUBLIC ${cn_target})
target_compile_definitions(${headertest_target} PRIVATE
Expand Down
4 changes: 2 additions & 2 deletions cudax/include/cuda/experimental/__stf/graph/graph_ctx.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private:
{
static const int ndevices = cuda_try<cudaGetDeviceCount>();
// We need to declare who may access this buffer
cudaMemAccessDesc desc[ndevices];
::std::vector<cudaMemAccessDesc> desc(ndevices);
for (int peer : each(0, ndevices))
{
desc[peer].location.type = cudaMemLocationTypeDevice;
Expand All @@ -143,7 +143,7 @@ private:

// Set only the variable parameters
params.poolProps.location.id = device_ordinal(memory_node);
params.accessDescs = desc;
params.accessDescs = desc.data();
params.accessDescCount = size_t(ndevices);
params.bytesize = size_t(s);

Expand Down

0 comments on commit 705502c

Please sign in to comment.