Commit 431a42bf by Leyuan Wang Committed by Tianqi Chen

[Metal] Correct handle warning info (#1140)

parent 8840b914
...@@ -83,21 +83,24 @@ class MetalModuleNode final :public runtime::ModuleNode { ...@@ -83,21 +83,24 @@ class MetalModuleNode final :public runtime::ModuleNode {
if (e.lib == nil) { if (e.lib == nil) {
if (fmt_ == "metal") { if (fmt_ == "metal") {
MTLCompileOptions *opts = [MTLCompileOptions alloc]; MTLCompileOptions *opts = [MTLCompileOptions alloc];
// Use the default setting for now. // Use the Metal 1.2 for now.
// by default most recent version is used. opts.languageVersion = MTLLanguageVersion1_2;
// opts.languageVersion = MTLLanguageVersion2_0; opts.fastMathEnabled = YES;
// opts.fastMathEnabled = YES; // opts = nil;
opts = nil;
e.lib = [ e.lib = [
w->devices[device_id] w->devices[device_id]
newLibraryWithSource:[NSString stringWithUTF8String:data_.c_str()] newLibraryWithSource:[NSString stringWithUTF8String:data_.c_str()]
options:opts options:opts
error:&err_msg]; error:&err_msg];
[opts dealloc]; [opts dealloc];
if (err_msg != nil || e.lib == nil) { if (e.lib == nil) {
LOG(FATAL) << "Fail to compile metal lib:" LOG(FATAL) << "Fail to compile metal lib:"
<< [[err_msg localizedDescription] UTF8String]; << [[err_msg localizedDescription] UTF8String];
} }
if (err_msg != nil) {
LOG(INFO) << "Warning: "
<< [[err_msg localizedDescription] UTF8String];
}
} else { } else {
// Build from library. // Build from library.
auto q = dispatch_queue_create("q", DISPATCH_QUEUE_SERIAL); auto q = dispatch_queue_create("q", DISPATCH_QUEUE_SERIAL);
......
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