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

Inconsistency in merge error when accessing the inner most dim by absolute vs relative indexing #171

Closed
kevinstephano opened this issue Apr 15, 2023 · 1 comment
Assignees

Comments

@kevinstephano
Copy link
Collaborator

When indexing a 3-D tensor with size [4, 4, 4] with 2 or -1 with merge, I think we should get the same error. Note, the 2nd error also should occur when the dim is specified as value 1 and -2.

With absolute indexing, I get the following error:

import torch
from nvfuser import FusionDefinition

inputs = [
    torch.randn(4, 4, 4, device="cuda"),
]

class InputError(FusionDefinition):
    def definition(self):
        self.t0 = self.from_pytorch(inputs[0])
        self.t1 = self.ops.sum(self.t0, axis=-1)
        self.add_output(self.t1)

    def schedule(self):
        self.sched.merge(fd.t1, 2),

fd = InputError()
_ = fd.execute(inputs)

Error:

RuntimeError: Invalid merge detected, either one or both axes are outside of TensorView's range.

With relative indexing I get:

import torch
from nvfuser import FusionDefinition

inputs = [
   torch.randn(4, 4, 4, device="cuda"),
]

class InputError(FusionDefinition):
   def definition(self):
       self.t0 = self.from_pytorch(inputs[0])
       self.t1 = self.ops.sum(self.t0, axis=-1)
       self.add_output(self.t1)

   def schedule(self):
       self.sched.merge(fd.t1, -1),

fd = InputError()
_ = fd.execute(inputs)

Error:

RuntimeError: Merging IterDomains requires that their iteration types match. Outer: iS3{i0}, Inner: rS5{i2}
@kevinstephano kevinstephano self-assigned this Apr 15, 2023
@kevinstephano
Copy link
Collaborator Author

Closing, old.

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

No branches or pull requests

1 participant