Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
naoyam committed Nov 8, 2024
1 parent 0c8043f commit b1634f3
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
13 changes: 9 additions & 4 deletions tests/cpp/test_alias.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ TEST_F(AliasTest, ReuseBuffer) {
EXPECT_TRUE(tensor.allclose(expected_tensor));
}

TEST_F(AliasTest, ReuseBuffer_FusionExecutor) {
TEST_F(AliasTest, ReuseBuffer_KernelExecutor) {
Fusion fusion;
FusionGuard fg(&fusion);
TensorView* in = makeContigTensor(1);
Expand Down Expand Up @@ -1527,10 +1527,15 @@ TEST_F(AliasTest, Issue2664) {
auto t2 = at::randn({}, options);
auto aten_out = (t2 + 1.0) * t1;

FusionExecutorCache fec(std::move(fusion));
auto out_tensors = fec.runFusionWithInputs({t1, t2});
FusionExecutorCache executor_cache(std::move(fusion));
auto out_tensors = executor_cache.runFusionWithInputs({t1, t2});
testValidate(
fec.fusion(), out_tensors, {t1, t2}, {aten_out}, __LINE__, __FILE__);
executor_cache.fusion(),
out_tensors,
{t1, t2},
{aten_out},
__LINE__,
__FILE__);
}

} // namespace nvfuser
4 changes: 2 additions & 2 deletions tests/cpp/test_gpu1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6381,9 +6381,9 @@ TEST_F(NVFuserTest, FusionMagicSchedulerLayerNormalization_CUDA) {

// tv11 and tv17 should not be predicated. See issue #496
ASSERT_FALSE(PredicatedChecker::isPredicated(
11, cg_results.fusion_executor->kernel()));
11, cg_results.kernel_executor->kernel()));
ASSERT_FALSE(PredicatedChecker::isPredicated(
17, cg_results.fusion_executor->kernel()));
17, cg_results.kernel_executor->kernel()));
}

TEST_F(NVFuserTest, FusionMagicSchedulerRMSNormalization_CUDA) {
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/test_gpu3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,7 @@ TEST_F(NVFuserTest, FusionVectorizeContigIndexPointwiseSchedule_CUDA) {
// vector word size should be 4. Broadcasting of tv1 should not
// matter.
for (const auto& vec_info :
cg_results.fusion_executor->kernel()->summary().vectorized_set_info) {
cg_results.kernel_executor->kernel()->summary().vectorized_set_info) {
NVF_CHECK(
vec_info.word_size == 4,
"Invalid vector word size: ",
Expand Down
4 changes: 2 additions & 2 deletions tests/cpp/test_multidevice_transformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,9 +785,9 @@ TEST_P(DistributedTransformerTest, Sequence_Parallel_MLP_Layer) {
shardTensor(reference_outs[2], 0, mesh),
shardTensor(reference_outs[3], 0, mesh)};

FusionExecutorCache fec(std::move(fusion));
FusionExecutorCache executor_cache(std::move(fusion));
at::manual_seed(getATenRandomSeed());
auto outputs = fec.runFusionWithInputs(inputs);
auto outputs = executor_cache.runFusionWithInputs(inputs);
validate(expected_outputs, outputs, {0.01, 0.01, 0.02, 0.02});
}

Expand Down
8 changes: 4 additions & 4 deletions tests/cpp/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ CGResultsPackage scheduleAndRun(
bool validate_scheduler) {
auto heuristic_params = SchedulerEntry::scheduleWith(
fusion, scheduler_type, runtime_inputs, validate_scheduler);
auto fe = std::make_unique<KernelExecutor>();
fe->compile(fusion, runtime_inputs, heuristic_params->lparams);
auto cg_outputs = fe->run(runtime_inputs, heuristic_params->lparams);
auto ke = std::make_unique<KernelExecutor>();
ke->compile(fusion, runtime_inputs, heuristic_params->lparams);
auto cg_outputs = ke->run(runtime_inputs, heuristic_params->lparams);
CGResultsPackage results = {
.outputs = cg_outputs,
.heuristic_params = std::move(heuristic_params),
.fusion_executor = std::move(fe)};
.kernel_executor = std::move(ke)};
return results;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace nvfuser {
struct CGResultsPackage {
std::vector<at::Tensor> outputs;
std::unique_ptr<HeuristicParams> heuristic_params;
std::unique_ptr<KernelExecutor> fusion_executor;
std::unique_ptr<KernelExecutor> kernel_executor;
};

// Returns the only executor in the most recent runtime.
Expand Down

0 comments on commit b1634f3

Please sign in to comment.