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

Ignoring construct field warnings on delegatory methods #4911

Merged

Conversation

venkataram-nv
Copy link
Collaborator

Fixes #4872

@venkataram-nv venkataram-nv self-assigned this Aug 23, 2024
@venkataram-nv venkataram-nv added the pr: non-breaking PRs without breaking changes label Aug 23, 2024
tests/diagnostics/uninitialized-fields.slang Outdated Show resolved Hide resolved
for (auto use = inst->firstUse; use; use = use->nextUse)
{
IRInst* user = use->getUser();
collectLoadStore(stores, loads, user, inst);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems very inefficient. All we care about here is whether there are any stores, we don't want to collect all load and stores just to do the check.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've reworked the collection system so that now there are methods to check the usage type of an instruction wrt an operand. With this we can skip the collection and do a pure check.

@venkataram-nv venkataram-nv force-pushed the softed-constructor-warnings branch from 25db183 to 1744146 Compare August 24, 2024 00:38
Load // Instruciton acts as a load from the source
};

static InstructionUsageType getCallUsageType(IRCall* call, IRInst* inst)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The logic inside this function for handling backward differentiate isn't correct. The inner function's type is usually not the same as the function type of the differentiated function. I suggest we don't check for any autodiff cases here and just assume that if we can't obtain the func type, then whenever a pointer typed argument is passed in a call, it is inout.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If you are not sure if certain logic is correct, make sure to call it out in the comment or the PR description so we don't get incorrect logic slipped through the review process.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The diagnostics currently ignore functions marked as differentiable, so this shouldn't be an issue:

// for example in checkUninitializedValues
if (isDifferentiableFunc(func))
            return;

The reason they are ignored is because at the moment it is not possible to distinguish functions marked as differentiable to be something that the user wrote or that slang synthesized automatically.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If Slang is synthesizing code that leads to warnings, we should fix those synthesis logic. Nevertheless, the logic here is incorrect and we should remove them and replace with an SLANG_UNEXPECTED failure.

@venkataram-nv venkataram-nv force-pushed the softed-constructor-warnings branch from cae410f to 985b64f Compare August 28, 2024 20:25
@venkataram-nv venkataram-nv force-pushed the softed-constructor-warnings branch from 985b64f to 01e8398 Compare August 28, 2024 20:42
@csyonghe csyonghe merged commit d3a5a47 into shader-slang:master Aug 28, 2024
12 checks passed
@venkataram-nv venkataram-nv deleted the softed-constructor-warnings branch August 28, 2024 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: non-breaking PRs without breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compilation Warnings Related to Uninitialized Struct Fields
2 participants