forked from apache/tvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
47 changed files
with
2,203 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/*! | ||
* Copyright (c) 2017 by Contributors | ||
* Build opengl modules from source. | ||
* \file build_opengl.cc | ||
*/ | ||
#include <tvm/base.h> | ||
#include "./codegen_opengl.h" | ||
#include "./build_common.h" | ||
|
||
namespace tvm { | ||
namespace codegen { | ||
|
||
runtime::Module BuildOpenGL(Array<LoweredFunc> funcs) { | ||
bool output_ssa = false; | ||
CodeGenOpenGL cg; | ||
cg.Init(output_ssa); | ||
for (LoweredFunc f : funcs) { | ||
cg.AddFunction(f); | ||
} | ||
auto shaders = cg.Finish(); | ||
#if TVM_OPENGL_RUNTIME | ||
return OpenGLModuleCreate(shaders, "gl", ExtractFuncInfo(funcs)); | ||
#else | ||
LOG(WARNING) << "OpenGL runtime not enabled, return a source module..."; | ||
auto data = ToJSON(shaders); | ||
return DeviceSourceModuleCreate(data, "gl", ExtractFuncInfo(funcs), "opengl"); | ||
#endif // TVM_OPENGL_RUNTIME | ||
} | ||
|
||
TVM_REGISTER_API("codegen.build_opengl") | ||
.set_body([](TVMArgs args, TVMRetValue* rv) { | ||
*rv = BuildOpenGL(args[0]); | ||
}); | ||
} // namespace codegen | ||
} // namespace tvm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.