|
| template<typename ScheduleT> |
| symbolic::Expression | find_nested_gpu_blocksize (structured_control_flow::Map &node, analysis::AnalysisManager &analysis_manager, GPUDimension dimension) |
| | GPU map utility functions shared between CUDA and ROCm.
|
| template<typename ScheduleT> |
| symbolic::Expression | find_nested_gpu_iterations (structured_control_flow::Map &node, analysis::AnalysisManager &analysis_manager, GPUDimension dimension) |
| | Find the number of iterations for nested GPU maps in a given dimension.
|
| template<typename ScheduleT> |
| bool | is_outermost_gpu_map (structured_control_flow::Map &node, analysis::AnalysisManager &analysis_manager) |
| | Check if a map is the outermost GPU map in the loop tree.
|
| template<typename ScheduleT> |
| symbolic::SymbolSet | get_gpu_indvars (structured_control_flow::Map &node, analysis::AnalysisManager &analysis_manager, GPUDimension dimension) |
| | Get all induction variables for GPU maps in a given dimension.
|
| bool | is_gpu_schedule (const structured_control_flow::ScheduleType &schedule) |
| | Check if a schedule type is a GPU schedule (CUDA or ROCM).
|
| template<typename GPUType> |
| int64_t | gpu_warp_size () |
| template<> |
| int64_t | gpu_warp_size< sdfg::cuda::ScheduleType_CUDA_Offload > () |
| template<> |
| int64_t | gpu_warp_size< sdfg::rocm::ScheduleType_ROCM_Offload > () |
| int64_t | gpu_warp_size (const structured_control_flow::ScheduleType &schedule) |
| template<typename ScheduleT> |
| std::vector< structured_control_flow::Map * > | get_gpu_maps (structured_control_flow::Map &node, analysis::AnalysisManager &analysis_manager, GPUDimension dimension) |
| | Get all GPU Map nodes in a given dimension (in tree traversal order).
|
| bool | nested_parallelization_is_unsafe (structured_control_flow::StructuredLoop &loop, analysis::AnalysisManager &analysis_manager) |
| | Whether parallelizing loop to a new GPU grid dimension would race on a shared container.
|
| NestedFoldPlan | analyze_nested_fold (structured_control_flow::StructuredLoop &loop, TargetLevel target_level, analysis::AnalysisManager &analysis_manager) |
| symbolic::Expression | get_target_level_dim (TargetLevel target_level, int warp_size) |
| symbolic::Expression | get_target_level_idx (TargetLevel target_level) |
| bool | is_grid_level (TargetLevel target_level) |
| bool | is_block_level (TargetLevel target_level) |
| bool | is_warp_level (TargetLevel target_level) |
| symbolic::SymbolSet | target_level_indvars (structured_control_flow::StructuredLoop &node, analysis::AnalysisManager &analysis_manager, TargetLevel target_level) |
| void | get_nested_schedule_types (structured_control_flow::StructuredLoop &node, analysis::AnalysisManager &analysis_manager, std::unordered_map< TargetLevel, structured_control_flow::ScheduleType > &output) |
| void | get_nested_level_maps (structured_control_flow::StructuredLoop &node, analysis::AnalysisManager &analysis_manager, std::unordered_map< TargetLevel, structured_control_flow::StructuredLoop * > &output) |
| bool | nested_warp_dim (structured_control_flow::StructuredLoop &loop, analysis::AnalysisManager &analysis_manager) |
| void | validate_wave_maps (structured_control_flow::StructuredLoop &node, analysis::AnalysisManager &analysis_manager, int64_t warp_size) |
| structured_control_flow::StructuredLoop * | find_x_block_owning_warp_level (structured_control_flow::StructuredLoop &node, analysis::AnalysisManager &analysis_manager) |
| size_t | perfectly_nested_depth (structured_control_flow::StructuredLoop *loop) |
| template symbolic::Expression | find_nested_gpu_blocksize< sdfg::cuda::ScheduleType_CUDA > (structured_control_flow::Map &, analysis::AnalysisManager &, GPUDimension) |
| template symbolic::Expression | find_nested_gpu_blocksize< sdfg::rocm::ScheduleType_ROCM > (structured_control_flow::Map &, analysis::AnalysisManager &, GPUDimension) |
| template symbolic::Expression | find_nested_gpu_iterations< sdfg::cuda::ScheduleType_CUDA > (structured_control_flow::Map &, analysis::AnalysisManager &, GPUDimension) |
| template symbolic::Expression | find_nested_gpu_iterations< sdfg::rocm::ScheduleType_ROCM > (structured_control_flow::Map &, analysis::AnalysisManager &, GPUDimension) |
| template bool | is_outermost_gpu_map< sdfg::cuda::ScheduleType_CUDA > (structured_control_flow::Map &, analysis::AnalysisManager &) |
| template bool | is_outermost_gpu_map< sdfg::rocm::ScheduleType_ROCM > (structured_control_flow::Map &, analysis::AnalysisManager &) |
| template symbolic::SymbolSet | get_gpu_indvars< sdfg::cuda::ScheduleType_CUDA > (structured_control_flow::Map &, analysis::AnalysisManager &, GPUDimension) |
| template symbolic::SymbolSet | get_gpu_indvars< sdfg::rocm::ScheduleType_ROCM > (structured_control_flow::Map &, analysis::AnalysisManager &, GPUDimension) |
| template std::vector< structured_control_flow::Map * > | get_gpu_maps< sdfg::cuda::ScheduleType_CUDA > (structured_control_flow::Map &, analysis::AnalysisManager &, GPUDimension) |
| template std::vector< structured_control_flow::Map * > | get_gpu_maps< sdfg::rocm::ScheduleType_ROCM > (structured_control_flow::Map &, analysis::AnalysisManager &, GPUDimension) |
| void | emit_clipped_fragment_transfer (codegen::CodegenOutput &out, const GpuMmaDispatcherStrategy &strategy, bool load, const std::string &frag, const std::string &base, const GpuMmaFromMemoryLayout &layout, const MmaBlockSize &block_size, MmaFragmentType frag_type, types::PrimitiveType element_type, MmaFragmentLayout fragment_layout) |
| | Emit a fragment load/store whose layout is clipped (GpuMmaFromMemoryLayout::rows/cols): a wave-uniform branch takes the plain transfer when the fragment is fully in bounds, otherwise an element-wise transfer that zero-fills out-of-bounds loads and skips out-of-bounds stores.
|
| data_flow::LibraryNodeCode | LibraryNodeType_GpuMmaFill ("gpu::GpuMmaFill") |
| std::ostream & | operator<< (std::ostream &os, const MmaBlockSize &block_size) |
| constexpr const char * | mma_fragment_layout_to_string (MmaFragmentLayout layout) |
| std::ostream & | operator<< (std::ostream &os, const GpuMmaFromMemoryLayout &layout) |
| void | serialize_mma_block_size (nlohmann::json &j, const MmaBlockSize &block_size) |
| MmaBlockSize | deserialize_mma_block_size (const nlohmann::json &j) |
| void | serialize_mma_from_memory_layout (nlohmann::json &j, const GpuMmaFromMemoryLayout &layout) |
| GpuMmaFromMemoryLayout | deserialize_mma_from_memory_layout (const nlohmann::json &j) |
| data_flow::LibraryNodeCode | LibraryNodeType_GpuMmaFragmentEltwiseAdd ("gpu::MmaFragmentEltwiseAdd") |
| data_flow::LibraryNodeCode | LibraryNodeType_GpuMmaFragmentLoad ("gpu::MmaFragmentLoad") |
| data_flow::LibraryNodeCode | LibraryNodeType_GpuMmaFragmentStore ("gpu::MmaFragmentStore") |
| data_flow::LibraryNodeCode | LibraryNodeType_GpuMmaMatmul ("gpu::GpuMmaMatmul") |
| std::string | to_string (const TargetLevel &target_level) |
| TargetLevel | target_level_from_string (const std::string &value) |
| std::string | reduce_strategy_to_string (ReduceStrategy strategy) |
| ReduceStrategy | reduce_strategy_from_string (const std::string &value) |
| ReduceStrategy | default_reduce_strategy (TargetLevel target_level) |
| TargetLevel | gpu_target_level (const structured_control_flow::ScheduleType &schedule) |
| | Get the GPU target level from any GPU schedule type.
|
| void | gpu_target_level (structured_control_flow::ScheduleType &schedule, const TargetLevel &target_level) |
| | Set the GPU target level on any GPU schedule type.
|
| GPUDimension | gpu_dimension (const structured_control_flow::ScheduleType &schedule) |
| | Get the GPU dimension from any GPU schedule type.
|
| void | gpu_dimension (structured_control_flow::ScheduleType &schedule, const GPUDimension &dimension) |
| | Set the GPU dimension on any GPU schedule type.
|
| symbolic::Integer | gpu_block_size (const structured_control_flow::ScheduleType &schedule) |
| | Get the block size from any GPU schedule type Returns default values if not explicitly set:
|
| void | gpu_block_size (structured_control_flow::ScheduleType &schedule, const symbolic::Expression block_size) |
| | Set the block size on any GPU schedule type.
|
| data_flow::LibraryNodeCode | LibraryNodeType_GpuTileArrival ("gpu::TileArrival") |
Whether parallelizing loop to a new GPU grid dimension would race on a shared container.
Adding a grid dimension for loop folds the whole enclosing GPU kernel into a single flattened launch: loop 's iterations are distributed across the new dimension's threads, while every sibling of loop (and of its ancestors up to the outermost GPU map) is re-executed by every thread of that dimension. Since there is no grid-wide barrier inside a kernel, this is unsafe in two ways:
- Producer/consumer across the fold:
loop 's writes vary across the new dimension, so a replicated sibling that reads or writes one of those shared containers observes another thread's (incomplete) data (RAW/WAR/WAW). This is the reduction-accumulator -> consumer hazard, e.g. softmax where a reduce writes acc[i] and a following map divides by acc[i] in the same kernel.
- Replicated self-accumulation: a sibling read-modify-write (acc[i] += x) is folded in once per replicated thread and races on the shared buffer.
Both hazards only apply to containers that escape the kernel (function arguments/externals or transients living outside, per ArgumentsAnalysis); a container confined to the kernel is privatized per thread and races nothing. For the self-accumulation hazard, a sibling that is itself a GPU map is exempt: it is already parallelized, so codegen maps it onto its own threads instead of replicating it.
This helper is schedule-agnostic (a map is "parallelized" iff its schedule is not Sequential), so it serves both the CUDA and ROCm nested-map transformations.
- Parameters
-
| loop | The sequential loop that a nested-parallelization transform wants to promote. |
| analysis_manager | Analysis manager (LoopAnalysis, Users, ArgumentsAnalysis). |
- Returns
- true if folding
loop into the kernel would introduce a data race.