mirror of
https://github.com/ROCm/ROCm.git
synced 2026-04-05 03:01:17 -04:00
[FRONTEND] fixed pinned memory exception behavior (#1197)
no longer raise exception when the pointer is on "cpu" but also accessible from within kernels (e.g., pinned memory)
This commit is contained in:
@@ -1463,18 +1463,18 @@ def test_noop(device='cuda'):
|
||||
kernel[(1, )](x)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("device", ['cuda', 'cpu'])
|
||||
@pytest.mark.parametrize("device", ['cuda', 'cpu', 'cpu_pinned'])
|
||||
def test_pointer_arguments(device):
|
||||
@triton.jit
|
||||
def kernel(x):
|
||||
pass
|
||||
x = torch.empty(1024, device=device)
|
||||
result = True
|
||||
try:
|
||||
kernel[(1,)](x)
|
||||
except ValueError:
|
||||
result = True if device == 'cpu' else False
|
||||
assert result
|
||||
pin_memory = 'pinned' in device
|
||||
x = torch.empty(1024, device=device.split('_')[0], pin_memory=pin_memory)
|
||||
if device == "cpu":
|
||||
with pytest.raises(ValueError):
|
||||
kernel[(1,)](x)
|
||||
else:
|
||||
kernel[(1, )](x)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("value, value_type", [
|
||||
|
||||
Reference in New Issue
Block a user