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

Fixing DomainMap::areAllTargetIdsCoveredBy to handle broadcast to non-root IDs #3655

Merged
merged 7 commits into from
Jan 2, 2025

Conversation

jjsjann123
Copy link
Collaborator

Fixes #3653

This PR adds another projection to source ID after permissive mapping. This allows us to correctly identify coverage when the broadcast IDs are not source ID directly.

@jjsjann123 jjsjann123 requested a review from naoyam December 30, 2024 20:23
@jjsjann123
Copy link
Collaborator Author

!test

if (!getMappedInputConcreteID(covered_source_ids, concrete_source_id_out)) {
return false;

// After mapping with PERMISSIVE map, `concrete_id_out` might no longer be a
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the patch. I added another call to get_source_iter_domain({concrete_id_out})

Copy link
Collaborator

@naoyam naoyam Dec 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, for a given logical ID, we take its source IDs, then for each source ID, take the source IDs of its concrete ID. I understand it would work for the repro, but I wonder why it would need to take source IDs twice. For example, would it work if we took first the concrete ID of a logical ID and then its source IDs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to take the first source ID of the logical ID for the pad example to work, i.e. in the comment above from line 252 - 258.

T2[i0, i1] = T0[i0, b0] + T1[i0, i1]
T3[i0, i9] = pad(T0[i0, b0])

We want to have T2 as the reference TV and we want to be able to map T3 to T2. For i9 in T3. I wanted to first map to source ID, so it can be map to b0, which would concretize to i1.

So my naive justification of going through source IDs twice is that: the first source ID call allows us to trace back to broadcast IDs that went through a resize; while the second source ID calls allow us to resolve transformations on the concrete IDs.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this PR as long as #3653 is fixed, but I'm feeling there's something not quite right here, probably because T2 and T3 shouldn't be actually mapped. They could have completely different sizes, and neither T2 nor T3 should not be considered representative.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you.

We have some existing tests that asserts the behavior, which might not be what we would want to support moving forward.

I'll update the comment here per suggestion and merge this PR as-is just so we can patch the issue.

Meanwhile, I think the case where you are making is that, we shouldn't map through PERMISSIVE mapping in the first place here. I'll start a draft PR with that to see how many tests are affected. We can discuss what's the next step then.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it's something we should worry about at this moment. No test should fail functionally since it's a segmentation issue. It would be just a performance difference, but unless we have a benchmark that has this particular pattern, it doesn't make much sense to discuss what we should do.

Copy link
Collaborator

@naoyam naoyam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing the issue. Could you add some more notes about the logic as you mentioned here: #3655 (comment)

@jjsjann123
Copy link
Collaborator Author

!test

@jjsjann123 jjsjann123 merged commit ed5b3c9 into main Jan 2, 2025
48 checks passed
@jjsjann123 jjsjann123 deleted the issue_3653 branch January 2, 2025 02:24
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.

Reference tensor not found due to DomainMap::areAllTargetIdsCoveredBy
2 participants