gemini-code-assist[bot] commented on code in PR #18421:
URL: https://github.com/apache/tvm/pull/18421#discussion_r2532523707
##########
src/target/spirv/codegen_spirv.cc:
##########
@@ -672,10 +672,19 @@ void CodeGenSPIRV::VisitStmt_(const BufferStoreNode* op) {
}
void CodeGenSPIRV::VisitStmt_(const ForNode* op) {
- ICHECK(is_zero(op->min));
analyzer_->Bind(op->loop_var, Range::FromMinExtent(op->min, op->extent));
spirv::Value init_value = MakeValue(op->min);
spirv::Value extent_value = MakeValue(op->extent);
+
+ // loop step
+ spirv::Value step;
+ if (op->HasTrivialStep()) {
+ step = op->loop_var.dtype().is_int() ? builder_->IntImm(loop_var.stype, 1)
+ :
builder_->UIntImm(loop_var.stype, 1);
+ } else {
+ step = MakeValue(tir::cast(op->extent->dtype, *op->step));
+ }
Review Comment:
You are absolutely right, @wrongtest-intellif! My apologies for the outdated
comment. The issue I highlighted regarding the `loop_var` being used before its
local definition in `src/target/spirv/codegen_spirv.cc` has been resolved by
the changes in this pull request. The `spirv::PhiValue loop_var` is now
correctly declared before its usage in the step calculation, ensuring it refers
to the local loop variable's type. Thank you for pointing this out!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]