summaryrefslogtreecommitdiffstats
path: root/.github/actions
diff options
context:
space:
mode:
authorkaizhangNV <149626564+kaizhangNV@users.noreply.github.com>2024-04-11 19:37:44 -0700
committerGitHub <noreply@github.com>2024-04-11 19:37:44 -0700
commit2a5d126c32d459c9ed6cec005b2a4351e18ed04b (patch)
tree1a49dfc43dffe9347559018ea75916b623091932 /.github/actions
parent5a9fcbd4d211947725d35a600a7fb01d445ad062 (diff)
WIP: Fix the variable scope issue (#3838) (#3892)
* Fix the variable scope issue (#3838) In the IR optimization pass, we turn all the loop to do-while loop form. But in the do-while loop form, the loop body block is dominating the blocks after the loop break block. This assumption is fine for SPIRV and IR code, however, it's incorrect for all the other language target (e.g. c/c++/cuda/glsl/hlsl) because the instructions defined in the loop body is invisible from outside of the loop. Therefore, when translating to other textual language, there could be issue for the variables scope. To fix this issue, we first detect the instructions that are defined inside the loop block, then check if these instructions are used after the break block. If so, we duplicate these instructions right before their users such that we can make those instructions available globally. * Update slang vcxproj file because of add new source files * Minor fix - Update the method to get the block of an instruction - Avoid query the hash-map twice by using "add" method directly. * Reduce complexity In searching loop region blocks, we don't actually need to traverse the instructions. Instead, we only have to check each block to see if it's in a loop region, and hash such block for later on processing. So we can remove one level of loop. In the second pass, we can use that hash to filter out the blocks that are not in the loop region, and only process the instructions inside the loop region. Add description for the new fix-up pass declared in slang-ir-variable-scope-correction.h. * Categorize the unstorable and storable instructs 1. When checking the loop regions, there could be multi-levels nested loops, so we should use a list to store the loopHeaders. 2. Categorize the instructs based on storable and non-storable, because we only have to duplicate the non-storable instructs. Note pointer type instruct is also belonged to non-storable class because we can not store a pointer in local variable. * Fix some test failure * Fix test failures * Recursively process the operands Besides process the out-of-scope instruction, we have to also process all the operands of this instructions. Therefore, we have to make the process logic recursive until all the involved instructions are accessible. * Change how to check storable type * Add target checking for CPP/CUDA In decide whether the type is storable, add target checking for CPP/CUDA as they can store any types. Cleanup the code to remove those debug log prints. * Addressing feedbacks Address some feedbacks. Change the depth-first traverse to breadth-first traverse when processing instruction and its operands. * Minor fix for the variable names
Diffstat (limited to '.github/actions')
0 files changed, 0 insertions, 0 deletions