csarofeen/pytorch

Segfault when using addcmul in the frontend

Closed this issue ยท 0 comments

๐Ÿ› Describe the bug

The following test segfaults somewhere in nvfuser::python_frontend::OpRecord<nvfuser::TensorView*, nvfuser::TensorView*, nvfuser::TensorView*, nvfuser::TensorView*, nvfuser::TensorView*>::operator==():

    def test_addcmul(self):
        inputs = [
            torch.randn(4, device="cuda", dtype=torch.float32),
            torch.randn(4, device="cuda", dtype=torch.float32),
            torch.randn(4, device="cuda", dtype=torch.float32),
        ]

        def fusion_func(fd: FusionDefinition):
            t0 = fd.from_pytorch(inputs[0])
            t1 = fd.from_pytorch(inputs[1])
            t2 = fd.from_pytorch(inputs[2])
            c0 = fd.define_constant(0.1)

            t3 = fd.ops.addcmul(t0, t1, t2, c0)

            fd.add_output(t3)

        nvfout, _ = self.exec_nvfuser(fusion_func, inputs)

        torch_out = torch.addcmul(*inputs, 0.1)

        self.assertEqual(nvfout[0], torch_out)

Versions

TOT