gate the mockdsp behind MOCKDSP=1 [pr] (#10486)

This commit is contained in:
George Hotz
2025-05-23 11:44:02 -07:00
committed by GitHub
parent 3ca5680920
commit bf2a0907be
2 changed files with 5 additions and 3 deletions

View File

@@ -544,6 +544,8 @@ jobs:
tags: qemu-hexagon:latest
cache-from: type=gha
cache-to: type=gha,mode=min
- name: Set MOCKDSP env
run: printf "MOCKDSP=1" >> $GITHUB_ENV
- name: Run test_tiny on DSP
run: DEBUG=2 DSP=1 python test/test_tiny.py
- name: Test transcendentals

View File

@@ -130,7 +130,9 @@ class ClangCompiler(Compiler):
class DSPDevice(Compiled):
def __init__(self, device:str=""):
compiler_args = ["--target=hexagon", "-mcpu=hexagonv65", "-fuse-ld=lld", "-nostdlib", "-mhvx=v65", "-mhvx-length=128b"]
try:
if getenv("MOCKDSP"):
super().__init__(device, MallocAllocator, MockDSPRenderer(), ClangCompiler(None, ["-static"] + compiler_args, 'llvm-objdump'), MockDSPProgram)
else:
self.ion_fd = os.open('/dev/ion', os.O_RDONLY)
# Generate link script to pass into clang. Aligning all used sections to 4k fixes invoke problem.
sections = ['text', 'rela.plt', 'rela.dyn', 'plt', 'data', 'bss', 'hash', 'dynamic',
@@ -150,8 +152,6 @@ class DSPDevice(Compiled):
self.init_dsp()
RPCListener(self).start()
except FileNotFoundError:
super().__init__(device, MallocAllocator, MockDSPRenderer(), ClangCompiler(None, ["-static"] + compiler_args, 'llvm-objdump'), MockDSPProgram)
def open_lib(self, lib):
self.binded_lib, self.binded_lib_off = lib, 0