Skip to content
Merged
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
5 changes: 4 additions & 1 deletion tests/test_torch_custom_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ def test_torch_custom_pipeline(ir_type):
output = response.json()["output"]

assert "===== Initial IR =====" in output
assert "llvm.func @main(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: i64, %arg3: i64, %arg4: i64, %arg5: i64, %arg6: i64)" in output
assert (
"llvm.func @main(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: i64, %arg3: i64, %arg4: i64, %arg5: i64, %arg6: i64)"
in output
)
assert "===== IR after mlir-translate --mlir-to-llvmir =====" in output
assert "define { ptr, ptr, i64, [2 x i64], [2 x i64] } @main" in output
assert "===== IR after llc -mtriple=nvptx64 =====" in output
Expand Down
1 change: 1 addition & 0 deletions tests/test_torch_mlir_linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

API_URL = os.environ.get("API_URL", "http://localhost:8000/generate_ir")


def test_torch_mlir_linear():
code = """
import torch
Expand Down
6 changes: 5 additions & 1 deletion tests/test_torch_mock_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pytest
import httpx


@pytest.fixture(scope="session")
def mock_opt_path():
cpp_src = os.path.abspath("tests/cpp_sources/mock-opt.cpp")
Expand All @@ -17,6 +18,7 @@ def mock_opt_path():

shutil.rmtree(build_dir)


def test_torch_mock_opt(mock_opt_path):
code = """
import torch
Expand All @@ -41,7 +43,9 @@ def forward(self, x):
"dump_after_each_opt": True,
}

response = httpx.post(os.environ.get("API_URL", "http://localhost:8000/generate_ir"), json=payload)
response = httpx.post(
os.environ.get("API_URL", "http://localhost:8000/generate_ir"), json=payload
)
assert response.status_code == 200
assert "graph(%self.1 : __torch__.builtins.MyModel," in response.json()["output"]
assert "test mock_opt 42" in response.json()["output"]
2 changes: 1 addition & 1 deletion tests/test_torch_user_controlled_ir_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ def forward(self, x):
assert "affine_map" in ir
assert "memref.global" in ir
assert "arith.constant" in ir
assert "linalg.matmul" in ir
assert "linalg.matmul" in ir
2 changes: 2 additions & 0 deletions tests/test_triton_mock_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
reason="No NVIDIA GPU detected. Skip",
)


@pytest.fixture(scope="session")
def mock_opt_path():
cpp_src = os.path.abspath("tests/cpp_sources/mock-opt.cpp")
Expand All @@ -24,6 +25,7 @@ def mock_opt_path():

shutil.rmtree(build_dir)


def test_triton_mock_opt(mock_opt_path):
code = """
import triton
Expand Down
1 change: 1 addition & 0 deletions tests/test_wrong_command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def forward(self, x):
example_input = torch.randn(4, 4)
"""


@pytest.mark.parametrize("ir_type", ["llvm_mlir"])
def test_wrong_command_line(ir_type):
payload = {
Expand Down