Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better C++ compatibility and fixes to conditional branch/switch handling #10

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

mtehver
Copy link

@mtehver mtehver commented Apr 18, 2022

No description provided.

state->function_stack_cfg[state->function_stack_current] = id;

// Make sure we do not overwrite parent block id if we encounter an explicit label after a jump
if (state->function_stack_cfg[state->function_stack_current] != id) {
Copy link
Contributor

Choose a reason for hiding this comment

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

do we ever take this branch (except maybe for the entry point)? Couldn't we always handle the update of function_stack_cfg_parent, function_stack_cfg here instead of handling it in every jump instruction?

Copy link
Author

Choose a reason for hiding this comment

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

Indeed, it seems this can be done. When you debug current code you will see that branch target 'source locations' are not actual OpLabel instructions. This is due to the setup phase (spvm_setup_OpLabel) that moves source_location of its result record into the next instruction.

After changing the corresponding line in spvm_setup_OpLabel

state->results[id].source_location = state->code_current;

to

state->results[id].source_location = state->code_current - 2;

the code in actual branch instructions can be removed.

Should I update the PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

The PR is valuable and LGTM as it is, no need to change it right away. IMO doing the processing in OpLabel (and changing source_location as you proposed) would simplify the code though as it removes duplication but we can also do this later on if you prefer. Thanks for looking into it!

Copy link
Author

Choose a reason for hiding this comment

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

Thanks. I already pushed this change, it really keeps the code cleaner.

…ranch instructions becomes much simpler this way.
…of the input). Implemented OpCompositeInsert (Khronos compiler generates this is 'size optimization' mode). Also perform full 64-bit copy in OpCompositeConstruct, instead of 32-bit copy.
@mtehver
Copy link
Author

mtehver commented Apr 21, 2022

I added couple of additional fixes to my branch and implementation for OpCompositeInsert instruction

@nyorain
Copy link
Contributor

nyorain commented Sep 17, 2022

@dfranx any chance of merging this? Fixes a major bug with OpPhi

…nstruct, GLSL450_SmoothStep. Implemented unordered floating point comparison operators.
@chances
Copy link

chances commented Jun 29, 2023

@dfranx And chance we can get some traction on this?

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.

3 participants