From 2d577ee09fb759137e6282add965117cbeb01ee7 Mon Sep 17 00:00:00 2001 From: arghdos Date: Mon, 30 Jan 2017 14:41:29 -0500 Subject: [PATCH 1/3] fix call with no return values and options, and add test --- loopy/kernel/creation.py | 2 +- test/test_loopy.py | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/loopy/kernel/creation.py b/loopy/kernel/creation.py index 9a05408bb..885ecb576 100644 --- a/loopy/kernel/creation.py +++ b/loopy/kernel/creation.py @@ -394,7 +394,7 @@ ELSE_RE = re.compile("^\s*else\s*$") INSN_RE = re.compile( "^" "\s*" - "(?P.+?)" + "(?P[^{]+?)" "\s*(?.+?)" "\s*?" diff --git a/test/test_loopy.py b/test/test_loopy.py index ba20b5866..dd29ea24f 100644 --- a/test/test_loopy.py +++ b/test/test_loopy.py @@ -1494,6 +1494,26 @@ def test_call_with_no_returned_value(ctx_factory): # }}} +# {{{ call with no return values and options + +def test_call_with_options(ctx_factory): + import pymbolic.primitives as p + + ctx = ctx_factory() + queue = cl.CommandQueue(ctx) + + knl = lp.make_kernel( + "{:}", + "f() {id=init}" + ) + + from library_for_test import no_ret_f_mangler, no_ret_f_preamble_gen + knl = lp.register_function_manglers(knl, [no_ret_f_mangler]) + + evt, _ = knl(queue) + +# }}} + def test_unschedulable_kernel_detection(): knl = lp.make_kernel(["{[i,j]:0<=i,j Date: Mon, 30 Jan 2017 15:31:12 -0500 Subject: [PATCH 2/3] move from execute to print, same test --- test/test_loopy.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test_loopy.py b/test/test_loopy.py index dd29ea24f..bf808432b 100644 --- a/test/test_loopy.py +++ b/test/test_loopy.py @@ -1510,7 +1510,8 @@ def test_call_with_options(ctx_factory): from library_for_test import no_ret_f_mangler, no_ret_f_preamble_gen knl = lp.register_function_manglers(knl, [no_ret_f_mangler]) - evt, _ = knl(queue) + print(lp.generate_code_v2(knl).device_code()) + # }}} -- GitLab From 6317be5c7470665e5c86250afc9ee8588c9c5c11 Mon Sep 17 00:00:00 2001 From: arghdos Date: Mon, 30 Jan 2017 15:34:00 -0500 Subject: [PATCH 3/3] flake fixes --- test/test_loopy.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/test/test_loopy.py b/test/test_loopy.py index bf808432b..4c3dbd6d0 100644 --- a/test/test_loopy.py +++ b/test/test_loopy.py @@ -1494,25 +1494,20 @@ def test_call_with_no_returned_value(ctx_factory): # }}} -# {{{ call with no return values and options - -def test_call_with_options(ctx_factory): - import pymbolic.primitives as p - ctx = ctx_factory() - queue = cl.CommandQueue(ctx) +# {{{ call with no return values and options +def test_call_with_options(): knl = lp.make_kernel( "{:}", "f() {id=init}" ) - from library_for_test import no_ret_f_mangler, no_ret_f_preamble_gen + from library_for_test import no_ret_f_mangler knl = lp.register_function_manglers(knl, [no_ret_f_mangler]) print(lp.generate_code_v2(knl).device_code()) - # }}} -- GitLab