Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ported OCLTest to EE2 #3295

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions tests/unittests/BackendTestUtils2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,8 +789,8 @@ void inferConvDKKC8(Tensor *out, llvm::StringRef kind) {

void trainSoftMaxNet(Tensor *inputs, Tensor *weights, Tensor *bias,
Tensor *selected, Tensor *out, llvm::StringRef kind) {
ExecutionEngine2 EET(kind);
ExecutionEngine2 EEI(kind);
ExecutionEngine2 EET(kind);
std::vector<ExecutionEngine2 *> engines;
engines.push_back(&EEI);
engines.push_back(&EET);
Expand All @@ -817,20 +817,20 @@ void trainSoftMaxNet(Tensor *inputs, Tensor *weights, Tensor *bias,
auto *softmax = F->createSoftMax("softmax", fc, var2);
F->createSave("ret", softmax);
}
trainingBindings.allocate(EET.getModule().getPlaceholders());
inferBindings.allocate(EEI.getModule().getPlaceholders());
bindings.copyTrainableWeightsTo(trainingBindings);
auto *res = inferBindings.get(EEI.getModule().getPlaceholderByName("ret"));

auto *TF = glow::differentiate(F, TC);
auto tfName = TF->getName();
auto fName = F->getName();

EET.compile(CompilationMode::Train);

trainingBindings.allocate(EET.getModule().getPlaceholders());
bindings.copyTrainableWeightsTo(trainingBindings);
runBatch2(EET, trainingBindings, 30, sampleCounter, {var1, var2},
{inputs, selected}, tfName);
trainingBindings.copyTrainableWeightsTo(inferBindings);
EEI.compile(CompilationMode::Infer);
inferBindings.allocate(EEI.getModule().getPlaceholders());
trainingBindings.copyTrainableWeightsTo(inferBindings);
auto *res = inferBindings.get(EEI.getModule().getPlaceholderByName("ret"));
var1 = inferBindings.getPlaceholderByName("var1");
var2 = inferBindings.getPlaceholderByName("var2");
updateInputPlaceholders2(inferBindings, {var1, var2}, {inputs, selected});
Expand Down
4 changes: 2 additions & 2 deletions tests/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ if(GLOW_WITH_OPENCL)
OpenCL::OpenCL
PRIVATE
Backends
BackendTestUtils
ExecutionEngine
BackendTestUtils2
ExecutionEngine2
Graph
IR
gtest
Expand Down
4 changes: 2 additions & 2 deletions tests/unittests/OCLTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "BackendTestUtils.h"
#include "BackendTestUtils2.h"

// Silence Apple's warning about the deprecation of OpenCL.
#define CL_SILENCE_DEPRECATION
Expand All @@ -24,7 +24,7 @@

#include "../../lib/Backends/OpenCL/OpenCLDeviceManager.h"
#include "glow/Backends/DeviceManager.h"
#include "glow/ExecutionEngine/ExecutionEngine.h"
#include "glow/ExecutionEngine/ExecutionEngine2.h"
#include "glow/Graph/Graph.h"
#include "glow/IR/IR.h"
#include "glow/IR/IRBuilder.h"
Expand Down