Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

slangpy

Package Overview
Dependencies
Maintainers
5
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slangpy - npm Package Compare versions

Comparing version
0.35.0
to
0.36.0
+2
-2
METADATA
Metadata-Version: 2.4
Name: slangpy
Version: 0.35.0
Version: 0.36.0
Summary: Easily call Slang functions and integrate with PyTorch auto diff directly from Python.

@@ -103,5 +103,5 @@ Author-email: Simon Kallweit <skallweit@nvidia.com>, Chris Cummings <chriscummings@nvidia.com>, Benedikt Bitterli <bbitterli@nvidia.com>, Sai Bangaru <sbangaru@nvidia.com>, Yong He <yhe@nvidia.com>

note = {https://github.com/shader-slang/slangpy},
version = {0.35.0},
version = {0.36.0},
year = 2025
}
```
+22
-22
slangpy/__init__.py,sha256=PsbtOD5NRRgDcN2C7SbPnePNpAzce326xQM9tZhBT9M,1948
slangpy/__init__.pyi,sha256=uitnhvr1sP-WmPkWxGCbQfZZhXPFNVqP2S1sHqIhJbE,193026
slangpy/libsgl.dylib,sha256=fe5P5-act_QWXSUr83y1b4TnSlIFkltDGx-j1r__L2g,8336896
slangpy/libslang-glsl-module.dylib,sha256=M-suEgdNUFMlBuSlG5-wUm1hsUcu0r85QcYAhYD2Vf8,1292880
slangpy/libslang-glslang.dylib,sha256=0941UZI3GrFNd-JilmnaEsMnglDmndBgvOZFkAnZ948,8033520
slangpy/libslang-rhi.a,sha256=FG1-ksx-jWgFvpR3ScrEU4wBU-d_el91yfocrLG8PT0,74108576
slangpy/libslang-rt.dylib,sha256=C7DXKhnoycvr4OiHKSSfWXgqtML4mnyg50Lm_gsZQaQ,249968
slangpy/libslang.dylib,sha256=3wuOwjodITu-7CPh7XtRX5S7q7PIcm1hGgz8HBO3d8Q,19373712
slangpy/slangpy_ext.cpython-310-darwin.so,sha256=ghED3AR43maqxD68k0YbXI5-OwCGUL1CAvx0emmB6ZI,6630720
slangpy/__init__.pyi,sha256=wOVzPzLrRGvVqsKXC-cUwQrtiilqDKDi2e9E571fI8c,193464
slangpy/libsgl.dylib,sha256=-Z9L-Y5u6Jv28MUOr4xFXWX3wymr8sgqlP48yMcYGyk,8341040
slangpy/libslang-glsl-module.dylib,sha256=KSxBBR3H5kiWnP50MI6EZ05TZaoj9b0nBoqAmBMuP00,1441488
slangpy/libslang-glslang.dylib,sha256=F61SQsPfGAb5OIueoJ2_pPOJcymx3LCe2vmK5ftKLEo,8052992
slangpy/libslang-rhi.a,sha256=kB_6AhuTh8c9mqv7UXSOZeXy6VT_-G51nSJR0jwUrBA,74109752
slangpy/libslang-rt.dylib,sha256=km9PjcYyiRtcNd5zhzjb4zDqH0YdEK6DfxeO6HIzPrY,249968
slangpy/libslang.dylib,sha256=Kj2L8D3laBvLjTOs9x-u1qP1WKAQgeft5UTFOdnio0I,19841296
slangpy/slangpy_ext.cpython-310-darwin.so,sha256=avdfPOP6_cy7V2rxd0YQqPKr2fw9g88efHYGRVXkGVU,6653680
slangpy/benchmarks/conftest.py,sha256=rAYyblUkfrklcEe_TbJ0UuSAzQ8b0pmAbrWG2_s1nrg,438

@@ -35,3 +35,3 @@ slangpy/benchmarks/test_benchmark_interop.py,sha256=7xkivr7F1sD7_VRUVivVy125whirpZkbuttauURqgDw,15467

slangpy/core/calldata.py,sha256=oVK6IexBHGWsp7Qffx1wS75QymE8V57HCRCKC-bmxUM,21458
slangpy/core/callsignature.py,sha256=_ljcrJe1Z8E6ckaWaUaDkWuauP3ZGzBl3EEMlGPT6XU,26970
slangpy/core/callsignature.py,sha256=Tjwg-gZ64zHAKOEordoNwvOjEP12zFcM3155gGJvmLo,27449
slangpy/core/dispatchdata.py,sha256=S176OEjLyzVovpkomRllpxVproTy4KttSRnU38ie5Z0,10955

@@ -43,3 +43,3 @@ slangpy/core/enums.py,sha256=lLLVsfRqLWNMDOE7eaxOyy6t6KNzbXjv2JsvmepltU0,211

slangpy/core/logging.py,sha256=LW5fu_5neXYMwnsF8dYXalmQGZJl6j3xWTfKgJ_xZ0k,8688
slangpy/core/module.py,sha256=4q9evVKFmNpB81mEUiiyOoV8rGLrJkId1tGQd6K4LXc,8215
slangpy/core/module.py,sha256=Uv4GIVICaDqAg59hChMCuGwtn38Uu_Ofi4gPtPMAqFY,8223
slangpy/core/native.py,sha256=SpEiYl6WrtB8c1n7CBUVcdsAmnmqpN37DS3JbtPMEqU,151

@@ -107,6 +107,6 @@ slangpy/core/packedarg.py,sha256=8yD7ZHZ3I7J2LHGVKdMDpBL7UK-11XrJ5bU6UCsScYY,2060

slangpy/include/slang-rhi-config.h,sha256=Em9yoqMRi3H21r1rWhJgTwSbWUk88IEQzrQ-ot2Ppf0,403
slangpy/include/slang-rhi.h,sha256=kPzOt57oLMdvZKACo64CoU2jZBjQQzLoQhKzOWlcr-Y,106342
slangpy/include/slang-rhi.h,sha256=TXBUwV3UTT0W0gFJnQZpG23GveyIBTpjGziHsxVCVlM,106409
slangpy/include/slang-user-config.h,sha256=-DTfKSDXKnCWR_NU6n96RYbQyYmM5ms2IFQH8UWNn7Y,151
slangpy/include/slang.h,sha256=sQbZxKt6WhP8F8wvU8EnyMzltucfmIWgQ_7tdZnhRvM,179036
slangpy/include/sgl/sgl.h,sha256=XEOQ9UxGba9xzNvoyrUDI7QNRAmxa5SOJUF8sWUWtKM,610
slangpy/include/sgl/sgl.h,sha256=V9JQ90C9puL6aGY0vUpHAD7U9Cv7wKaAXpVL1mQ2Ofs,610
slangpy/include/sgl/sgl_pch.h,sha256=SD1ALBpwwkcMlCnU_V8nHdSvS6-NZIXZOv5Rd6_r5z8,131

@@ -160,3 +160,3 @@ slangpy/include/sgl/app/app.h,sha256=tyvkNXNrsvsYWL98uSxVKcYesdiJ2ZRqdwJpfw9dbwA,2809

slangpy/include/sgl/device/formats.h,sha256=H6PfPqJ8lvel6C5hO0P5sgInQn_wtac-9BP4IHZXGvU,16872
slangpy/include/sgl/device/fwd.h,sha256=ydubyH9rNvO5YMTD-8TGQFI8WXFRPJhQZuKgh6eqBuA,2451
slangpy/include/sgl/device/fwd.h,sha256=TQ_IN_GJrCa9zyOr-5Yo2Ws6eGmXzxZjCDlJd70ubmg,2468
slangpy/include/sgl/device/helpers.h,sha256=ZcfJHIebzX2WYgpYodYG9FRCV0EMCzt65QmD2NVz7XA,2015

@@ -173,3 +173,3 @@ slangpy/include/sgl/device/hot_reload.h,sha256=WbvnDarrppcxjTPvyIun4yGz6c5o3lc8SIWZgcbiQxE,2509

slangpy/include/sgl/device/raytracing.h,sha256=GoorG0eP74PnJs42KN_0l0yPyq30rC17LwTnO9Bo3uc,10328
slangpy/include/sgl/device/reflection.h,sha256=XaSGEaqN6EYFdEAAl9iYkXAKPHPgFCb2LfhvrFkyET8,45810
slangpy/include/sgl/device/reflection.h,sha256=Tw51sL9nucX28bv-H2iJJJik-YnwMM12KYv-LSmLfaM,46464
slangpy/include/sgl/device/resource.h,sha256=XpiYTL4bPV9cfIwWiFh0shoIiDtB12LYMQlV9va9JA0,22866

@@ -188,3 +188,3 @@ slangpy/include/sgl/device/sampler.h,sha256=Cq2je6bWn2G0Zv1RCm5c3BmWyqrV9NutxExaOfgNbxE,1697

slangpy/include/sgl/math/matrix.h,sha256=ipSvS3MPZqHHKbahaG4OSowi4WxUeU2WqV45sDCQQQo,143
slangpy/include/sgl/math/matrix_math.h,sha256=jazXRhe9NoPrwrXQnYG_t8yFmGvYlMrRsNt28CUE7EQ,24382
slangpy/include/sgl/math/matrix_math.h,sha256=DlyBn7JYpTZAFrqP1YEHSoVKXbj-a9W-pJUAPbvQ0_M,26328
slangpy/include/sgl/math/matrix_types.h,sha256=n-Yg6I3EmZIsWoKxM6xLFW9i0Kgv4axTDdy7tO5NlSI,5645

@@ -216,3 +216,3 @@ slangpy/include/sgl/math/quaternion.h,sha256=SjZfbLOa0GI7eGIyyi0exmcyNIG6L9T1J3A92nYLCek,151

slangpy/math/__init__.py,sha256=iasSej-enqU0bZTocJyJYiXTfADJ9sd89NwHtF1PDI0,58
slangpy/math/__init__.pyi,sha256=Qp57jIhdbzO3YpMu6wyo1CfVDi8HJRdu8xJL1Ysx7Xs,113931
slangpy/math/__init__.pyi,sha256=4mNBCKJH4LKeF5Tzs8fOtBwLUdloAJJpIJtb5znbATM,114755
slangpy/platform/__init__.py,sha256=iasSej-enqU0bZTocJyJYiXTfADJ9sd89NwHtF1PDI0,58

@@ -288,3 +288,3 @@ slangpy/platform/__init__.pyi,sha256=Xew0oHwYHVdPnScU_wCGmf1dVnfjPhXDfdlzycqjL9U,2599

slangpy/tests/device/test_print_module2.slang,sha256=3Tk0MEt1usLKlpjyyRaQwpP7KGA2vMJ_N_HaLoVjeLg,221
slangpy/tests/device/test_reflection.py,sha256=2NHTtvjIWDoPQUKN96SCmnk2to8SoLj6DPbof-b225s,40068
slangpy/tests/device/test_reflection.py,sha256=XI8p9B8qWKBkYet7_ZFmLZd6v1X3VeVwdSt2oWf20sM,41166
slangpy/tests/device/test_shader.py,sha256=j5eRKQFaA1HDpnqN_3b_QLAmWrZkEkfcZZBp5qUCS1I,4583

@@ -399,6 +399,6 @@ slangpy/tests/device/test_shader_compile_error.slang,sha256=C-IscJwV1aj47SFEjffYJXoyFgZ6dTTQU_bSG3HCx88,64

slangpy/ui/__init__.pyi,sha256=6oKnW1qupqQCPSe82znQzssxR5mw6zAuM4mGr3CaSvQ,30512
slangpy-0.35.0.dist-info/licenses/LICENSE,sha256=tzjZi3clQUtTTBGaxmEmh2uMvUCqiuSCENsZBxS4FnA,1490
slangpy-0.35.0.dist-info/METADATA,sha256=Ue9H520aYJVwxkzlynefSeDPFT0wbm1O4nvFtvwhM94,4323
slangpy-0.35.0.dist-info/WHEEL,sha256=QbwVjH-TlueSdsOKSic424jsJD30r52gknYt4wXVwF0,109
slangpy-0.35.0.dist-info/top_level.txt,sha256=Wo7_Eny8d-MI3ZHT-XHGGMEKKIK38FlAmUCz8AffxA0,8
slangpy-0.35.0.dist-info/RECORD,,
slangpy-0.36.0.dist-info/licenses/LICENSE,sha256=tzjZi3clQUtTTBGaxmEmh2uMvUCqiuSCENsZBxS4FnA,1490
slangpy-0.36.0.dist-info/METADATA,sha256=TYMWbyG0UV4xhFYK1CUPa4IO8a59S8vnzHtV1UWTDvg,4323
slangpy-0.36.0.dist-info/WHEEL,sha256=QbwVjH-TlueSdsOKSic424jsJD30r52gknYt4wXVwF0,109
slangpy-0.36.0.dist-info/top_level.txt,sha256=Wo7_Eny8d-MI3ZHT-XHGGMEKKIK38FlAmUCz8AffxA0,8
slangpy-0.36.0.dist-info/RECORD,,

@@ -372,2 +372,11 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

def is_slangpy_vector(type: Any) -> bool:
return (
hasattr(type, "element_type")
and hasattr(type, "shape")
and len(type.shape) == 1
and type.shape[0] <= 4
)
def generate_constants(build_info: "FunctionBuildInfo", cg: CodeGen):

@@ -382,2 +391,7 @@ if build_info.constants is not None:

cg.constants.append_statement(f"export static const {type(v).__name__} {k} = {v}")
elif is_slangpy_vector(v):
# Cheeky logic to take, eg, {0,0,0} -> float3(0,0,0)
tn = type(v).__name__
txt = f"{tn}({str(v)[1:-1]})"
cg.constants.append_statement(f"export static const {tn} {k} = {txt}")
else:

@@ -384,0 +398,0 @@ raise KernelGenException(

@@ -90,3 +90,3 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

options: dict[str, Any] = {},
link: list[Union["Module", SlangModule]] = [],
link: Sequence[Union["Module", SlangModule]] = [],
):

@@ -104,3 +104,3 @@ """

options: dict[str, Any] = {},
link: list[Union["Module", SlangModule]] = [],
link: Sequence[Union["Module", SlangModule]] = [],
):

@@ -107,0 +107,0 @@ """

@@ -77,2 +77,3 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

class VariableLayoutReflection;
class Attribute;
class EntryPointLayout;

@@ -79,0 +80,0 @@ class EntryPointLayoutParameterList;

@@ -38,2 +38,3 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

SGL_API ref<const ProgramLayout> from_slang(ref<const Object> owner, slang::ProgramLayout* program_layout);
SGL_API ref<const Attribute> from_slang(ref<const Object> owner, slang::Attribute* attribute);

@@ -350,2 +351,21 @@ SGL_API void on_slang_wrapper_destroyed(void* slang_reflection);

class SGL_API Attribute : public BaseReflectionObjectImpl<slang::Attribute> {
public:
Attribute(ref<const Object> owner, slang::Attribute* target)
: BaseReflectionObjectImpl(std::move(owner), target)
{
}
std::string name() const { return slang_target()->getName(); }
uint32_t argument_count() const { return slang_target()->getArgumentCount(); }
ref<const TypeReflection> argument_type(uint32_t index) const
{
return detail::from_slang(m_owner, slang_target()->getArgumentType(index));
}
std::string to_string() const;
};
class SGL_API TypeReflection : public BaseReflectionObjectImpl<slang::TypeReflection> {

@@ -641,13 +661,13 @@ SGL_OBJECT(TypeReflection)

#if 0
unsigned int getUserAttributeCount() { return spReflectionType_GetUserAttributeCount((SlangReflectionType*)this); }
UserAttribute* getUserAttributeByIndex(unsigned int index)
uint32_t get_user_attribute_count() const { return slang_target()->getUserAttributeCount(); }
ref<const Attribute> get_user_attribute_by_index(uint32_t index) const
{
return (UserAttribute*)spReflectionType_GetUserAttribute((SlangReflectionType*)this, index);
return detail::from_slang(m_owner, slang_target()->getUserAttributeByIndex(index));
}
UserAttribute* findUserAttributeByName(char const* name)
ref<const Attribute> find_user_attribute_by_name(const char* name) const
{
return (UserAttribute*)spReflectionType_FindUserAttributeByName((SlangReflectionType*)this, name);
return detail::from_slang(m_owner, slang_target()->findUserAttributeByName(name));
}
#endif

@@ -1137,3 +1157,3 @@ std::string to_string() const override;

/// Get corresponding type layout from a given type.
ref<const TypeLayoutReflection> get_type_layout(const TypeReflection* type)
ref<const TypeLayoutReflection> get_type_layout(const TypeReflection* type) const
{

@@ -1140,0 +1160,0 @@ // TODO: Once device is available via session reference, pass metal layout rules for metal target

@@ -110,2 +110,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

/// Apply a 2D translation to a 3x3 matrix.
template<typename T>
matrix<T, 3, 3> translate_2d(const matrix<T, 3, 3>& m, const vector<T, 2>& v)
{
matrix<T, 3, 3> result(m);
result.set_col(2, m.get_col(0) * v.x + m.get_col(1) * v.y + m.get_col(2));
return result;
}
/// Apply a rotation around an axis to a 4x4 matrix.

@@ -144,2 +153,17 @@ template<typename T>

/// Apply a 2d rotation to a 3x3 matrix.
template<typename T>
matrix<T, 3, 3> rotate_2d(const matrix<T, 3, 3>& m, T angle)
{
T c = cos(angle);
T s = sin(angle);
matrix<T, 3, 3> result;
result.set_col(0, m.get_col(0) * c + m.get_col(1) * s);
result.set_col(1, m.get_col(0) * -s + m.get_col(1) * c);
result.set_col(2, m.get_col(2));
return result;
}
/// Apply a scale to a 4x4 matrix.

@@ -157,2 +181,13 @@ template<typename T>

/// Apply a scale to a 3x3 matrix.
template<typename T>
matrix<T, 3, 3> scale_2d(const matrix<T, 3, 3>& m, const vector<T, 2>& v)
{
matrix<T, 3, 3> result;
result.set_col(0, m.get_col(0) * v[0]);
result.set_col(1, m.get_col(1) * v[1]);
result.set_col(2, m.get_col(2));
return result;
}
/// Compute determinant of a 2x2 matrix.

@@ -541,5 +576,20 @@ template<typename T>

{
return translate(matrix<T, 4, 4>::identity(), v);
matrix<T, 4, 4> m = matrix<T, 4, 4>::identity();
m[0][3] = v.x;
m[1][3] = v.y;
m[2][3] = v.z;
return m;
}
/// Creates a translation matrix.
template<floating_point T>
[[nodiscard]] inline matrix<T, 3, 3> matrix_from_translation_2d(const vector<T, 2>& v)
{
matrix<T, 3, 3> m = matrix<T, 3, 3>::identity();
m[0][2] = v.x;
m[1][2] = v.y;
return m;
}
/// Creates a rotation matrix from an angle and an axis.

@@ -552,2 +602,16 @@ template<floating_point T>

/// Creates a 2D rotation matrix from an angle.
template<floating_point T>
[[nodiscard]] inline matrix<T, 3, 3> matrix_from_rotation_2d(T angle)
{
T c = cos(angle);
T s = sin(angle);
matrix<T, 3, 3> m = matrix<T, 3, 3>::identity();
m[0][0] = c;
m[0][1] = -s;
m[1][0] = s;
m[1][1] = c;
return m;
}
/// Creates a rotation matrix around the X-axis.

@@ -649,5 +713,19 @@ template<floating_point T>

{
return scale(matrix<T, 4, 4>::identity(), v);
matrix<T, 4, 4> m = matrix<T, 4, 4>::identity();
m[0][0] = v.x;
m[1][1] = v.y;
m[2][2] = v.z;
return m;
}
/// Creates a scaling matrix.
template<floating_point T>
[[nodiscard]] inline matrix<T, 3, 3> matrix_from_scaling_2d(const vector<T, 2>& v)
{
matrix<T, 3, 3> m = matrix<T, 3, 3>::identity();
m[0][0] = v.x;
m[1][1] = v.y;
return m;
}
/**

@@ -654,0 +732,0 @@ * Build a look-at matrix.

@@ -8,3 +8,3 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#define SGL_VERSION_MAJOR 0
#define SGL_VERSION_MINOR 35
#define SGL_VERSION_MINOR 36
#define SGL_VERSION_PATCH 0

@@ -11,0 +11,0 @@

@@ -1182,2 +1182,36 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

@pytest.mark.parametrize("device_type", helpers.DEFAULT_DEVICE_TYPES)
def test_attribute_reflection(test_id: str, device_type: spy.DeviceType):
device = helpers.get_device(type=device_type)
# Create a session, and within it a module.
session = create_session(device)
module = session.load_module_from_source(
module_name=f"module_from_source_{test_id}",
source="""
[__AttributeUsage(_AttributeTargets.Struct)]
struct FooAttribute
{
int val;
}
[Foo(42)]
extern struct MyStruct;
""",
)
my_struct = module.layout.find_type_by_name("MyStruct")
assert my_struct is not None
user_attr_count = my_struct.get_user_attribute_count()
assert user_attr_count == 1
user_attr = my_struct.get_user_attribute_by_index(0)
assert user_attr is not None
assert user_attr.name == "Foo"
argument_count = user_attr.argument_count
assert argument_count == 1
argument_type = user_attr.argument_type(0)
assert argument_type is not None
assert argument_type.name == "int"
# This test reproduces issues with reflection where 2 independently loaded

@@ -1184,0 +1218,0 @@ # modules can not resolve specialized versions of a generic function that

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display