Open
Description
We just hit a case where we were pulling out a raw pointer using chai::ExecutionSpace::GPU, and it was greater than NUM_EXECUTION_SPACES since CHAI was built with CUDA disabled. Totally a bug on our end, but I think it would be preferable for uses of execution spaces that are disabled to not even compile. This would involve the following code:
enum ExecutionSpace {
/*! Default, no execution space. */
NONE = 0,
/*! Executing in CPU space */
CPU,
#if defined(CHAI_ENABLE_CUDA) || defined(CHAI_ENABLE_HIP) || defined(CHAI_ENABLE_GPU_SIMULATION_MODE)
/*! Execution in GPU space */
GPU,
#endif
#if defined(CHAI_ENABLE_UM)
UM,
#endif
#if defined(CHAI_ENABLE_PINNED)
PINNED,
#endif
// NUM_EXECUTION_SPACES should always be last!
/*! Used to count total number of spaces */
NUM_EXECUTION_SPACES
#if !defined(CHAI_ENABLE_CUDA) && !defined(CHAI_ENABLE_HIP) && !defined(CHAI_ENABLE_GPU_SIMULATION_MODE)
,GPU
#endif
#if !defined(CHAI_ENABLE_UM)
,UM
#endif
#if !defined(CHAI_ENABLE_PINNED)
,PINNED
#endif
};
The new code would remove entries after NUM_EXECUTION_SPACES:
enum ExecutionSpace {
/*! Default, no execution space. */
NONE = 0,
/*! Executing in CPU space */
CPU,
#if defined(CHAI_ENABLE_CUDA) || defined(CHAI_ENABLE_HIP) || defined(CHAI_ENABLE_GPU_SIMULATION_MODE)
/*! Execution in GPU space */
GPU,
#endif
#if defined(CHAI_ENABLE_UM)
UM,
#endif
#if defined(CHAI_ENABLE_PINNED)
PINNED,
#endif
// NUM_EXECUTION_SPACES should always be last!
/*! Used to count total number of spaces */
NUM_EXECUTION_SPACES
};
Metadata
Metadata
Assignees
Labels
No labels