Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore nullptr attributes when traversal to attributes is enabled #56

Merged
merged 5 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions csrc/iter_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ void IterVisitor::traverseBetween(
// If stmt is an expression, traverse attributes as well
if (traverse_attributes && stmt->isExpr()) {
for (Statement* x : stmt->as<Expr>()->attributes()) {
// There can be nullptr attributes, e.g., philox_index of
// RngOp. Don't traverse into them
if (x == nullptr) {
continue;
}
// Note that attributes of type Attribute is not possible to
// dispatch as it's a template type.
if (x->getValType() == ValType::Attribute) {
Expand Down
8 changes: 4 additions & 4 deletions test/test_gpu3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1759,16 +1759,16 @@ __global__ void CUDAGeneratedKernel(Tensor<float, 2> T0, Tensor<float, 2> T2) {
i111 = ((nvfuser_index_t)threadIdx.x) + (256 * ((nvfuser_index_t)blockIdx.x));
int64_t i7;
i7 = T0.size[0] * T0.size[1];
bool b243;
b243 = i111 < i7;
bool b241;
b241 = i111 < i7;
float f8;
f8 = (float)(i7);
float T1[1];
if (b243) {
if (b241) {
T1[0]
= sinf(T0[i111]);
}
if (b243) {
if (b241) {
T2[i111]
= T1[0]
+ f8;
Expand Down
Loading