Skip to content

Commit

Permalink
Fix test_subproc.py for XPU (#262)
Browse files Browse the repository at this point in the history
Set capability to zero when target is not CUDA.

---------

Signed-off-by: Tiotto, Ettore <ettore.tiotto@intel.com>
  • Loading branch information
etiotto authored Jan 15, 2024
1 parent 2df10be commit 7e6fc44
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 0 additions & 2 deletions python/test/unit/runtime/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,5 +260,3 @@ def kernel(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
x0 = xindex
tmp0 = tl.load(in_ptr0 + (x0), xmask)
tl.store(out_ptr0 + (x0 + tl.zeros([XBLOCK], tl.int32)), tmp0, xmask)

reset_tmp_dir()
18 changes: 10 additions & 8 deletions python/test/unit/runtime/test_subproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os
import shutil

import pytest
import torch

import triton
Expand Down Expand Up @@ -38,10 +37,11 @@ def kernel_sub(a, b, o, N: tl.constexpr):


def test_compile_in_subproc() -> None:
pytest.skip("FIXME: Port get_device_capability to XPU")
cc = 0
if torch.cuda.is_available():
major, minor = torch.cuda.get_device_capability(0)
cc = major * 10 + minor

major, minor = torch.cuda.get_device_capability(0)
cc = major * 10 + minor
config = triton.compiler.AttrsDescriptor(tuple(range(4)), (), (), ())

multiprocessing.set_start_method('fork')
Expand All @@ -65,15 +65,17 @@ def kernel_dot(Z):


def test_compile_in_forked_subproc() -> None:
pytest.skip("FIXME: Port get_device_capability to XPU")
capability = 0
if torch.cuda.is_available():
major, minor = torch.cuda.get_device_capability(0)
capability = major * 10 + minor

reset_tmp_dir()
major, minor = torch.cuda.get_device_capability(0)
capability = major * 10 + minor
config = triton.compiler.AttrsDescriptor(tuple(range(1)), (), (), ())

assert multiprocessing.get_start_method() == 'fork'
proc = multiprocessing.Process(target=compile_fn_dot, args=(config, capability))
proc.start()
proc.join()
assert proc.exitcode == 0

reset_tmp_dir()

0 comments on commit 7e6fc44

Please sign in to comment.