Skip to content

Commit

Permalink
remove LOAD where valid is an empty set
Browse files Browse the repository at this point in the history
356 -> 354 valids
  • Loading branch information
chenyuxyz committed Sep 18, 2024
1 parent d4b662c commit 1fa44b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ jobs:
- if: ${{ matrix.task == 'optimage' }}
name: Test openpilot model compile and size
run: |
PYTHONPATH="." DEBUG=2 ALLOWED_KERNEL_COUNT=208 ALLOWED_GATED_READ_IMAGE=356 FLOAT16=1 DEBUGCL=1 GPU=1 IMAGE=2 python examples/openpilot/compile2.py
PYTHONPATH="." DEBUG=2 ALLOWED_KERNEL_COUNT=208 ALLOWED_GATED_READ_IMAGE=354 FLOAT16=1 DEBUGCL=1 GPU=1 IMAGE=2 python examples/openpilot/compile2.py
python -c 'import os; assert os.path.getsize("/tmp/output.thneed") < 100_000_000'
- if: ${{ matrix.task == 'optimage' }}
name: Test openpilot model correctness (float32)
Expand Down
3 changes: 3 additions & 0 deletions tinygrad/codegen/uopgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ def simplify_valid_image_load(load:UOp, buf:UOp):
lower = -stmt.src[1].arg+1
drop_stmt.append(stmt)

# valid is an empty set
if upper < lower: return UOp(UOps.LOAD, load.dtype, (buf, idx, invalid_val, valid.const_like(False)))

new_indx0, new_indx1 = None, None
if (L:=(lower * c + d)) // m == (U:=(upper * c + d)) // m: # in the same row
if (L % m - c < 0) and (U % m + c >= m): # spans the whole row
Expand Down

0 comments on commit 1fa44b7

Please sign in to comment.