Skip to content
Closed
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
30 changes: 17 additions & 13 deletions test/inductor/test_torchinductor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5991,7 +5991,6 @@ def fn(x1, x2, x3, x4):
)

@skip_if_gpu_halide
@skipCUDAIf(not SM80OrLater, "uses bfloat16 which requires SM >= 80")
# Constant folding was explicitly turned off due to issue #108388
# Turn it back on for test
@torch._inductor.config.patch(joint_graph_constant_folding=True)
Expand Down Expand Up @@ -6033,21 +6032,26 @@ def matmul_with_op(x, y, fn):
FileCheck().check_not("triton.jit").run(source_codes[0])

# test dtype conversion
inps = [
torch.rand([256, 256], device=self.device, dtype=torch.bfloat16)
for _ in range(2)
]
for fn in fns:
device_interface = get_interface_for_device(self.device)

for lowp_dtype in [torch.float16, torch.bfloat16]:
if not device_interface.is_dtype_supported(lowp_dtype):
continue
inps = [
torch.rand([256, 256], device=self.device, dtype=lowp_dtype)
for _ in range(2)
]
for fn in fns:
out, source_codes = run_and_get_code(foo_opt, inps[0], inps[1], fn)
self.assertEqual(out, matmul_with_op(inps[0], inps[1], fn))

# test broadcasted shape bail
fn = lambda x: x + torch.zeros( # noqa: E731
[256, 256, 256], dtype=lowp_dtype, device=self.device
)
out, source_codes = run_and_get_code(foo_opt, inps[0], inps[1], fn)
self.assertEqual(out, matmul_with_op(inps[0], inps[1], fn))

# test broadcasted shape bail
fn = lambda x: x + torch.zeros( # noqa: E731
[256, 256, 256], dtype=torch.bfloat16, device=self.device
)
out, source_codes = run_and_get_code(foo_opt, inps[0], inps[1], fn)
self.assertEqual(out, matmul_with_op(inps[0], inps[1], fn))

def test_remove_noop_copy(self):
def fn(x, y):
x = x.cos()
Expand Down
4 changes: 4 additions & 0 deletions torch/_dynamo/device_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ def record(self, stream=None):
def is_available() -> bool:
return True

@staticmethod
def is_bf16_supported(including_emulation: bool = False):
return True

@staticmethod
def get_compute_capability(device: _device_t = None) -> str:
return ""
Expand Down
Loading