ac75faa0cc
CI / build-and-test (push) Has been cancelled
- E4B-MarkBase model (42 layers, 4.4GB) loaded successfully - All Phase 1-6 tests passed (model loading, forward pass, vision/audio towers, token generation, performance) - All stress tests passed (5/5 in 127.6s) - Concurrent inference - Memory stress (67.5 tok/s, 0 NaN) - Continuous generation - Batch processing - Long-running stability - Swift Metal inference engine with multimodal support
51 lines
1.3 KiB
Swift
51 lines
1.3 KiB
Swift
#!/usr/bin/env swift
|
|
|
|
import Foundation
|
|
import Metal
|
|
|
|
print("=== Test: Create Engine and Compile Metal ===")
|
|
print("Start time: \(Date())")
|
|
fflush(stdout)
|
|
|
|
do {
|
|
// Create Metal device
|
|
guard let device = MTLCreateSystemDefaultDevice() else {
|
|
print("ERROR: Cannot create Metal device")
|
|
exit(1)
|
|
}
|
|
print("Metal device: \(device.name)")
|
|
fflush(stdout)
|
|
|
|
// Create command queue
|
|
guard let commandQueue = device.makeCommandQueue() else {
|
|
print("ERROR: Cannot create command queue")
|
|
exit(1)
|
|
}
|
|
print("Command queue created")
|
|
fflush(stdout)
|
|
|
|
// Try to compile Metal source (simple version)
|
|
let source = """
|
|
#include <metal_stdlib>
|
|
using namespace metal;
|
|
|
|
kernel void test_kernel(device float* output [[buffer(0)]],
|
|
uint id [[thread_position_in_grid]]) {
|
|
output[id] = float(id);
|
|
}
|
|
"""
|
|
|
|
print("Compiling Metal source...")
|
|
fflush(stdout)
|
|
|
|
let compileStart = Date()
|
|
let library = try device.makeLibrary(source: source, options: nil)
|
|
print("Metal compiled in \(Date().timeIntervalSince(compileStart))s")
|
|
fflush(stdout)
|
|
|
|
print("Test completed successfully!")
|
|
|
|
} catch {
|
|
print("ERROR: \(error)")
|
|
exit(1)
|
|
} |