77a8919349
* UV+DTR model * DTR model.. again. * fix naviGPS * fix radar... * fix.. * test * fix.. * carrot serv * fix.. * fix.. fleet * fix.. radar * fix atc * Steam Powered model.. * fix.. radarLatFactor range.. 200->500 * fix.. dbc.. * side * SP v2 * brake light * fix brakelight * fix.. * add datetime... * fix.. * fix.. * fix.. * fix.. * blind spot * fix tz * fix.. * ff * radarLatFactor * fix.. bsd * Revert "fix.. bsd" This reverts commit 1d0d1434470e1b92c65eaffaeb8dd7cd779f85ee. * fix.. bsd side.. * test * fix.. e2e conditions * Revert "test" This reverts commit 0ce791dbd66c17260366ed1a4df2626c602dbb7d. * TR16 * fix cut-in detect threshold 3.4 -> 2.6 * fix.. jerk_l limit 5->10 * fix.. * fix.. gm * fix.. OPTIMA_H mass * fix.. radar.. * fix radar.. * fix.. * Radar... * fix.. * fix.. * fix.. * fix.. radartrack 3 * fix.. * fix.. * fix.. * merge.. * fix.. canfd * fix.. * fix.. * fix.. * fix.. radard * new cut_in * Revert "new cut_in" This reverts commit b9b6e9b33318fe1ce7d626468139b17848efcdcd. * fix.. * new cut_in detect... * fix.. disp.. * fix.. * fix.. * fix.. center radar.. * fix.. radar y_sane.. * fix.. * fix.. * hkg jerk 10 -> 5 * fix.. * fix.. * fix.. radar dbc.. * fix.. * fix.. jLead filter.. * test new radar interface.. * fix.. * fix.. * test time... * Revert "test time..." This reverts commit 63e9187736985c4dc4b4f3736674ba7cda6adc3f. * fix radar.. * fix.. * FireHose model.. * tinygrad * Update interface.py * fix.. * fix.. nff toyota corolla_tss2 * fix.. * fix.. * fix.. radar * fix.. * fix.. radar, y_gate * fix.. radar.. * fix.. for clone.. * scc radar enable at low speed.. * fix.. settings.. * fix. * fix.. * fix.. radarTimeStep. * TR16 model again.. * RELEASE.md * fix cut-in detection... * fix.. registeration timeout 15sec.. * fix.. * fix.. radar processing. * fix.. * fix.. * fix.. * fix.. * fix.. * fix..
53 lines
1.9 KiB
Python
53 lines
1.9 KiB
Python
import unittest
|
|
import numpy as np
|
|
from tinygrad import Device
|
|
from tinygrad.device import CompileError
|
|
from tinygrad.helpers import flat_mv
|
|
if Device.DEFAULT=="AMD":
|
|
from tinygrad.runtime.ops_amd import AMDAllocator, AMDDevice, AMDProgram
|
|
from tinygrad.runtime.support.compiler_amd import AMDLLVMCompiler
|
|
|
|
@unittest.skipUnless(Device.DEFAULT == "AMD", "Runs only on AMD")
|
|
class TestAMDLLVM(unittest.TestCase):
|
|
def test_compiler(self):
|
|
src = '''
|
|
; https://github.com/llvm/llvm-project/blob/main/llvm/test/CodeGen/AMDGPU/imm.ll
|
|
define amdgpu_kernel void @i64_imm_inline_lo(ptr addrspace(1) %out) {
|
|
entry:
|
|
store i64 1311768464867721221, ptr addrspace(1) %out ; 0x1234567800000005
|
|
ret void
|
|
}
|
|
'''
|
|
device = AMDDevice()
|
|
compiler = AMDLLVMCompiler("gfx1100")
|
|
obj = compiler.compile(src)
|
|
allocator = AMDAllocator(device)
|
|
a = allocator.alloc(1*8)
|
|
prog = AMDProgram(device, "test", obj)
|
|
prog(a, wait=True)
|
|
na = np.empty(1, np.uint64)
|
|
allocator._copyout(flat_mv(na.data), a)
|
|
assert na == [0x1234567800000005]
|
|
|
|
def test_compiler_diag_error(self):
|
|
src = """
|
|
@local_temp0 = internal unnamed_addr addrspace(3) global [{N} x float*] undef, align 16
|
|
define amdgpu_kernel void @test(float* noalias align 32 %data0, half* noalias align 32 %data1, float* noalias align 32 %data2) #0
|
|
{{
|
|
%local_temp0 = addrspacecast [{N} x float*] addrspace(3)* @local_temp0 to [{N} x float*]*
|
|
%v178 = getelementptr inbounds float, float* %local_temp0, i32 1
|
|
%v133 = getelementptr inbounds float, float* %data2, i32 1
|
|
%v134 = load float, float* %v133
|
|
store float %v134, float* %v178
|
|
ret void
|
|
}}
|
|
"""
|
|
compiler = AMDLLVMCompiler("gfx1100")
|
|
compiler.compile(src.format(N=65536//8))
|
|
with self.assertRaises(CompileError):
|
|
# llvm diagnostic: <unknown>:0:0: local memory (65544) exceeds limit (65536) in function 'test'
|
|
compiler.compile(src.format(N=65536//8+1))
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|