Page MenuHomePhabricator

[AMDGPU][OpenMP] Fix clang driver crash when provided -c

Authored by pdhaliwal on May 5 2021, 5:29 AM.



The offload action is used in four different ways as explained
in Driver.cpp:4495. When -c is present, the final phase will be
assemble (linker when -c is not present). However, this phase
is skipped according to D96769 for amdgcn. So, offload action
arrives into following situation,

compile (device) ---> offload ---> offload

without -c the chain looks like,
compile (device) ---> offload ---> linker (device)

				---> offload

The former situation creates an unhandled case which causes
problem. The solution presented in this patch delays the D96769
logic until job creation time. This keeps the offload action
in the 1 of the 4 specified situations.

Diff Detail

Event Timeline

pdhaliwal created this revision.May 5 2021, 5:29 AM
pdhaliwal requested review of this revision.May 5 2021, 5:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 5 2021, 5:29 AM

@jdoerfert This drops the logic for save-temps that I remember being contentious.

Doing a no-op backend pass instead of skipping over it is probably more robust.


I wonder if this would be clearer as if (isa<>() || isa<>()) followed by a ternary to pick the second argument to BuildJobs. Overall I think I prefer the separate calls, as currently written.

Cool, this makes sense :)

JonChesterfield accepted this revision.May 5 2021, 7:01 AM
This revision is now accepted and ready to land.May 5 2021, 7:01 AM
This revision was automatically updated to reflect the committed changes.