Skip to content

Commit 212e38e

Browse files
committed
Merge branch 'main' of github.com:NVIDIA/TensorRT-Incubator into dev-yizhuoz-shape-input
2 parents 48dcf5b + 8550f41 commit 212e38e

File tree

6 files changed

+43
-5
lines changed

6 files changed

+43
-5
lines changed

mlir-tensorrt/CONTRIBUTING.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,35 @@ described here: https://llvm.org/docs/CodingStandards.html
99

1010
Python files are formatted using the [`black` formatter](https://black.readthedocs.io/en/stable/).
1111

12+
## Development Environment
13+
14+
This project provides a pre-configured CUDA 12.5 development environment using [Dev Containers](https://containers.dev/). We offer configurations for both `ubuntu` and `rockylinux8`, located in the `.devcontainer` directory.
15+
16+
### VS Code (Recommended)
17+
1. Install the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers).
18+
2. Open the project in VS Code.
19+
3. When prompted, click "Reopen in Container" and select your preferred OS configuration.
20+
21+
VS Code will automatically build the container and connect to the development environment.
22+
23+
### Dev Containers CLI
24+
If you are not using VS Code, you can manage the environment with the [Dev Containers CLI](https://github.com/devcontainers/cli).
25+
26+
1. Install the CLI.
27+
2. Choose one of the available configurations from the `.devcontainer` directory (e.g., `cuda12.5-ubuntu-llvm17`).
28+
3. From the project root, build and start the container by running the `up` command. Replace `<config-name>` with your chosen configuration.
29+
```bash
30+
devcontainer up --workspace-folder . --config .devcontainer/<config-name>/devcontainer.json
31+
```
32+
For example:
33+
```bash
34+
devcontainer up --workspace-folder . --config .devcontainer/cuda12.5-ubuntu-llvm17/devcontainer.json
35+
```
36+
4. To open a shell inside the running container, use the `exec` command:
37+
```bash
38+
devcontainer exec --workspace-folder . --config .devcontainer/<config-name>/devcontainer.json /bin/bash
39+
```
40+
1241
## How to Submit a PR
1342

1443
- Fork the repo on GitHub

mlir-tensorrt/Version.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
set(MLIR_TENSORRT_VERSION_MAJOR "0")
22
set(MLIR_TENSORRT_VERSION_MINOR "1")
3-
set(MLIR_TENSORRT_VERSION_PATCH "42")
3+
set(MLIR_TENSORRT_VERSION_PATCH "43")
44
set(MLIR_TENSORRT_VERSION
55
"${MLIR_TENSORRT_VERSION_MAJOR}.${MLIR_TENSORRT_VERSION_MINOR}.${MLIR_TENSORRT_VERSION_PATCH}")

tripy/nvtripy/frontend/ops/slice.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,19 @@ def get_min(a, b):
208208
else minimum(cast_to_dim_size(a), cast_to_dim_size(b))
209209
)
210210

211+
def get_max(a, b):
212+
return (
213+
max(a, b)
214+
if isinstance(a, int) and isinstance(b, int)
215+
else maximum(cast_to_dim_size(a), cast_to_dim_size(b))
216+
)
217+
211218
if slice_idx.start is not None:
212219
start = to_positive_idx(slice_idx.start)
213220
# If `start` is past the end, clamp it - if we're going backwards, we need to clamp it to a valid value;
214221
# otherwise, we can clamp it out of bounds (which will yield an empty tensor):
215222
start = get_min(start, select(step >= 0, dim_size, dim_size - 1))
223+
start = get_max(start, 0) # if the adjusted start is still negative, clamp it to 0
216224
else:
217225
start = default_start
218226

tripy/tests/integration/test_slice.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class TestSliceOp:
6969
((2, 3, 4), lambda t: t[None]),
7070
((2, 3, 4), lambda t: t[None, 1:2, :, None]),
7171
((2, 3, 4), lambda t: t[..., None, 0, None]),
72+
((1, 2), lambda t: t[:, -4:]), # negative start greater than dimension size
7273
],
7374
)
7475
def test_slice(self, use_constant, shape, slice_func, eager_or_compiled):

tripy/tests/test_examples.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ def __str__(self):
9393

9494

9595
def test_all_examples_tested():
96-
num_dirs = len([d for d in os.listdir(EXAMPLES_ROOT) if os.path.isdir(os.path.join(EXAMPLES_ROOT, d))])
97-
assert num_dirs == len(EXAMPLES), "Not all examples are being tested!"
96+
tested_examples = set(os.path.relpath(example.path, EXAMPLES_ROOT) for example in EXAMPLES)
97+
all_examples = set(d for d in os.listdir(EXAMPLES_ROOT) if os.path.isdir(os.path.join(EXAMPLES_ROOT, d)))
98+
assert tested_examples == all_examples, "Not all examples are being tested!"
9899

99100

100101
# We want to test our examples with both the latest commit and public build.

tripy/tests/utils/wrappers/test_datatype_constraints.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,7 @@ def test_datatype_constraints(case: DtypeConstraintCase):
222222
outputs = make_list(case.func(**inputs))
223223

224224
# Some APIs do not generate Tensor outputs (e.g. `allclose`), so we don't need to evaluate those.
225-
# For DimensionSizes, we don't need to check the type either (they can only be one type)
226-
if not any(type(out) == tp.Tensor for out in outputs):
225+
if not any(isinstance(out, tp.Tensor) for out in outputs):
227226
return
228227

229228
expected_return_types = [

0 commit comments

Comments
 (0)