Disambiguated functions

This commit is contained in:
Alejandro Saucedo 2021-02-20 17:10:42 +00:00
parent 2fb0641de0
commit 5bc3ac9c06
9 changed files with 40 additions and 40 deletions

View file

@ -118,13 +118,13 @@ namespace kp {
class Shader {
public:
static std::vector<char> compile(
static std::vector<char> compile_sources(
const std::vector<std::string>& sources,
const std::vector<std::string>& files = {},
const std::string& entryPoint = "main",
std::vector<std::pair<std::string,std::string>> definitions = {});
static std::vector<char> compile(
static std::vector<char> compile_source(
const std::string& source,
const std::string& entryPoint = "main",
std::vector<std::pair<std::string,std::string>> definitions = {});

View file

@ -4,7 +4,7 @@
namespace kp {
std::vector<char>
Shader::compile(const std::vector<std::string>& sources,
Shader::compile_sources(const std::vector<std::string>& sources,
const std::vector<std::string>& files,
const std::string& entryPoint,
std::vector<std::pair<std::string,std::string>> definitions) {
@ -85,10 +85,10 @@ Shader::compile(const std::vector<std::string>& sources,
}
std::vector<char>
Shader::compile(const std::string& source,
Shader::compile_source(const std::string& source,
const std::string& entryPoint,
std::vector<std::pair<std::string,std::string>> definitions) {
return compile({source});
return compile_sources({source});
}
}

View file

@ -13,13 +13,13 @@ namespace kp {
class Shader {
public:
static std::vector<char> compile(
static std::vector<char> compile_sources(
const std::vector<std::string>& sources,
const std::vector<std::string>& files = {},
const std::string& entryPoint = "main",
std::vector<std::pair<std::string,std::string>> definitions = {});
static std::vector<char> compile(
static std::vector<char> compile_source(
const std::string& source,
const std::string& entryPoint = "main",
std::vector<std::pair<std::string,std::string>> definitions = {});

View file

@ -55,7 +55,7 @@ TEST(TestAsyncOperations, TestManagerParallelExecution)
for (uint32_t i = 0; i < numParallel; i++) {
mgr.evalOpDefault<kp::OpAlgoBase>(
{ inputsSyncB[i] }, kp::Shader::compile(shader));
{ inputsSyncB[i] }, kp::Shader::compile_source(shader));
}
auto endSync = std::chrono::high_resolution_clock::now();
@ -89,7 +89,7 @@ TEST(TestAsyncOperations, TestManagerParallelExecution)
mgrAsync.evalOpAsync<kp::OpAlgoBase>(
{ inputsAsyncB[i] },
"async" + std::to_string(i),
kp::Shader::compile(shader));
kp::Shader::compile_source(shader));
}
for (uint32_t i = 0; i < numParallel; i++) {
@ -152,10 +152,10 @@ TEST(TestAsyncOperations, TestManagerAsyncExecution)
mgr.rebuild({ tensorA, tensorB });
mgr.evalOpAsync<kp::OpAlgoBase>(
{ tensorA }, "asyncOne", kp::Shader::compile(shader));
{ tensorA }, "asyncOne", kp::Shader::compile_source(shader));
mgr.evalOpAsync<kp::OpAlgoBase>(
{ tensorB }, "asyncTwo", kp::Shader::compile(shader));
{ tensorB }, "asyncTwo", kp::Shader::compile_source(shader));
mgr.evalOpAwait("asyncOne");
mgr.evalOpAwait("asyncTwo");

View file

@ -28,7 +28,7 @@ TEST(TestDestroy, TestDestroyTensorSingle)
sq->begin();
sq->record<kp::OpAlgoBase>(
{ tensorA }, kp::Shader::compile(shader));
{ tensorA }, kp::Shader::compile_source(shader));
sq->end();
sq->eval();
@ -71,7 +71,7 @@ TEST(TestDestroy, TestDestroyTensorVector)
sq->begin();
sq->record<kp::OpAlgoBase>(
{ tensorA, tensorB }, kp::Shader::compile(shader));
{ tensorA, tensorB }, kp::Shader::compile_source(shader));
sq->end();
sq->eval();
@ -136,7 +136,7 @@ TEST(TestDestroy, TestDestroySequenceSingle)
sq->begin();
sq->record<kp::OpAlgoBase>(
{ tensorA }, kp::Shader::compile(shader));
{ tensorA }, kp::Shader::compile_source(shader));
sq->end();
sq->eval();
@ -176,14 +176,14 @@ TEST(TestDestroy, TestDestroySequenceVector)
sq1 = mgr.sequence("One");
sq1->begin();
sq1->record<kp::OpAlgoBase>(
{ tensorA }, kp::Shader::compile(shader));
{ tensorA }, kp::Shader::compile_source(shader));
sq1->end();
sq1->eval();
sq2 = mgr.sequence("Two");
sq2->begin();
sq2->record<kp::OpAlgoBase>(
{ tensorA }, kp::Shader::compile(shader));
{ tensorA }, kp::Shader::compile_source(shader));
sq2->end();
sq2->eval();
@ -218,11 +218,11 @@ TEST(TestDestroy, TestDestroySequenceNameSingleInsideManager)
mgr.evalOp<kp::OpAlgoBase>(
{ tensorA }, "one",
kp::Shader::compile(shader));
kp::Shader::compile_source(shader));
mgr.evalOp<kp::OpAlgoBase>(
{ tensorA }, "two",
kp::Shader::compile(shader));
kp::Shader::compile_source(shader));
mgr.evalOpDefault<kp::OpTensorSyncLocal>({ tensorA });
@ -257,7 +257,7 @@ TEST(TestDestroy, TestDestroySequenceNameSingleOutsideManager)
sq1 = mgr.sequence("One");
sq1->begin();
sq1->record<kp::OpAlgoBase>(
{ tensorA }, kp::Shader::compile(shader));
{ tensorA }, kp::Shader::compile_source(shader));
sq1->end();
sq1->eval();
@ -291,11 +291,11 @@ TEST(TestDestroy, TestDestroySequenceNameVectorInsideManager)
mgr.evalOp<kp::OpAlgoBase>(
{ tensorA }, "one",
kp::Shader::compile(shader));
kp::Shader::compile_source(shader));
mgr.evalOp<kp::OpAlgoBase>(
{ tensorA }, "two",
kp::Shader::compile(shader));
kp::Shader::compile_source(shader));
mgr.evalOpDefault<kp::OpTensorSyncLocal>({ tensorA });
@ -325,11 +325,11 @@ TEST(TestDestroy, TestDestroySequenceNameVectorOutsideManager)
mgr.evalOp<kp::OpAlgoBase>(
{ tensorA }, "one",
kp::Shader::compile(shader));
kp::Shader::compile_source(shader));
mgr.evalOp<kp::OpAlgoBase>(
{ tensorA }, "two",
kp::Shader::compile(shader));
kp::Shader::compile_source(shader));
mgr.evalOpDefault<kp::OpTensorSyncLocal>({ tensorA });
@ -359,7 +359,7 @@ TEST(TestDestroy, TestDestroySequenceNameDefaultOutsideManager)
mgr.evalOpDefault<kp::OpAlgoBase>(
{ tensorA },
kp::Shader::compile(shader));
kp::Shader::compile_source(shader));
mgr.evalOpDefault<kp::OpTensorSyncLocal>({ tensorA });

View file

@ -28,11 +28,11 @@ TEST(TestMultipleAlgoExecutions, SingleSequenceRecord)
sq->begin();
sq->record<kp::OpAlgoBase>(
{ tensorA }, kp::Shader::compile(shader));
{ tensorA }, kp::Shader::compile_source(shader));
sq->record<kp::OpAlgoBase>(
{ tensorA }, kp::Shader::compile(shader));
{ tensorA }, kp::Shader::compile_source(shader));
sq->record<kp::OpAlgoBase>(
{ tensorA }, kp::Shader::compile(shader));
{ tensorA }, kp::Shader::compile_source(shader));
sq->record<kp::OpTensorSyncLocal>({ tensorA });
@ -73,19 +73,19 @@ TEST(TestMultipleAlgoExecutions, MultipleCmdBufRecords)
// Then perform the computations
sq->begin();
sq->record<kp::OpAlgoBase>({ tensorA },
kp::Shader::compile(shader));
kp::Shader::compile_source(shader));
sq->end();
sq->eval();
sq->begin();
sq->record<kp::OpAlgoBase>({ tensorA },
kp::Shader::compile(shader));
kp::Shader::compile_source(shader));
sq->end();
sq->eval();
sq->begin();
sq->record<kp::OpAlgoBase>({ tensorA },
kp::Shader::compile(shader));
kp::Shader::compile_source(shader));
sq->end();
sq->eval();
@ -122,7 +122,7 @@ TEST(TestMultipleAlgoExecutions, MultipleSequences)
sq->begin();
sq->record<kp::OpAlgoBase>(
{ tensorA }, kp::Shader::compile(shader));
{ tensorA }, kp::Shader::compile_source(shader));
sq->end();
sq->eval();
@ -135,7 +135,7 @@ TEST(TestMultipleAlgoExecutions, MultipleSequences)
sq->begin();
sq->record<kp::OpAlgoBase>(
{ tensorA }, kp::Shader::compile(shader));
{ tensorA }, kp::Shader::compile_source(shader));
sq->end();
sq->eval();
@ -148,7 +148,7 @@ TEST(TestMultipleAlgoExecutions, MultipleSequences)
sq->begin();
sq->record<kp::OpAlgoBase>(
{ tensorA }, kp::Shader::compile(shader));
{ tensorA }, kp::Shader::compile_source(shader));
sq->end();
sq->eval();
@ -206,7 +206,7 @@ TEST(TestMultipleAlgoExecutions, SingleRecordMultipleEval)
sq->begin();
sq->record<kp::OpAlgoBase>(
{ tensorA }, kp::Shader::compile(shader));
{ tensorA }, kp::Shader::compile_source(shader));
sq->end();
@ -265,7 +265,7 @@ TEST(TestMultipleAlgoExecutions, ManagerEvalMultSourceStrOpCreate)
mgr.evalOpDefault<kp::OpAlgoBase>(
{ tensorInA, tensorInB, tensorOut },
kp::Shader::compile(shader));
kp::Shader::compile_source(shader));
mgr.evalOpDefault<kp::OpTensorSyncLocal>({ tensorOut });
@ -308,7 +308,7 @@ TEST(TestMultipleAlgoExecutions, ManagerEvalMultSourceStrMgrCreate)
mgr.evalOpDefault<kp::OpAlgoBase>(
{ tensorInA, tensorInB, tensorOut },
kp::Shader::compile(shader));
kp::Shader::compile_source(shader));
mgr.evalOpDefault<kp::OpTensorSyncLocal>({ tensorOut });
@ -340,7 +340,7 @@ TEST(TestMultipleAlgoExecutions, SequenceAlgoDestroyOutsideManagerScope)
sq->begin();
sq->record<kp::OpAlgoBase>(
{ tensorA }, kp::Shader::compile(shader));
{ tensorA }, kp::Shader::compile_source(shader));
sq->end();
sq->eval();

View file

@ -53,7 +53,7 @@ TEST(TestProcessingIterations, IterateThroughMultipleSumAndCopies)
sq->record<kp::OpAlgoBase>(
{ tensorA, tensorB },
kp::Shader::compile(shader));
kp::Shader::compile_source(shader));
sq->record<kp::OpTensorCopy>({ tensorB, tensorA });
sq->end();

View file

@ -29,7 +29,7 @@ TEST(TestOpAlgoBase, ShaderRawDataFromConstructor)
)");
mgr.evalOpDefault<kp::OpAlgoBase>(
{ tensorA, tensorB }, kp::Shader::compile(shader));
{ tensorA, tensorB }, kp::Shader::compile_source(shader));
mgr.evalOpDefault<kp::OpTensorSyncLocal>({ tensorA, tensorB });

View file

@ -35,7 +35,7 @@ TEST(TestSpecializationConstants, TestTwoConstants)
sq->begin();
sq->record<kp::OpAlgoBase>(
{ tensorA, tensorB },
kp::Shader::compile(shader),
kp::Shader::compile_source(shader),
kp::Workgroup(), spec);
sq->end();