warp-lang 1.3.3__py3-none-win_amd64.whl → 1.4.1__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of warp-lang might be problematic. Click here for more details.
- warp/__init__.py +6 -0
- warp/autograd.py +59 -6
- warp/bin/warp-clang.dll +0 -0
- warp/bin/warp.dll +0 -0
- warp/build_dll.py +8 -10
- warp/builtins.py +103 -3
- warp/codegen.py +447 -53
- warp/config.py +1 -1
- warp/context.py +682 -405
- warp/dlpack.py +2 -0
- warp/examples/benchmarks/benchmark_cloth.py +10 -0
- warp/examples/core/example_render_opengl.py +12 -10
- warp/examples/fem/example_adaptive_grid.py +251 -0
- warp/examples/fem/example_apic_fluid.py +1 -1
- warp/examples/fem/example_diffusion_3d.py +2 -2
- warp/examples/fem/example_magnetostatics.py +1 -1
- warp/examples/fem/example_streamlines.py +1 -0
- warp/examples/fem/utils.py +25 -5
- warp/examples/sim/example_cloth.py +50 -6
- warp/fem/__init__.py +2 -0
- warp/fem/adaptivity.py +493 -0
- warp/fem/field/field.py +2 -1
- warp/fem/field/nodal_field.py +18 -26
- warp/fem/field/test.py +4 -4
- warp/fem/field/trial.py +4 -4
- warp/fem/geometry/__init__.py +1 -0
- warp/fem/geometry/adaptive_nanogrid.py +843 -0
- warp/fem/geometry/nanogrid.py +55 -28
- warp/fem/space/__init__.py +1 -1
- warp/fem/space/nanogrid_function_space.py +69 -35
- warp/fem/utils.py +118 -107
- warp/jax_experimental.py +28 -15
- warp/native/array.h +0 -1
- warp/native/builtin.h +103 -6
- warp/native/bvh.cu +4 -2
- warp/native/cuda_util.cpp +14 -0
- warp/native/cuda_util.h +2 -0
- warp/native/error.cpp +4 -2
- warp/native/exports.h +99 -0
- warp/native/mat.h +97 -0
- warp/native/mesh.cpp +36 -0
- warp/native/mesh.cu +52 -1
- warp/native/mesh.h +1 -0
- warp/native/quat.h +43 -0
- warp/native/range.h +11 -2
- warp/native/spatial.h +6 -0
- warp/native/vec.h +74 -0
- warp/native/warp.cpp +2 -1
- warp/native/warp.cu +10 -3
- warp/native/warp.h +8 -1
- warp/paddle.py +382 -0
- warp/sim/__init__.py +1 -0
- warp/sim/collide.py +519 -0
- warp/sim/integrator_euler.py +18 -5
- warp/sim/integrator_featherstone.py +5 -5
- warp/sim/integrator_vbd.py +1026 -0
- warp/sim/integrator_xpbd.py +2 -6
- warp/sim/model.py +50 -25
- warp/sparse.py +9 -7
- warp/stubs.py +459 -0
- warp/tape.py +2 -0
- warp/tests/aux_test_dependent.py +1 -0
- warp/tests/aux_test_name_clash1.py +32 -0
- warp/tests/aux_test_name_clash2.py +32 -0
- warp/tests/aux_test_square.py +1 -0
- warp/tests/test_array.py +188 -0
- warp/tests/test_async.py +3 -3
- warp/tests/test_atomic.py +6 -0
- warp/tests/test_closest_point_edge_edge.py +93 -1
- warp/tests/test_codegen.py +93 -15
- warp/tests/test_codegen_instancing.py +1457 -0
- warp/tests/test_collision.py +486 -0
- warp/tests/test_compile_consts.py +3 -28
- warp/tests/test_dlpack.py +170 -0
- warp/tests/test_examples.py +22 -8
- warp/tests/test_fast_math.py +10 -4
- warp/tests/test_fem.py +81 -1
- warp/tests/test_func.py +46 -0
- warp/tests/test_implicit_init.py +49 -0
- warp/tests/test_jax.py +58 -0
- warp/tests/test_mat.py +84 -0
- warp/tests/test_mesh_query_point.py +188 -0
- warp/tests/test_model.py +13 -0
- warp/tests/test_module_hashing.py +40 -0
- warp/tests/test_multigpu.py +3 -3
- warp/tests/test_overwrite.py +8 -0
- warp/tests/test_paddle.py +852 -0
- warp/tests/test_print.py +89 -0
- warp/tests/test_quat.py +111 -0
- warp/tests/test_reload.py +31 -1
- warp/tests/test_scalar_ops.py +2 -0
- warp/tests/test_static.py +568 -0
- warp/tests/test_streams.py +64 -3
- warp/tests/test_struct.py +4 -4
- warp/tests/test_torch.py +24 -0
- warp/tests/test_triangle_closest_point.py +137 -0
- warp/tests/test_types.py +1 -1
- warp/tests/test_vbd.py +386 -0
- warp/tests/test_vec.py +143 -0
- warp/tests/test_vec_scalar_ops.py +139 -0
- warp/tests/unittest_suites.py +12 -0
- warp/tests/unittest_utils.py +9 -5
- warp/thirdparty/dlpack.py +3 -1
- warp/types.py +167 -36
- warp/utils.py +37 -14
- {warp_lang-1.3.3.dist-info → warp_lang-1.4.1.dist-info}/METADATA +10 -8
- {warp_lang-1.3.3.dist-info → warp_lang-1.4.1.dist-info}/RECORD +110 -98
- warp/tests/test_point_triangle_closest_point.py +0 -143
- {warp_lang-1.3.3.dist-info → warp_lang-1.4.1.dist-info}/LICENSE.md +0 -0
- {warp_lang-1.3.3.dist-info → warp_lang-1.4.1.dist-info}/WHEEL +0 -0
- {warp_lang-1.3.3.dist-info → warp_lang-1.4.1.dist-info}/top_level.txt +0 -0
warp/__init__.py
CHANGED
|
@@ -99,11 +99,17 @@ from warp.jax import device_from_jax, device_to_jax
|
|
|
99
99
|
|
|
100
100
|
from warp.dlpack import from_dlpack, to_dlpack
|
|
101
101
|
|
|
102
|
+
from warp.paddle import from_paddle, to_paddle
|
|
103
|
+
from warp.paddle import dtype_from_paddle, dtype_to_paddle
|
|
104
|
+
from warp.paddle import device_from_paddle, device_to_paddle
|
|
105
|
+
from warp.paddle import stream_from_paddle
|
|
106
|
+
|
|
102
107
|
from warp.build import clear_kernel_cache
|
|
103
108
|
|
|
104
109
|
from warp.constants import *
|
|
105
110
|
|
|
106
111
|
from . import builtins
|
|
112
|
+
from warp.builtins import static
|
|
107
113
|
|
|
108
114
|
import warp.config as config
|
|
109
115
|
|
warp/autograd.py
CHANGED
|
@@ -17,7 +17,7 @@ __all__ = [
|
|
|
17
17
|
"jacobian_fd",
|
|
18
18
|
"gradcheck",
|
|
19
19
|
"gradcheck_tape",
|
|
20
|
-
"
|
|
20
|
+
"jacobian_plot",
|
|
21
21
|
]
|
|
22
22
|
|
|
23
23
|
|
|
@@ -182,7 +182,7 @@ def gradcheck(
|
|
|
182
182
|
else:
|
|
183
183
|
print(FontColors.OKGREEN + f"Gradient check for kernel {function.key} passed" + FontColors.ENDC)
|
|
184
184
|
if plot_relative_error:
|
|
185
|
-
|
|
185
|
+
jacobian_plot(
|
|
186
186
|
relative_error_jacs,
|
|
187
187
|
function,
|
|
188
188
|
inputs,
|
|
@@ -190,7 +190,7 @@ def gradcheck(
|
|
|
190
190
|
title=f"{function.key} kernel Jacobian relative error",
|
|
191
191
|
)
|
|
192
192
|
if plot_absolute_error:
|
|
193
|
-
|
|
193
|
+
jacobian_plot(
|
|
194
194
|
absolute_error_jacs,
|
|
195
195
|
function,
|
|
196
196
|
inputs,
|
|
@@ -307,7 +307,7 @@ def infer_device(xs: list):
|
|
|
307
307
|
return wp.get_preferred_device()
|
|
308
308
|
|
|
309
309
|
|
|
310
|
-
def
|
|
310
|
+
def jacobian_plot(
|
|
311
311
|
jacobians: Dict[Tuple[int, int], wp.array],
|
|
312
312
|
kernel: wp.Kernel,
|
|
313
313
|
inputs: Sequence,
|
|
@@ -515,6 +515,59 @@ def plot_kernel_jacobians(
|
|
|
515
515
|
return fig
|
|
516
516
|
|
|
517
517
|
|
|
518
|
+
def plot_kernel_jacobians(
|
|
519
|
+
jacobians: Dict[Tuple[int, int], wp.array],
|
|
520
|
+
kernel: wp.Kernel,
|
|
521
|
+
inputs: Sequence,
|
|
522
|
+
outputs: Sequence,
|
|
523
|
+
show_plot=True,
|
|
524
|
+
show_colorbar=True,
|
|
525
|
+
scale_colors_per_submatrix=False,
|
|
526
|
+
title: str = None,
|
|
527
|
+
colormap: str = "coolwarm",
|
|
528
|
+
log_scale=False,
|
|
529
|
+
):
|
|
530
|
+
"""
|
|
531
|
+
Visualizes the Jacobians computed by :func:`jacobian` or :func:`jacobian_fd` in a combined image plot.
|
|
532
|
+
Requires the ``matplotlib`` package to be installed.
|
|
533
|
+
|
|
534
|
+
Note:
|
|
535
|
+
This function is deprecated and will be removed in a future Warp version. Please call :func:`jacobian_plot` instead.
|
|
536
|
+
|
|
537
|
+
Args:
|
|
538
|
+
jacobians: A dictionary of Jacobians, where the keys are tuples of input and output indices, and the values are the Jacobian matrices.
|
|
539
|
+
kernel: The Warp kernel function, decorated with the ``@wp.kernel`` decorator.
|
|
540
|
+
inputs: List of input variables.
|
|
541
|
+
outputs: List of output variables.
|
|
542
|
+
show_plot: If True, displays the plot via ``plt.show()``.
|
|
543
|
+
show_colorbar: If True, displays a colorbar next to the plot (or a colorbar next to every submatrix if ).
|
|
544
|
+
scale_colors_per_submatrix: If True, considers the minimum and maximum of each Jacobian submatrix separately for color scaling. Otherwise, uses the global minimum and maximum of all Jacobians.
|
|
545
|
+
title: The title of the plot (optional).
|
|
546
|
+
colormap: The colormap to use for the plot.
|
|
547
|
+
log_scale: If True, uses a logarithmic scale for the matrix values shown in the image plot.
|
|
548
|
+
|
|
549
|
+
Returns:
|
|
550
|
+
The created Matplotlib figure.
|
|
551
|
+
"""
|
|
552
|
+
wp.utils.warn(
|
|
553
|
+
"The function `plot_kernel_jacobians` is deprecated and will be removed in a future Warp version. Please call `jacobian_plot` instead.",
|
|
554
|
+
DeprecationWarning,
|
|
555
|
+
stacklevel=3,
|
|
556
|
+
)
|
|
557
|
+
return jacobian_plot(
|
|
558
|
+
jacobians,
|
|
559
|
+
kernel,
|
|
560
|
+
inputs,
|
|
561
|
+
outputs,
|
|
562
|
+
show_plot=show_plot,
|
|
563
|
+
show_colorbar=show_colorbar,
|
|
564
|
+
scale_colors_per_submatrix=scale_colors_per_submatrix,
|
|
565
|
+
title=title,
|
|
566
|
+
colormap=colormap,
|
|
567
|
+
log_scale=log_scale,
|
|
568
|
+
)
|
|
569
|
+
|
|
570
|
+
|
|
518
571
|
def scalarize_array_1d(arr):
|
|
519
572
|
# convert array to 1D array with scalar dtype
|
|
520
573
|
if arr.dtype in wp.types.scalar_types:
|
|
@@ -638,7 +691,7 @@ def jacobian(
|
|
|
638
691
|
jacobians[input_i, output_i] = jacobian
|
|
639
692
|
|
|
640
693
|
if plot_jacobians:
|
|
641
|
-
|
|
694
|
+
jacobian_plot(
|
|
642
695
|
jacobians,
|
|
643
696
|
kernel,
|
|
644
697
|
inputs,
|
|
@@ -753,7 +806,7 @@ def jacobian_fd(
|
|
|
753
806
|
jacobians[input_i, output_i] = jacobian
|
|
754
807
|
|
|
755
808
|
if plot_jacobians:
|
|
756
|
-
|
|
809
|
+
jacobian_plot(
|
|
757
810
|
jacobians,
|
|
758
811
|
kernel,
|
|
759
812
|
inputs,
|
warp/bin/warp-clang.dll
CHANGED
|
Binary file
|
warp/bin/warp.dll
CHANGED
|
Binary file
|
warp/build_dll.py
CHANGED
|
@@ -32,13 +32,12 @@ def run_cmd(cmd):
|
|
|
32
32
|
print(cmd)
|
|
33
33
|
|
|
34
34
|
try:
|
|
35
|
-
return subprocess.check_output(cmd, shell=True)
|
|
35
|
+
return subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
|
|
36
36
|
except subprocess.CalledProcessError as e:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
raise (e)
|
|
37
|
+
print("Command failed with exit code:", e.returncode)
|
|
38
|
+
print("Command output was:")
|
|
39
|
+
print(e.output.decode())
|
|
40
|
+
raise e
|
|
42
41
|
|
|
43
42
|
|
|
44
43
|
# cut-down version of vcvars64.bat that allows using
|
|
@@ -157,7 +156,6 @@ def build_dll_for_arch(args, dll_path, cpp_paths, cu_path, libs, arch, mode=None
|
|
|
157
156
|
|
|
158
157
|
warp_home_path = pathlib.Path(__file__).parent
|
|
159
158
|
warp_home = warp_home_path.resolve()
|
|
160
|
-
nanovdb_home = warp_home_path.parent / "_build/host-deps/nanovdb/include"
|
|
161
159
|
|
|
162
160
|
# output stale, rebuild
|
|
163
161
|
if args.verbose:
|
|
@@ -246,7 +244,7 @@ def build_dll_for_arch(args, dll_path, cpp_paths, cu_path, libs, arch, mode=None
|
|
|
246
244
|
iter_dbg = "_ITERATOR_DEBUG_LEVEL=2"
|
|
247
245
|
debug = "_DEBUG"
|
|
248
246
|
|
|
249
|
-
cpp_flags = f'/nologo /std:c++17 /GR- {runtime} /D "{debug}" /D "{cuda_enabled}" /D "{cutlass_enabled}" /D "{cuda_compat_enabled}" /D "{iter_dbg}" /I"{native_dir}"
|
|
247
|
+
cpp_flags = f'/nologo /std:c++17 /GR- {runtime} /D "{debug}" /D "{cuda_enabled}" /D "{cutlass_enabled}" /D "{cuda_compat_enabled}" /D "{iter_dbg}" /I"{native_dir}" {includes} '
|
|
250
248
|
|
|
251
249
|
if args.mode == "debug":
|
|
252
250
|
cpp_flags += "/Zi /Od /D WP_ENABLE_DEBUG=1"
|
|
@@ -275,10 +273,10 @@ def build_dll_for_arch(args, dll_path, cpp_paths, cu_path, libs, arch, mode=None
|
|
|
275
273
|
cu_out = cu_path + ".o"
|
|
276
274
|
|
|
277
275
|
if mode == "debug":
|
|
278
|
-
cuda_cmd = f'"{cuda_home}/bin/nvcc" --compiler-options=/MT,/Zi,/Od -g -G -O0 -DNDEBUG -D_ITERATOR_DEBUG_LEVEL=0 -I"{native_dir}" -
|
|
276
|
+
cuda_cmd = f'"{cuda_home}/bin/nvcc" --compiler-options=/MT,/Zi,/Od -g -G -O0 -DNDEBUG -D_ITERATOR_DEBUG_LEVEL=0 -I"{native_dir}" -line-info {" ".join(nvcc_opts)} -DWP_ENABLE_CUDA=1 -D{cutlass_enabled} {cutlass_includes} -o "{cu_out}" -c "{cu_path}"'
|
|
279
277
|
|
|
280
278
|
elif mode == "release":
|
|
281
|
-
cuda_cmd = f'"{cuda_home}/bin/nvcc" -O3 {" ".join(nvcc_opts)} -I"{native_dir}" -
|
|
279
|
+
cuda_cmd = f'"{cuda_home}/bin/nvcc" -O3 {" ".join(nvcc_opts)} -I"{native_dir}" -DNDEBUG -DWP_ENABLE_CUDA=1 -D{cutlass_enabled} {cutlass_includes} -o "{cu_out}" -c "{cu_path}"'
|
|
282
280
|
|
|
283
281
|
with ScopedTimer("build_cuda", active=args.verbose):
|
|
284
282
|
run_cmd(cuda_cmd)
|
warp/builtins.py
CHANGED
|
@@ -1533,7 +1533,7 @@ add_builtin(
|
|
|
1533
1533
|
|
|
1534
1534
|
def spatial_vector_value_func(arg_types: Mapping[str, type], arg_values: Mapping[str, Any]):
|
|
1535
1535
|
if arg_types is None:
|
|
1536
|
-
return
|
|
1536
|
+
return vector(length=6, dtype=Float)
|
|
1537
1537
|
|
|
1538
1538
|
dtype = arg_values.get("dtype", None)
|
|
1539
1539
|
|
|
@@ -3639,6 +3639,30 @@ add_builtin(
|
|
|
3639
3639
|
)
|
|
3640
3640
|
|
|
3641
3641
|
|
|
3642
|
+
def vector_assign_value_func(arg_types: Mapping[str, type], arg_values: Mapping[str, Any]):
|
|
3643
|
+
vec_type = arg_types["a"]
|
|
3644
|
+
return vec_type
|
|
3645
|
+
|
|
3646
|
+
|
|
3647
|
+
# implements vector[index] = value
|
|
3648
|
+
add_builtin(
|
|
3649
|
+
"assign",
|
|
3650
|
+
input_types={"a": vector(length=Any, dtype=Scalar), "i": int, "value": Scalar},
|
|
3651
|
+
value_func=vector_assign_value_func,
|
|
3652
|
+
hidden=True,
|
|
3653
|
+
group="Utility",
|
|
3654
|
+
)
|
|
3655
|
+
|
|
3656
|
+
# implements quaternion[index] = value
|
|
3657
|
+
add_builtin(
|
|
3658
|
+
"assign",
|
|
3659
|
+
input_types={"a": quaternion(dtype=Scalar), "i": int, "value": Scalar},
|
|
3660
|
+
value_func=vector_assign_value_func,
|
|
3661
|
+
hidden=True,
|
|
3662
|
+
group="Utility",
|
|
3663
|
+
)
|
|
3664
|
+
|
|
3665
|
+
|
|
3642
3666
|
def matrix_index_row_value_func(arg_types: Mapping[str, type], arg_values: Mapping[str, Any]):
|
|
3643
3667
|
mat_type = arg_types["a"]
|
|
3644
3668
|
row_type = mat_type._wp_row_type_
|
|
@@ -3646,7 +3670,7 @@ def matrix_index_row_value_func(arg_types: Mapping[str, type], arg_values: Mappi
|
|
|
3646
3670
|
return Reference(row_type)
|
|
3647
3671
|
|
|
3648
3672
|
|
|
3649
|
-
# implements matrix[i] = row
|
|
3673
|
+
# implements &matrix[i] = row
|
|
3650
3674
|
add_builtin(
|
|
3651
3675
|
"index",
|
|
3652
3676
|
input_types={"a": matrix(shape=(Any, Any), dtype=Scalar), "i": int},
|
|
@@ -3664,7 +3688,7 @@ def matrix_index_value_func(arg_types: Mapping[str, type], arg_values: Mapping[s
|
|
|
3664
3688
|
return Reference(value_type)
|
|
3665
3689
|
|
|
3666
3690
|
|
|
3667
|
-
# implements matrix[i,j] = scalar
|
|
3691
|
+
# implements &matrix[i,j] = scalar
|
|
3668
3692
|
add_builtin(
|
|
3669
3693
|
"index",
|
|
3670
3694
|
input_types={"a": matrix(shape=(Any, Any), dtype=Scalar), "i": int, "j": int},
|
|
@@ -3674,6 +3698,41 @@ add_builtin(
|
|
|
3674
3698
|
skip_replay=True,
|
|
3675
3699
|
)
|
|
3676
3700
|
|
|
3701
|
+
|
|
3702
|
+
def matrix_assign_value_func(arg_types: Mapping[str, type], arg_values: Mapping[str, Any]):
|
|
3703
|
+
mat_type = arg_types["a"]
|
|
3704
|
+
return mat_type
|
|
3705
|
+
|
|
3706
|
+
|
|
3707
|
+
def matrix_vector_sametype(arg_types: Mapping[str, Any]):
|
|
3708
|
+
mat_size = arg_types["a"]._shape_[0]
|
|
3709
|
+
vec_size = arg_types["value"]._length_
|
|
3710
|
+
mat_type = arg_types["a"]._type_
|
|
3711
|
+
vec_type = arg_types["value"]._type_
|
|
3712
|
+
return mat_size == vec_size and mat_type == vec_type
|
|
3713
|
+
|
|
3714
|
+
|
|
3715
|
+
# implements matrix[i,j] = scalar
|
|
3716
|
+
add_builtin(
|
|
3717
|
+
"assign",
|
|
3718
|
+
input_types={"a": matrix(shape=(Any, Any), dtype=Scalar), "i": int, "j": int, "value": Scalar},
|
|
3719
|
+
value_func=matrix_assign_value_func,
|
|
3720
|
+
hidden=True,
|
|
3721
|
+
group="Utility",
|
|
3722
|
+
)
|
|
3723
|
+
|
|
3724
|
+
|
|
3725
|
+
# implements matrix[i] = vector
|
|
3726
|
+
add_builtin(
|
|
3727
|
+
"assign",
|
|
3728
|
+
input_types={"a": matrix(shape=(Any, Any), dtype=Scalar), "i": int, "value": vector(length=Any, dtype=Scalar)},
|
|
3729
|
+
constraint=matrix_vector_sametype,
|
|
3730
|
+
value_func=matrix_assign_value_func,
|
|
3731
|
+
hidden=True,
|
|
3732
|
+
group="Utility",
|
|
3733
|
+
)
|
|
3734
|
+
|
|
3735
|
+
|
|
3677
3736
|
for t in scalar_types + vector_types + (bool,):
|
|
3678
3737
|
if "vec" in t.__name__ or "mat" in t.__name__:
|
|
3679
3738
|
continue
|
|
@@ -4107,6 +4166,14 @@ add_builtin(
|
|
|
4107
4166
|
doc="Modulo operation using truncated division.",
|
|
4108
4167
|
group="Operators",
|
|
4109
4168
|
)
|
|
4169
|
+
add_builtin(
|
|
4170
|
+
"mod",
|
|
4171
|
+
input_types={"a": vector(length=Any, dtype=Scalar), "b": vector(length=Any, dtype=Scalar)},
|
|
4172
|
+
constraint=sametypes,
|
|
4173
|
+
value_func=sametypes_create_value_func(Scalar),
|
|
4174
|
+
doc="Modulo operation using truncated division.",
|
|
4175
|
+
group="Operators",
|
|
4176
|
+
)
|
|
4110
4177
|
|
|
4111
4178
|
add_builtin(
|
|
4112
4179
|
"div",
|
|
@@ -4218,3 +4285,36 @@ for t in int_types:
|
|
|
4218
4285
|
|
|
4219
4286
|
|
|
4220
4287
|
add_builtin("unot", input_types={"a": array(dtype=Any)}, value_type=builtins.bool, doc="", group="Operators")
|
|
4288
|
+
|
|
4289
|
+
# ---------------------------------
|
|
4290
|
+
# Code Generation
|
|
4291
|
+
|
|
4292
|
+
add_builtin(
|
|
4293
|
+
"static",
|
|
4294
|
+
input_types={"expr": Any},
|
|
4295
|
+
value_type=Any,
|
|
4296
|
+
doc="""Evaluates a static Python expression and replaces it with its result.
|
|
4297
|
+
|
|
4298
|
+
See the `codegen.html#static-expressions <section on code generation>`_ for more details.
|
|
4299
|
+
|
|
4300
|
+
Note:
|
|
4301
|
+
The inner expression must only reference variables that are available from the current scope where the Warp kernel or function containing the expression is defined,
|
|
4302
|
+
which includes constant variables and variables captured in the current closure in which the function or kernel is implemented.
|
|
4303
|
+
The return type of the expression must be either a Warp function, a string, or a type that is supported inside Warp kernels and functions
|
|
4304
|
+
(excluding Warp arrays since they cannot be created in a Warp kernel at the moment).""",
|
|
4305
|
+
group="Code Generation",
|
|
4306
|
+
)
|
|
4307
|
+
|
|
4308
|
+
|
|
4309
|
+
def static(expr):
|
|
4310
|
+
"""
|
|
4311
|
+
Evaluates a static expression and replaces the expression with its result.
|
|
4312
|
+
|
|
4313
|
+
Args:
|
|
4314
|
+
expr: A Python expression to evaluate. Must return a non-null value which must be either a Warp function, a string, or a type that is supported inside Warp kernels and functions (excluding Warp arrays since they cannot be created in a Warp kernel at the moment).
|
|
4315
|
+
|
|
4316
|
+
Note:
|
|
4317
|
+
The inner expression must only reference variables that are available from the current scope where the Warp kernel or function containing the expression is defined,
|
|
4318
|
+
which includes constant variables and variables captured in the current closure in which the function or kernel is implemented.
|
|
4319
|
+
"""
|
|
4320
|
+
return expr
|