Skip to content

Triangle Example#1

Open
isVoid wants to merge 26 commits intogmarkall:grm-numba-trianglefrom
isVoid:mike-numba-pyramid
Open

Triangle Example#1
isVoid wants to merge 26 commits intogmarkall:grm-numba-trianglefrom
isVoid:mike-numba-pyramid

Conversation

@isVoid
Copy link
Copy Markdown

@isVoid isVoid commented Jan 20, 2022

I moved all numba typing and lowerings to numba_support.py, in a hope they can be shared and improved when we implement other examples in the future.

@isVoid isVoid changed the title Triangle/Pyramid Example Triangle Example Jan 21, 2022
Comment on lines +461 to +471
OPTIX_RAY_FLAG_NONE = 0
# class OptixRayFlags(Enum):
# OPTIX_RAY_FLAG_NONE = 0
# OPTIX_RAY_FLAG_DISABLE_ANYHIT = 1 << 0
# OPTIX_RAY_FLAG_ENFORCE_ANYHIT = 1 << 1
# OPTIX_RAY_FLAG_TERMINATE_ON_FIRST_HIT = 1 << 2
# OPTIX_RAY_FLAG_DISABLE_CLOSESTHIT = 1 << 3,
# OPTIX_RAY_FLAG_CULL_BACK_FACING_TRIANGLES = 1 << 4
# OPTIX_RAY_FLAG_CULL_FRONT_FACING_TRIANGLES = 1 << 5
# OPTIX_RAY_FLAG_CULL_DISABLED_ANYHIT = 1 << 6
# OPTIX_RAY_FLAG_CULL_ENFORCED_ANYHIT = 1 << 7
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using enums inside kernel still needs to be worked on. BTW, there are duplicate "declaration" of this enum in both pybind and numba, I expect there might be many of these duplication down the road. Perhaps we can figure out which ones are only usable in kernel code and avoid double wrapping?

# Structures as declared in triangle.h


class ParamsStruct:
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Params, MissData belong to the user defined code space, ideally we should create some useful helper function that allows user to custom define their structure.

Comment on lines +628 to +629
def lower_miss_data_ctor(context, builder, sig, args):
# Anyway to err if this ctor is not called inside __miss__* program?
Copy link
Copy Markdown
Author

@isVoid isVoid Jan 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I learnt a little bit more that this cast in cpp (from SBTDataPointer to MissData) is possible because there is no RayGenData and HitGroupData. The base of MissData just so happens to be the base of SBTDataPointer.

So this function here is also only specific to the triangle example. Ideally we should have an SBTRecord type based on the layout defined in create_sbt and generates the proper record type based on user's request. (e.g. sbtrecord.get_miss_data() or sbtrecord.get_ray_gen_data() etc.)

gmarkall pushed a commit that referenced this pull request Mar 23, 2022
Add README and a couple of other small fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant