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

Fix ouputs outputs #60825

Merged
merged 2 commits into from
Jan 16, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def _allreduce_fusion_program(self):
continue
param_grads.append((param, grad))

outputs_name_to_idx = self.__get_ouputs_name_to_idx(
outputs_name_to_idx = self.__get_outputs_name_to_idx(
first_backward_idx, block
)

Expand Down Expand Up @@ -476,7 +476,7 @@ def get_after_idx_of_fuse_group(grad_param_segments):
idx += 1

# update the outputs_name_to_idx after insertion of sync/allreduce ops
outputs_name_to_idx = self.__get_ouputs_name_to_idx(
outputs_name_to_idx = self.__get_outputs_name_to_idx(
first_backward_idx, block
)
# the before_idx is not guaranteed sorted, therefore we have to find the
Expand Down Expand Up @@ -530,7 +530,7 @@ def get_after_idx_of_fuse_group(grad_param_segments):
break
block._sync_with_cpp()

def __get_ouputs_name_to_idx(self, first_backward_idx, block):
def __get_outputs_name_to_idx(self, first_backward_idx, block):
# Each item of outputs_name_to_idx is a pair of idx.
# The first entry of this pair is the idx of the first op generates the grad,
# which is used to indicate the position to insert coalesce op.
Expand Down
4 changes: 2 additions & 2 deletions test/ir/pir/fused_pass/test_fused_dropout_add_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def _test_fused_dropout_add(self):
pm = paddle.pir.PassManager()
pm.add_pass(
'fused_dropout_add_pass'
) # apply pass to elimitate dead code
) # apply pass to eliminate dead code
pm.run(main_program)
op_names = [op.name() for op in main_program.global_block().ops]
self.assertTrue('pd_op.fused_dropout_add' in op_names)
Expand Down Expand Up @@ -91,7 +91,7 @@ def test_fused_dropout_add_grad(self):
pm = paddle.pir.PassManager()
pm.add_pass(
'fused_dropout_add_pass'
) # apply pass to elimitate dead code
) # apply pass to eliminate dead code
pm.run(main_program)
op_names = [op.name() for op in main_program.global_block().ops]
self.assertTrue(
Expand Down
4 changes: 2 additions & 2 deletions test/ir/pir/fused_pass/test_fused_gemm_epilogue_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def get_cuda_version():
not core.is_compiled_with_cuda() or get_cuda_version() < 11060,
"core is not complied with CUDA or nvcc version is less than11.6",
)
class TestFusedgemm_epilogueAdd(unittest.TestCase):
class TestFusedGemm_epilogueAdd(unittest.TestCase):
def test_fused_gemm_epilogue_add(self):
with paddle.pir_utils.IrGuard():
x_np = np.random.normal(3, 2.5, size=(1024, 1024)).astype(
Expand Down Expand Up @@ -94,7 +94,7 @@ def test_fused_gemm_epilogue_add(self):
pm = paddle.pir.PassManager()
pm.add_pass(
'fused_gemm_epilogue_pass'
) # apply pass to elimitate dead code
) # apply pass to eliminate dead code
pm.run(main_program)
op_names = [op.name() for op in main_program.global_block().ops]
self.assertTrue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TestFcElementwiseLayerNormFusePattern(PassTest):
\ /
Add
|
LayerNrom
LayerNorm
"""

def is_program_valid(self, program=None):
Expand Down
4 changes: 2 additions & 2 deletions test/ir/pir/test_pass_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ def test_op(self):
pm = pir.PassManager()
pm.add_pass(
'dead_code_elimination_pass'
) # apply pass to elimitate dead code
) # apply pass to eliminate dead code
pm.run(new_program)
op_names = [op.name() for op in new_program.global_block().ops]
# print(op_names)
self.assertEqual(pm.passes(), ['dead_code_elimination_pass'])
self.assertFalse(pm.empty())
self.assertTrue(
'pd_op.uniform' not in op_names
) # uniform is elimited because its output is not used
) # uniform is eliminated because its output is not used


if __name__ == "__main__":
Expand Down
10 changes: 5 additions & 5 deletions test/ir/pir/test_pir_identity_op_clean_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TestRemoveUselessScalePattern(PassTest):
def is_program_valid(self, program=None):
return True

def build_ir_progam(self):
def build_ir_program(self):
with paddle.pir_utils.IrGuard():
start_prog = paddle.static.Program()
main_prog = paddle.static.Program()
Expand All @@ -46,7 +46,7 @@ def build_ir_progam(self):
return [main_prog, start_prog]

def sample_program(self):
pir_program = self.build_ir_progam()
pir_program = self.build_ir_program()
yield pir_program, False

def test_check_output(self):
Expand All @@ -58,7 +58,7 @@ def setUp(self):
self.places.append(paddle.CUDAPlace(0))


class TestRemoveRedundentScalePattern(PassTest):
class TestRemoveRedundantScalePattern(PassTest):
def is_program_valid(self, program=None):
return True

Expand Down Expand Up @@ -169,7 +169,7 @@ def setUp(self):
self.places.append(paddle.CUDAPlace(0))


class TestRemoveRedundentCastPattern(PassTest):
class TestRemoveRedundantCastPattern(PassTest):
def is_program_valid(self, program=None):
return True

Expand Down Expand Up @@ -204,7 +204,7 @@ def setUp(self):
self.places.append(paddle.CUDAPlace(0))


class TestRemoveRedundentTransposePattern(PassTest):
class TestRemoveRedundantTransposePattern(PassTest):
def is_program_valid(self, program=None):
return True

Expand Down
2 changes: 1 addition & 1 deletion test/ir/pir/test_pir_to_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def func(x):
x_grad_ans = x.grad.numpy()
x.clear_gradient()

# ==== to static compuatation ====
# ==== to static computation ====
out = static_func(x)
out = out * 2
out.backward()
Expand Down
2 changes: 1 addition & 1 deletion test/ir/pir/test_standalone_pir.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def func(x, y):
np.testing.assert_array_equal(z.numpy(), gold_res)


# TODO(phlrain): open this after fix pr(55509) confict
# TODO(phlrain): open this after fix pr(55509) conflict
# class TestPirLogicalDygraph(unittest.TestCase):
# def test_with_pir(self):
# paddle.disable_static()
Expand Down
2 changes: 1 addition & 1 deletion test/ir/pir/test_stop_gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_data(self):
# TODO(Aurelius84): Add more test cases after API is migrated.


class TestParametes(unittest.TestCase):
class TestParameters(unittest.TestCase):
def setUp(self):
paddle.enable_static()

Expand Down
2 changes: 1 addition & 1 deletion test/ir/pir/test_while_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def test_backward(self):
"pd_op.add_grad",
)

def test_backward_with_loop_var_same_to_extral_var(self):
def test_backward_with_loop_var_same_to_extra_var(self):
main_program = paddle.static.Program()
with paddle.pir.core.program_guard(main_program):
i = paddle.full(shape=[1], fill_value=0)
Expand Down