QCOM disassembly passes a packed chip identifier instead of the decoder generation
This defect surfaced while building an A630 mock GPU.
Status: confirmed source-interface mismatch; focused regression supplied.
Affected source
Production base: b536514c83c8b12176cbe621b8460ef8078524d2.
tinygrad/runtime/support/compiler_qcom.py: Git blob11c2e1e67d454eb4f567fb28a8cd66061ec7b9aa.
Reproducer
Save as test_qcom_disas.py in a tinygrad checkout and run
python -m pytest -q test_qcom_disas.py. No hardware, no native compiler, no
QCOM driver — disas_adreno is mocked and only the argument is asserted.
import struct
from types import SimpleNamespace
from unittest.mock import Mock
import pytest
from tinygrad.runtime.support import compiler_qcom
@pytest.mark.parametrize('arch', ['a630', 'a630,IMAGE_PITCH_ALIGNMENT=64'])
def test_disassembly_uses_shader_slice_and_architecture_number(arch, monkeypatch):
image = struct.pack('<2Q', 0, 6 << 55)
library = bytearray(b'\xa5' * 0x160)
struct.pack_into('<I', library, 0xc0, 0x140)
struct.pack_into('<I', library, 0x100, len(image))
library[0x140:0x150] = image
decode = Mock()
monkeypatch.setattr(compiler_qcom, 'disas_adreno', decode)
compiler = SimpleNamespace(arch=arch, chip_id=0x6030001)
compiler_qcom.QCOMCompiler.disassemble(compiler, bytes(library))
decode.assert_called_once_with(image, 630)Both parametrizations fail on a3278fa76:
E AssertionError: expected call not found.
E Expected: mock(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03', 630)
E Actual: mock(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03', 100859905)100859905 is 0x6030001, the packed chip ID.
Expected versus actual
Expected: The ISA disassembler receives only the shader image bytes and numeric GPU generation 630 for both arch=a630 and arch=a630,IMAGE_PITCH_ALIGNMENT=64.
Observed source behavior / causal lead: The constructor sets both arch and chip_id=0x6030001. The base disassemble passes that packed chip identifier to a decoder expecting numeric generation 630. The supplied boundary test deliberately provides packed chip_id=0x6030001 and verifies 630, isolating the argument mismatch from native compiler initialization. This is not a missing-attribute defect.
Another defect in this set can surface first and mask this one; attribute an earlier failure to that defect rather than to this report.
Suggested repair and scope
Derive numeric generation from the architecture prefix and keep image slicing unchanged. The offset temporary is readability only, not a separate defect.
Location: tinygrad/runtime/support/compiler_qcom.py@41.
Source: tinygrad/tinygrad