fixing merge
parent
901051fcb1
commit
90076bf7ee
|
@ -290,7 +290,6 @@ jobs:
|
|||
- name: Build arm64 image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: test/extra/arm64_dockerfile
|
||||
platforms: linux/arm64
|
||||
load: true
|
||||
|
@ -299,4 +298,4 @@ jobs:
|
|||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
- name: Test Ops
|
||||
run: docker run -t -e ENABLE_METHOD_CACHE=1 -e CI=1 -e ARM64=1 -e CLANG=1 tinygrad-arm64 /usr/bin/env python3 -m pytest -n=auto test/ --ignore=test/models -m 'not exclude_clang'
|
||||
run: docker run -t -e ENABLE_METHOD_CACHE=1 -e CI=1 -e ARM64=1 -e CLANG=1 tinygrad-arm64 /usr/bin/env python3 -m pytest -n=auto test/test_ops.py
|
||||
|
|
|
@ -12,11 +12,10 @@ args = {
|
|||
CLANG_PROGRAM_HEADER = '#include <math.h>\n#define max(x,y) ((x>y)?x:y)\n#define int64 long\n#define half __fp16\n#define uchar unsigned char\n#define bool uchar\n'
|
||||
class ClangProgram:
|
||||
def __init__(self, name:str, prg:str, binary:bool=False):
|
||||
prg = CLANG_PROGRAM_HEADER + prg
|
||||
# TODO: is there a way to not write this to disk?
|
||||
fn = f"{tempfile.gettempdir()}/clang_{hashlib.md5(prg.encode('utf-8')).hexdigest()}.{args['ext']}"
|
||||
if not binary:
|
||||
prg = '#include <math.h>\n#define max(x,y) ((x>y)?x:y)\n#define int64 long\n#define half __fp16\n#define uchar unsigned char\n#define bool uchar\n' + prg
|
||||
prg = CLANG_PROGRAM_HEADER + prg
|
||||
# TODO: is there a way to not write this to disk?
|
||||
if not os.path.exists(fn):
|
||||
subprocess.check_output(args=('clang -shared -O2 -Wall -Werror -x c '+args['cflags']+' - -o '+fn+'.tmp').split(), input=prg.encode('utf-8'))
|
||||
|
@ -25,7 +24,7 @@ class ClangProgram:
|
|||
if DEBUG >= 5: print(prg)
|
||||
if getenv('ARM64'):
|
||||
subprocess.check_output(args=('as -o '+fn+'.o').split(), input=prg.encode('utf-8'))
|
||||
subprocess.check_output(args=('clang -lm -shared '+fn+'.o -o'+fn).split())
|
||||
subprocess.check_output(args=('clang -lm -shared -fPIC '+fn+'.o -o'+fn).split())
|
||||
self.lib = ctypes.CDLL(fn)
|
||||
self.fxn = self.lib[name]
|
||||
|
||||
|
|
Loading…
Reference in New Issue