Skip to content

Fix #5116 - Skip the sematics checks of compiler-generated functions and template instances in dcompute#5131

Open
gulugulubing wants to merge 2 commits into
ldc-developers:masterfrom
gulugulubing:issue5116
Open

Fix #5116 - Skip the sematics checks of compiler-generated functions and template instances in dcompute#5131
gulugulubing wants to merge 2 commits into
ldc-developers:masterfrom
gulugulubing:issue5116

Conversation

@gulugulubing
Copy link
Copy Markdown
Contributor

It is related to #5116 and #5100.

Shared!(float[N]) tile; is actually a struct with static array, DMD's semantic analysis automatically generates support functions for such structs, and those functions drag in template instantiations from non-@compute modules, which triggers both the error message and the crash of compiler.

Comment thread gen/semantic-dcompute.cpp

// Skip compiler-generated struct support functions (e.g. __xopEquals,
// __xopCmp, postblit, destructor). Their bodies may reference non-@compute
// templates (such as __equals for static array comparison) that are outside
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

__equals is a template which is specifically allowed, any non-template code it generates will still cause problems though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Are you suggesting that __equals (and its generated code, like isEqual) should be included in isNonComputeCallExpVaild similar to dcReflect, rather than using the module-based check in visit(TemplateInstance *)?

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.

2 participants