Skip to content

Commit

Permalink
Updates MLIR-TRT to 0.1.36
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavm-nvidia committed Nov 9, 2024
1 parent efaf830 commit 89f3351
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 21 deletions.
4 changes: 2 additions & 2 deletions tripy/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ requires-python = ">= 3.9"
license = {text = "Apache 2.0"}
dependencies = [
"tensorrt~=10.0",
"mlir-tensorrt-compiler==0.1.34+cuda12.trt102",
"mlir-tensorrt-runtime==0.1.34+cuda12.trt102",
"mlir-tensorrt-compiler==0.1.36+cuda12.trt102",
"mlir-tensorrt-runtime==0.1.36+cuda12.trt102",
"colored==2.2.3",
]

Expand Down
4 changes: 1 addition & 3 deletions tripy/tests/integration/test_iota.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ def test_negative_no_casting(self, dtype):
a = tp.ones((2, 2))
out = Iota.build([frontend_utils.tensor_from_shape_like(a.shape)], dim=0, output_rank=2, dtype=dtype)

exception_str = "error: 'tensorrt.linspace' op result #0 must be 0D/1D/2D/3D/4D/5D/6D/7D/8D tensor of 32-bit float or 32-bit signless integer values"
if dtype == tp.bool:
exception_str = "InternalError: failed to run compilation"
exception_str = "InternalError: failed to run compilation"
with helper.raises(
tp.TripyException,
match=exception_str,
Expand Down
3 changes: 2 additions & 1 deletion tripy/tests/integration/test_quantize.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import tripy as tp
from tests.helper import raises, TORCH_DTYPES
from tests.conftest import skip_if_older_than_sm80, skip_if_older_than_sm89
import cupy as cp


class TestQuantize:
Expand Down Expand Up @@ -118,4 +119,4 @@ def test_non_constant_scale(self):
scale = tp.ones((4,))
quantized = tp.quantize(input, scale, tp.int8, dim=0)

assert bool(tp.all(quantized == tp.ones((4, 4), dtype=tp.int8)))
assert bool(cp.all(cp.from_dlpack(quantized) == cp.ones((4, 4), dtype=cp.int8)))
8 changes: 4 additions & 4 deletions tripy/tripy/frontend/ops/tensor_initializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def zeros_like(input: "tripy.Tensor", dtype: Optional[datatype.dtype] = None) ->
@constraints.dtypes(
constraints={"tensor": "T1", constraints.RETURN_VALUE: "T1"},
variables={
"T1": ["float32", "float16", "bfloat16", "int32", "bool"],
"T1": ["float32", "float16", "bfloat16", "int32", "int64", "bool"],
},
)
def tril(tensor: "tripy.Tensor", diagonal: int = 0) -> "tripy.Tensor":
Expand Down Expand Up @@ -223,7 +223,7 @@ def tril(tensor: "tripy.Tensor", diagonal: int = 0) -> "tripy.Tensor":
@constraints.dtypes(
constraints={"tensor": "T1", constraints.RETURN_VALUE: "T1"},
variables={
"T1": ["float32", "float16", "bfloat16", "int32", "bool"],
"T1": ["float32", "float16", "bfloat16", "int32", "int64", "bool"],
},
)
def triu(tensor: "tripy.Tensor", diagonal: int = 0) -> "tripy.Tensor":
Expand Down Expand Up @@ -281,7 +281,7 @@ def triu(tensor: "tripy.Tensor", diagonal: int = 0) -> "tripy.Tensor":
@constraints.dtypes(
constraints={"dtype": "T1", constraints.RETURN_VALUE: "T1"},
variables={
"T1": ["float32", "float16", "bfloat16", "int8", "int32", "bool"],
"T1": ["float32", "float16", "bfloat16", "int8", "int32", "int64", "bool"],
},
)
def arange(
Expand Down Expand Up @@ -346,7 +346,7 @@ def arange(
@constraints.dtypes(
constraints={"dtype": "T1", constraints.RETURN_VALUE: "T1"},
variables={
"T1": ["float32", "float16", "bfloat16", "int8", "int32", "bool"],
"T1": ["float32", "float16", "bfloat16", "int8", "int32", "int64", "bool"],
},
)
def arange(
Expand Down
2 changes: 1 addition & 1 deletion tripy/tripy/frontend/trace/ops/flip.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def to_flat_ir(self, inputs, outputs):
@constraints.dtypes(
constraints={"input": "T1", constraints.RETURN_VALUE: "T1"},
variables={
"T1": ["float32", "float16", "bfloat16", "int32", "bool"],
"T1": ["float32", "float16", "bfloat16", "int32", "int64", "bool"],
},
)
def flip(input: "tripy.Tensor", dims: Optional[Union[int, Sequence[int]]] = None) -> "tripy.Tensor":
Expand Down
2 changes: 1 addition & 1 deletion tripy/tripy/frontend/trace/ops/gather.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def to_flat_ir(self, inputs, outputs):
@constraints.dtypes(
constraints={"input": "T1", "index": "T2", constraints.RETURN_VALUE: "T1"},
variables={
"T1": ["float32", "float16", "bfloat16", "int8", "int32", "bool"],
"T1": ["float32", "float16", "bfloat16", "int4", "int8", "int32", "int64", "bool"],
"T2": ["int32"],
},
)
Expand Down
4 changes: 2 additions & 2 deletions tripy/tripy/frontend/trace/ops/iota.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def iota_impl(shape: "tripy.Tensor", dim: int, dtype: datatype.dtype, output_ran
@constraints.dtypes(
constraints={"dtype": "T1", constraints.RETURN_VALUE: "T1"},
variables={
"T1": ["float32", "float16", "bfloat16", "float8", "int4", "int8", "int32", "bool"],
"T1": ["float32", "float16", "bfloat16", "float8", "int4", "int8", "int32", "int64", "bool"],
},
)
def iota(shape: ShapeLike, dim: int = 0, dtype: datatype.dtype = datatype.float32) -> "tripy.Tensor":
Expand Down Expand Up @@ -101,7 +101,7 @@ def iota(shape: ShapeLike, dim: int = 0, dtype: datatype.dtype = datatype.float3
constraints={"input": "T1", "dtype": "T2", constraints.RETURN_VALUE: "T2"},
variables={
"T1": ["float32", "float16", "bfloat16", "float8", "int4", "int8", "int32", "int64", "bool"],
"T2": ["float32", "float16", "bfloat16", "float8", "int4", "int8", "int32", "bool"],
"T2": ["float32", "float16", "bfloat16", "float8", "int4", "int8", "int32", "int64", "bool"],
},
)
def iota_like(input: "tripy.Tensor", dim: int = 0, dtype: Optional[datatype.dtype] = None) -> "tripy.Tensor":
Expand Down
12 changes: 6 additions & 6 deletions tripy/tripy/frontend/trace/ops/reduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def _reduce_impl(input: "tripy.Tensor", kind: Reduce.Kind, dim: Union[int, Seque
@export.public_api(document_under="operations/functions")
@constraints.dtypes(
constraints={"input": "T1", constraints.RETURN_VALUE: "T1"},
variables={"T1": ["float32", "int32", "float16", "bfloat16"]},
variables={"T1": ["float32", "int32", "int64", "float16", "bfloat16"]},
)
def sum(
input: "tripy.Tensor", dim: Optional[Union[int, Sequence[int]]] = None, keepdim: bool = False
Expand Down Expand Up @@ -232,7 +232,7 @@ def any(
@export.public_api(document_under="operations/functions")
@constraints.dtypes(
constraints={"input": "T1", constraints.RETURN_VALUE: "T1"},
variables={"T1": ["float32", "int32", "float16", "bfloat16"]},
variables={"T1": ["float32", "int32", "int64", "float16", "bfloat16"]},
)
def max(
input: "tripy.Tensor", dim: Optional[Union[int, Sequence[int]]] = None, keepdim: bool = False
Expand Down Expand Up @@ -265,7 +265,7 @@ def max(
@export.public_api(document_under="operations/functions")
@constraints.dtypes(
constraints={"input": "T1", constraints.RETURN_VALUE: "T1"},
variables={"T1": ["float32", "int32", "float16", "bfloat16"]},
variables={"T1": ["float32", "int32", "int64", "float16", "bfloat16"]},
)
def prod(
input: "tripy.Tensor", dim: Optional[Union[int, Sequence[int]]] = None, keepdim: bool = False
Expand Down Expand Up @@ -313,7 +313,7 @@ def mean_impl(tensor: "tripy.Tensor", dim: Union[int, Sequence] = None, keepdim:
@export.public_api(document_under="operations/functions")
@constraints.dtypes(
constraints={"input": "T1", constraints.RETURN_VALUE: "T1"},
variables={"T1": ["float32", "int32", "float16", "bfloat16"]},
variables={"T1": ["float32", "int32", "int64", "float16", "bfloat16"]},
)
def mean(
input: "tripy.Tensor", dim: Optional[Union[int, Sequence[int]]] = None, keepdim: bool = False
Expand Down Expand Up @@ -413,7 +413,7 @@ def _arg_min_max_impl(tensor: "tripy.Tensor", kind: ArgMinMax.Kind, dim: Optiona
@export.public_api(document_under="operations/functions")
@constraints.dtypes(
constraints={"input": "T1", constraints.RETURN_VALUE: "T2"},
variables={"T1": ["float32", "float16", "bfloat16", "int32", "bool", "int8"], "T2": ["int32"]},
variables={"T1": ["float32", "float16", "bfloat16", "int32"], "T2": ["int32"]},
)
def argmax(input: "tripy.Tensor", dim: Optional[int] = None, keepdim: bool = False) -> "tripy.Tensor":
"""
Expand Down Expand Up @@ -445,7 +445,7 @@ def argmax(input: "tripy.Tensor", dim: Optional[int] = None, keepdim: bool = Fal
@export.public_api(document_under="operations/functions")
@constraints.dtypes(
constraints={"input": "T1", constraints.RETURN_VALUE: "T2"},
variables={"T1": ["float32", "float16", "bfloat16", "int32", "bool", "int8"], "T2": ["int32"]},
variables={"T1": ["float32", "float16", "bfloat16", "int32"], "T2": ["int32"]},
)
def argmin(input: "tripy.Tensor", dim: Optional[int] = None, keepdim: bool = False) -> "tripy.Tensor":
"""
Expand Down
2 changes: 1 addition & 1 deletion tripy/tripy/frontend/trace/ops/unary_elementwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def log(input: "tripy.Tensor") -> "tripy.Tensor":
@export.public_api(document_under="operations/functions")
@constraints.dtypes(
constraints={"input": "T1", constraints.RETURN_VALUE: "T1"},
variables={"T1": ["float32", "float16", "bfloat16", "int8", "int32"]},
variables={"T1": ["float32", "float16", "bfloat16", "int8", "int32", "int64"]},
)
def abs(input: "tripy.Tensor") -> "tripy.Tensor":
r"""
Expand Down

0 comments on commit 89f3351

Please sign in to comment.