Skip to content

Fix for bad host code generation for CTarget and more cleanup

Nick Curtis requested to merge arghdos/loopy:c_execution into master

Sorry for the continued minor updates (hopefully this will be the last of them!)

This PR does two things:

  1. Only return a (non-DummyHost) CASTBuilder in the ExecutableCTarget -- this fixes host-code being generated for targets it has no business in doing so, e.g., for the OpenCLTarget
  2. Change get_function_definition in the CASTBuilder such that global temporaries are only included in the function definition for device code -- currently, it would place the same temporary in both host and device code leading to a compilation error -- to that end, I've included a test that checks for this.
  3. Some more minor cleanup (6c7648ab, 2bc2dc14, 70dc2d63)

AFAIK, # 2 only affects CTarget, ExecutableCTarget and the ISPCTarget, as all other targets define their own get_function_definition -- and all of these should only define global temporaries once (at the first device program)

I think this is a reasonable update, but I'm just starting to feel more confident in my understanding of host-code generation, so please point out any better ways to do this or other issues!

Nick

Edited by Nick Curtis

Merge request reports

Loading