Intel® Embree Ray Tracing Kernels
Discussion forum on the open source ray tracing kernels for fast photo-realistic rendering on Intel® CPU(s)

Determine value of "__mask" - ISPC

lalith-mcw
Novice
474 Views

Are there provisions to update the '__mask' value by the user, how does the program counter capable enough to update the mask value at an instance

 

How to determine the value of "__mask" at an instance during execution, since the same is used for N Packets of Rays to validate further

0 Kudos
1 Reply
patrick521
Beginner
353 Views

@lalith-mcwAARP wrote:

Are there provisions to update the '__mask' value by the user, how does the program counter capable enough to update the mask value at an instance

 

How to determine the value of "__mask" at an instance during execution, since the same is used for N Packets of Rays to validate further


Hello, @lalith-mcw 

 

The __mask in ISPC (Intel SPMD Program Compiler) is a built-in variable that represents the execution mask of the program, indicating which program instances (lanes) are currently active. It’s automatically managed by the ISPC compiler and runtime, and it’s used internally to control the flow of SPMD (Single Program, Multiple Data) execution.

Updating the __mask value directly is not typically done by the user, as it’s managed by the compiler to reflect the active lanes during program execution. The program counter is not directly responsible for updating the __mask; instead, it’s the control flow constructs in the ISPC program (like if statements or loops) that can cause the __mask to change as different lanes diverge and converge in their execution paths.

To determine the value of __mask at an instance during execution, you would need to use ISPC’s built-in functions that interact with the execution mask. For example, you can use programCount to get the number of active program instances or programIndex to get the index of the current instance. However, these functions are typically used for debugging or specialized control flow scenarios.

If you need to validate N packets of rays, you would usually rely on the ISPC’s data parallelism constructs to process the rays in parallel, and the __mask would be implicitly handling the active lanes without direct user intervention.

 

I hope my suggestion is helpful for you.

 

Best Regard,
patrick521

AARP

0 Kudos
Reply