Commit 1f0ca085 by Leyuan Wang Committed by Tianqi Chen

Fix device name and Issue #874 (#1096)

parent 6f2ef9dc
......@@ -114,7 +114,7 @@ void MetalWorkspace::Init() {
devices.push_back([d retain]);
queues.push_back([[d newCommandQueue] retain]);
LOG(INFO) << "Intializing Metal device " << i
<< ", name=" << d.name;
<< ", name=" << [d.name UTF8String];
warp_size.push_back(GetWarpSize(d));
}
#endif
......
......@@ -82,11 +82,15 @@ class MetalModuleNode final :public runtime::ModuleNode {
NSError* err_msg = nil;
if (e.lib == nil) {
if (fmt_ == "metal") {
MTLCompileOptions *opts = [MTLCompileOptions alloc];
opts.languageVersion = MTLLanguageVersion2_0;
opts.fastMathEnabled = YES;
e.lib = [
w->devices[device_id]
newLibraryWithSource:[NSString stringWithUTF8String:data_.c_str()]
options:nil
options:opts
error:&err_msg];
[opts dealloc];
if (err_msg != nil || e.lib == nil) {
LOG(FATAL) << "Fail to compile metal lib:"
<< [[err_msg localizedDescription] UTF8String];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment