mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-04-29 03:00:14 -04:00
Use MTLCompiler directly (v2) (#7920)
* Use MTLCompiler directly (v2) * to_block_literal and REQUEST_TYPE_COMPILE * Rewrite command encoding * Revert to_block_literal * Maybe that's more readable to some people? * Typo and comment about stdlib caching * Update ops_metal.py * Update ops_metal.py * Update ops_metal.py --------- Co-authored-by: George Hotz <72895+geohot@users.noreply.github.com>
This commit is contained in:
2
test/external/external_metal_compile_fail.py
vendored
2
test/external/external_metal_compile_fail.py
vendored
@@ -225,6 +225,6 @@ from tinygrad.runtime.ops_metal import MetalDevice, MetalCompiler, MetalProgram
|
||||
|
||||
if __name__ == "__main__":
|
||||
dev = MetalDevice("METAL")
|
||||
lib = MetalCompiler(dev).compile(src)
|
||||
lib = MetalCompiler().compile(src)
|
||||
prg = MetalProgram(dev, "r_64_32_8_16_4_6_6_4", lib)
|
||||
|
||||
|
||||
@@ -10,14 +10,12 @@ class TestMetal(unittest.TestCase):
|
||||
device.allocator.alloc(10000000000000000000)
|
||||
|
||||
def test_compile_error(self):
|
||||
device = MetalDevice("metal")
|
||||
compiler = MetalCompiler(device)
|
||||
compiler = MetalCompiler()
|
||||
with self.assertRaises(CompileError):
|
||||
compiler.compile("this is not valid metal")
|
||||
|
||||
def test_compile_success(self):
|
||||
device = MetalDevice("metal")
|
||||
compiler = MetalCompiler(device)
|
||||
compiler = MetalCompiler()
|
||||
ret = compiler.compile("""
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
@@ -41,7 +39,7 @@ class TestMetal(unittest.TestCase):
|
||||
|
||||
def test_failed_newLibraryWithData(self):
|
||||
device = MetalDevice("metal")
|
||||
compiler = MetalCompiler(device)
|
||||
compiler = MetalCompiler()
|
||||
compiled = compiler.compile("""
|
||||
#include <metal_stdlib>
|
||||
kernel void r_5(device int* data0, const device int* data1, uint3 gid [[threadgroup_position_in_grid]], uint3 lid [[thread_position_in_threadgroup]]){
|
||||
|
||||
Reference in New Issue
Block a user