UPdated examples and documentations to not require glsl deps
This commit is contained in:
parent
15346ee505
commit
96768a3302
10 changed files with 85 additions and 27 deletions
|
|
@ -5,6 +5,18 @@
|
|||
|
||||
#include "kompute/Kompute.hpp"
|
||||
|
||||
static std::vector<uint32_t>
|
||||
compileSource(
|
||||
const std::string& source)
|
||||
{
|
||||
if (system(std::string("glslangValidator --stdin -S comp -V -o tmp_kp_shader.comp.spv << END\n" + source + "\nEND").c_str()))
|
||||
throw std::runtime_error("Error running glslangValidator command");
|
||||
std::ifstream fileStream("tmp_kp_shader.comp.spv", std::ios::binary);
|
||||
std::vector<char> buffer;
|
||||
buffer.insert(buffer.begin(), std::istreambuf_iterator<char>(fileStream), {});
|
||||
return {(uint32_t*)buffer.data(), (uint32_t*)(buffer.data() + buffer.size())};
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
#if KOMPUTE_ENABLE_SPDLOG
|
||||
|
|
@ -39,7 +51,7 @@ int main()
|
|||
|
||||
std::vector<std::shared_ptr<kp::Tensor>> params = { tensorInA, tensorInB, tensorOut };
|
||||
|
||||
std::shared_ptr<kp::Algorithm> algo = mgr.algorithm(params, kp_test_utils::Shader::compileSource(shader));
|
||||
std::shared_ptr<kp::Algorithm> algo = mgr.algorithm(params, kp_test_utils::compileSource(shader));
|
||||
|
||||
mgr.sequence()
|
||||
->record<kp::OpTensorSyncDevice>(params)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue