[Codegen][GPU] Clean up prefetch pipeline stages flag to support integer values#23568
Conversation
Signed-off-by: Yu-Zhewen <[email protected]>
Signed-off-by: Yu-Zhewen <[email protected]>
Signed-off-by: Yu-Zhewen <[email protected]>
| precompile, | ||
| }; | ||
|
|
||
| struct BytecodeVersionParser : public llvm::cl::parser<std::optional<int64_t>> { |
There was a problem hiding this comment.
i am not sure if this needs to remove?
There was a problem hiding this comment.
Code changed. BytecodeVersionParser is now left untouched in its original location
| //===----------------------------------------------------------------------===// | ||
| LogicalResult initGPULaunchConfig(FunctionOpInterface funcOp, | ||
| const GPUCodegenOptions &gpuOpts) { | ||
| LogicalResult initGPULaunchConfig(FunctionOpInterface funcOp) { |
There was a problem hiding this comment.
Can you add a guard in this routine, where all config setting logic start from, to enforce that the pipeline number of state is non-negative? This comment is motivated from @lialan 's previous comment.
A negative stage count won't do any damage because we'd guard it later in the lowering pipeline. But still I believe the current state as-is a negative value will be silently accepted and materialized in IR like (prefetch_num_stages=-1), which is odd.
There was a problem hiding this comment.
I am now using std::optional<int64_t>, as @lialan previously suggested.
There was a problem hiding this comment.
I assume using std::optional<int64_t> does not solve the negative value problem? The type int64_t is signed, std::optional doesn't constrain the range. You can still pass --iree-llvmgpu-prefetch-num-stages=-3 and it will happily parse into std::optional<int64_t>(-3) and materialize as prefetch_num_stages = -3 in the IR.
There was a problem hiding this comment.
Good point. Negative values are now rejected at parse time.
Signed-off-by: Yu-Zhewen <[email protected]>
Signed-off-by: Yu-Zhewen <[email protected]>
2d5eba5 to
c5a1bdb
Compare
…ger values (iree-org#23568) Replaces the boolean `--iree-llvmgpu-enable-prefetch` flag with an integer `--iree-llvmgpu-prefetch-num-stages` flag backed by std::optional<uint64_t>. When unset (default), each code path uses its own heuristic default. 0 or 1 disables pipelining, and 2+ enables pipelining with the specified number of stages. ci-extra: test_torch --------- Signed-off-by: Yu-Zhewen <[email protected]>
Replaces the boolean
--iree-llvmgpu-enable-prefetchflag with an integer--iree-llvmgpu-prefetch-num-stagesflag backed by std::optional<uint64_t>. When unset (default), each code path uses its own heuristic default. 0 or 1 disables pipelining, and 2+ enables pipelining with the specified number of stages.ci-extra: test_torch