-
Notifications
You must be signed in to change notification settings - Fork 245
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
Remove unneeded Storage Class attributes #568
Comments
I would be happy to work on this. I've found the type and have removed the specified variants. I'm curious how you would want to handle cases where the variants are used. In some cases where they are used for error handling, I think those checks can just be removed. But a case that isn't as clear is handling cases that are dependent on module version like this: /rustc_codegen_spriv/src/linker/entry_interface.rs // Base case: the global itself is an interface-relevant `OpVariable`.
let interface_relevant_var = inst.class.opcode == Op::Variable && {
if version > (1, 3) {
// SPIR-V >= v1.4 includes all OpVariables in the interface.
true
} else {
let storage_class = inst.operands[0].unwrap_storage_class();
// SPIR-V <= v1.3 only includes Input and Output in the interface.
storage_class == StorageClass::Input || storage_class == StorageClass::Output
}
}; Should the else case just return false? Or is there some other logic that should be added here? Another case is when a default is used like here: // If storage class was not inferred nor specified, compute the default (i.e. input/output)
let storage_class = inferred_storage_class_from_ty
.or(attr_storage_class)
.unwrap_or_else(|| match (is_ref, mutbl) {
(false, _) => StorageClass::Input,
(true, hir::Mutability::Mut) => StorageClass::Output,
(true, hir::Mutability::Not) => self.tcx.sess.span_fatal(
hir_param.ty_span,
&format!(
"invalid entry param type `{}` (expected `{}` or `&mut {1}`)",
layout.ty, value_ty
),
),
}); Should this just call the |
@andrewleverette I think this only refers to the rust-gpu/crates/rustc_codegen_spirv/src/symbols.rs Lines 138 to 165 in d789b58
|
Okay so sorry if this is a dumb question, but is this issue literally just removing those specified attributes from |
I think the linked pull request will resolve this issue. I'm still new to open source, so I'm definitely open to any feedback. |
With recent changes to how we specify the storage class of a variable, we've managed to eliminate the need for a few of the storage class attributes in cases where we can successfully infer all possible valid uses. Mainly the
input
,output
,private
,function
,generic
, anduniform_constant
attributes at the time of this writing are no longer needed and should be removed now that they can't be used for anything useful.The text was updated successfully, but these errors were encountered: