Skip to content

Commit

Permalink
Fixed formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdiataei committed Oct 10, 2024
1 parent a9117c9 commit acbb387
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion warp/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1660,7 +1660,7 @@ def emit_Name(adj, node):
if node.id in adj.symbols:
return adj.symbols[node.id]
# Check if the node has a warp_func attribute
if hasattr(node, 'warp_func'):
if hasattr(node, "warp_func"):
return node.warp_func

obj = adj.resolve_external_reference(node.id)
Expand Down
15 changes: 6 additions & 9 deletions warp/tests/test_codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,8 @@ def test_while_condition_eval():
while it.valid:
it.valid = False

def test_function_assignment(test, device):

def test_function_assignment(test, device):
@wp.func
def multiply_by_two(a: float):
return a * 2.0
Expand All @@ -590,10 +590,13 @@ def kernel_function_assignment(input: wp.array(dtype=wp.float32), output: wp.arr

input_data = wp.array([1.0, 2.0, 3.0], dtype=wp.float32, device=device)
output_data = wp.empty_like(input_data)
wp.launch(kernel_function_assignment, dim=input_data.size, inputs=[input_data], outputs=[output_data], device=device)
wp.launch(
kernel_function_assignment, dim=input_data.size, inputs=[input_data], outputs=[output_data], device=device
)
expected_output = np.array([2.0, 4.0, 6.0], dtype=np.float32)
assert_np_equal(output_data.numpy(), expected_output)


class TestCodeGen(unittest.TestCase):
pass

Expand Down Expand Up @@ -736,13 +739,7 @@ class TestCodeGen(unittest.TestCase):
name="test_error_mutating_constant_in_dynamic_loop",
devices=devices,
)
add_function_test(
TestCodeGen,
func=test_function_assignment,
name="test_function_assignment",
devices=devices
)

add_function_test(TestCodeGen, func=test_function_assignment, name="test_function_assignment", devices=devices)
add_kernel_test(TestCodeGen, name="test_call_syntax", kernel=test_call_syntax, dim=1, devices=devices)
add_kernel_test(TestCodeGen, name="test_shadow_builtin", kernel=test_shadow_builtin, dim=1, devices=devices)
add_kernel_test(TestCodeGen, name="test_while_condition_eval", kernel=test_while_condition_eval, dim=1, devices=devices)
Expand Down

0 comments on commit acbb387

Please sign in to comment.