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

Global vars in modules without functions may be incorrectly processed #68

Open
iliya-diyachkov opened this issue Nov 9, 2021 · 0 comments

Comments

@iliya-diyachkov
Copy link
Contributor

We introduced empty kernel test_atomic_fn() in capability-integers.ll to force processing of global variables and passing the test since modules without functions are not processed properly (see #66 ). Probably we need to add a fake function automatically for each module without functions.

Another test without functions is transcoding/global-constant-expression.ll. By the way if I add empty function to it, its compilation fails with "Assertion `!hasDefs || resType || I.getOpcode() == TargetOpcode::G_GLOBAL_VALUE' failed" in SPIRVInstructionSelector.cpp:282. Actually the opcode is G_PTR_ADD which we get after IRTranslator:

  %10:_(p1) = G_PTR_ADD %8:_, %11:anyid(s32)
  %12:_(p1) = COPY %8:_(p1)
  %14:_(p1) = G_GLOBAL_VALUE @k_var
  %22:anyid(s32) = G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.spv.const.composite), %4:anyid(s8), %4:anyid(s8)
  %23:type(s32) = OpTypeArray %16:type(s32), %18:id(s32)
  %6:anyid(s32) = ASSIGN_TYPE %22:anyid(s32), %23:type(s32)
  G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.spv.init.global), %8:_(p1), %6:anyid(s32)
  %15:anyid(s32) = G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.spv.const.composite), %10:_(p1), %12:_(p1)
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

No branches or pull requests

1 participant