Skip to content

[Opt] Fix i64 indexes for matrices#8694

Closed
hughperkins wants to merge 1 commit into
taichi-dev:masterfrom
hughperkins:hp/fix-8640
Closed

[Opt] Fix i64 indexes for matrices#8694
hughperkins wants to merge 1 commit into
taichi-dev:masterfrom
hughperkins:hp/fix-8640

Conversation

@hughperkins
Copy link
Copy Markdown
Contributor

Issue: #8640

#8640

Brief Summary

Using i64 index for matrix fires an assert is_primitive( PrimitiveTypeID::i32)

copilot:summary

Walkthrough

Using i64 index for matrix fires an assert:

[E 04/27/25 16:53:32.590 1740211] [type_check.cpp:visit@166] Assertion failure: stmt->offset->ret_type.get_element_type()->is_primitive( PrimitiveTypeID::i32)

The assert is because the verifier only allows matrix indices to be i32:

    TI_ASSERT(stmt->offset->ret_type.get_element_type()->is_primitive(
                  PrimitiveTypeID::i32));

Broadening this to allow i64 fixes the issue:

    TI_ASSERT(stmt->offset->ret_type.get_element_type()->is_primitive(
                  PrimitiveTypeID::i32) ||
              stmt->offset->ret_type.get_element_type()->is_primitive(
                  PrimitiveTypeID::i64));

copilot:walkthrough

@hughperkins
Copy link
Copy Markdown
Contributor Author

Hmmm, I wonder if i64 will overflow our matrix indexing 🤔

@hughperkins
Copy link
Copy Markdown
Contributor Author

Actually, this is probably a bad idea 🤔 Will close it for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant