Updated compile_shader to compileShader

This commit is contained in:
Alejandro Saucedo 2021-03-06 12:02:08 +00:00
parent cc1ec748a7
commit fa5dc43b44
14 changed files with 28 additions and 28 deletions

View file

@ -39,7 +39,7 @@ int main()
std::vector<std::shared_ptr<kp::Tensor>> params = { tensorInA, tensorInB, tensorOut };
std::shared_ptr<kp::Algorithm> algo = mgr.algorithm(params, kp::Shader::compile_source(shader));
std::shared_ptr<kp::Algorithm> algo = mgr.algorithm(params, kp::Shader::compileSource(shader));
mgr.sequence()
->record<kp::OpTensorSyncDevice>(params)

View file

@ -54,7 +54,7 @@ void KomputeSummatorNode::_init() {
std::shared_ptr<kp::Algorithm> algo =
mgr.algorithm(
{ this->mPrimaryTensor, this->mSecondaryTensor },
kp::Shader::compile_source(shader));
kp::Shader::compileSource(shader));
// First we ensure secondary tensor loads to GPU

View file

@ -58,7 +58,7 @@ void KomputeSummator::_init() {
// Then we run the operation with both tensors
this->mSequence->record<kp::OpAlgoCreate>(
{ this->mPrimaryTensor, this->mSecondaryTensor },
kp::Shader::compile_source(shader));
kp::Shader::compileSource(shader));
// We map the result back to local
this->mSequence->record<kp::OpTensorSyncLocal>(

View file

@ -762,7 +762,7 @@ class Shader
* GLSL compiler
* @return The compiled SPIR-V binary in unsigned int32 format
*/
static std::vector<uint32_t> compile_sources(
static std::vector<uint32_t> compileSources(
const std::vector<std::string>& sources,
const std::vector<std::string>& files = {},
const std::string& entryPoint = "main",
@ -783,7 +783,7 @@ class Shader
* GLSL compiler
* @return The compiled SPIR-V binary in unsigned int32 format
*/
static std::vector<uint32_t> compile_source(
static std::vector<uint32_t> compileSource(
const std::string& source,
const std::string& entryPoint = "main",
std::vector<std::pair<std::string, std::string>> definitions = {},

View file

@ -5,7 +5,7 @@
namespace kp {
std::vector<uint32_t>
Shader::compile_sources(
Shader::compileSources(
const std::vector<std::string>& sources,
const std::vector<std::string>& files,
const std::string& entryPoint,
@ -92,13 +92,13 @@ Shader::compile_sources(
}
std::vector<uint32_t>
Shader::compile_source(
Shader::compileSource(
const std::string& source,
const std::string& entryPoint,
std::vector<std::pair<std::string, std::string>> definitions,
const TBuiltInResource& resource)
{
return compile_sources({ source },
return compileSources({ source },
std::vector<std::string>({}),
entryPoint,
definitions,

View file

@ -39,7 +39,7 @@ class Shader
* GLSL compiler
* @return The compiled SPIR-V binary in unsigned int32 format
*/
static std::vector<uint32_t> compile_sources(
static std::vector<uint32_t> compileSources(
const std::vector<std::string>& sources,
const std::vector<std::string>& files = {},
const std::string& entryPoint = "main",
@ -60,7 +60,7 @@ class Shader
* GLSL compiler
* @return The compiled SPIR-V binary in unsigned int32 format
*/
static std::vector<uint32_t> compile_source(
static std::vector<uint32_t> compileSource(
const std::string& source,
const std::string& entryPoint = "main",
std::vector<std::pair<std::string, std::string>> definitions = {},

View file

@ -37,7 +37,7 @@ TEST(TestAsyncOperations, TestManagerParallelExecution)
}
)");
std::vector<uint32_t> spirv = kp::Shader::compile_source(shader);
std::vector<uint32_t> spirv = kp::Shader::compileSource(shader);
std::vector<float> data(size, 0.0);
std::vector<float> resultSync(size, 100000000);
@ -145,7 +145,7 @@ TEST(TestAsyncOperations, TestManagerAsyncExecution)
}
)");
std::vector<uint32_t> spirv = kp::Shader::compile_source(shader);
std::vector<uint32_t> spirv = kp::Shader::compileSource(shader);
std::vector<float> data(size, 0.0);
std::vector<float> resultAsync(size, 100000000);

View file

@ -16,7 +16,7 @@ TEST(TestDestroy, TestDestroyTensorSingle)
pa[index] = pa[index] + 1;
})");
std::vector<uint32_t> spirv = kp::Shader::compile_source(shader);
std::vector<uint32_t> spirv = kp::Shader::compileSource(shader);
{
std::shared_ptr<kp::Sequence> sq = nullptr;
@ -57,7 +57,7 @@ TEST(TestDestroy, TestDestroyTensorVector)
pa[index] = pa[index] + 1;
pb[index] = pb[index] + 2;
})");
std::vector<uint32_t> spirv = kp::Shader::compile_source(shader);
std::vector<uint32_t> spirv = kp::Shader::compileSource(shader);
{
std::shared_ptr<kp::Sequence> sq = nullptr;
@ -101,7 +101,7 @@ TEST(TestDestroy, TestDestroySequenceSingle)
pa[index] = pa[index] + 1;
})");
std::vector<uint32_t> spirv = kp::Shader::compile_source(shader);
std::vector<uint32_t> spirv = kp::Shader::compileSource(shader);
{
std::shared_ptr<kp::Sequence> sq = nullptr;

View file

@ -49,7 +49,7 @@ TEST(TestMultipleAlgoExecutions, TestEndToEndFunctionality)
kp::Constants pushConstsB({ 3.0 });
auto algorithm = mgr.algorithm(
params, kp::Shader::compile_source(shader), workgroup, specConsts, pushConstsA);
params, kp::Shader::compileSource(shader), workgroup, specConsts, pushConstsA);
// 3. Run operation with string shader synchronously
mgr.sequence()
@ -84,7 +84,7 @@ TEST(TestMultipleAlgoExecutions, SingleSequenceRecord)
pa[index] = pa[index] + 1;
})");
std::vector<uint32_t> spirv = kp::Shader::compile_source(shader);
std::vector<uint32_t> spirv = kp::Shader::compileSource(shader);
{
mgr.sequence()
@ -114,7 +114,7 @@ TEST(TestMultipleAlgoExecutions, MultipleCmdBufRecords)
pa[index] = pa[index] + 1;
})");
std::vector<uint32_t> spirv = kp::Shader::compile_source(shader);
std::vector<uint32_t> spirv = kp::Shader::compileSource(shader);
std::shared_ptr<kp::Algorithm> algorithm =
mgr.algorithm({ tensorA }, spirv);
@ -150,7 +150,7 @@ TEST(TestMultipleAlgoExecutions, MultipleSequences)
pa[index] = pa[index] + 1;
})");
std::vector<uint32_t> spirv = kp::Shader::compile_source(shader);
std::vector<uint32_t> spirv = kp::Shader::compileSource(shader);
std::shared_ptr<kp::Algorithm> algorithm =
mgr.algorithm({ tensorA }, spirv);
@ -185,7 +185,7 @@ TEST(TestMultipleAlgoExecutions, SingleRecordMultipleEval)
pa[index] = pa[index] + 1;
})");
std::vector<uint32_t> spirv = kp::Shader::compile_source(shader);
std::vector<uint32_t> spirv = kp::Shader::compileSource(shader);
std::shared_ptr<kp::Algorithm> algorithm =
mgr.algorithm({ tensorA }, spirv);
@ -221,7 +221,7 @@ TEST(TestMultipleAlgoExecutions, SequenceAlgoDestroyOutsideManagerScope)
pa[index] = pa[index] + 1;
})");
std::vector<uint32_t> spirv = kp::Shader::compile_source(shader);
std::vector<uint32_t> spirv = kp::Shader::compileSource(shader);
std::shared_ptr<kp::Algorithm> algorithm =
mgr.algorithm({ tensorA }, spirv);

View file

@ -27,7 +27,7 @@ TEST(TestOpAlgoCreate, ShaderRawDataFromConstructor)
}
)");
std::vector<uint32_t> spirv = kp::Shader::compile_source(shader);
std::vector<uint32_t> spirv = kp::Shader::compileSource(shader);
std::vector<std::shared_ptr<kp::Tensor>> params = { tensorA, tensorB };

View file

@ -22,7 +22,7 @@ TEST(TestPushConstants, TestConstantsAlgoDispatchOverride)
pa[2] += pcs.z;
})");
std::vector<uint32_t> spirv = kp::Shader::compile_source(shader);
std::vector<uint32_t> spirv = kp::Shader::compileSource(shader);
std::shared_ptr<kp::Sequence> sq = nullptr;
@ -65,7 +65,7 @@ TEST(TestPushConstants, TestConstantsAlgoDispatchNoOverride)
pa[2] += pcs.z;
})");
std::vector<uint32_t> spirv = kp::Shader::compile_source(shader);
std::vector<uint32_t> spirv = kp::Shader::compileSource(shader);
std::shared_ptr<kp::Sequence> sq = nullptr;
@ -108,7 +108,7 @@ TEST(TestPushConstants, TestConstantsWrongSize)
pa[2] += pcs.z;
})");
std::vector<uint32_t> spirv = kp::Shader::compile_source(shader);
std::vector<uint32_t> spirv = kp::Shader::compileSource(shader);
std::shared_ptr<kp::Sequence> sq = nullptr;

View file

@ -66,7 +66,7 @@ TEST(TestSequence, RerecordSequence)
sq->eval<kp::OpTensorSyncDevice>({ tensorA, tensorB, tensorOut });
std::vector<uint32_t> spirv = kp::Shader::compile_source(R"(
std::vector<uint32_t> spirv = kp::Shader::compileSource(R"(
#version 450
layout (local_size_x = 1) in;

View file

@ -25,7 +25,7 @@ static const std::string shaderString = (R"(
)");
void compileShaderWithGivenResources(const std::string shaderString, const TBuiltInResource resources) {
kp::Shader::compile_source(shaderString, std::string("main"), std::vector<std::pair<std::string,std::string>>({}), resources);
kp::Shader::compileSource(shaderString, std::string("main"), std::vector<std::pair<std::string,std::string>>({}), resources);
}

View file

@ -18,7 +18,7 @@ TEST(TestSpecializationConstants, TestTwoConstants)
pb[index] = cTwo;
})");
std::vector<uint32_t> spirv = kp::Shader::compile_source(shader);
std::vector<uint32_t> spirv = kp::Shader::compileSource(shader);
std::shared_ptr<kp::Sequence> sq = nullptr;