-
Notifications
You must be signed in to change notification settings - Fork 58
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
Structured module items #63
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright 2016 Google Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// AUTOMATICALLY GENERATED from the SPIR-V JSON grammar: | ||
// external/spirv.core.grammar.json. | ||
// DO NOT MODIFY! | ||
|
||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct Extension { | ||
name: String, | ||
} | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct ExtInstImport { | ||
name: String, | ||
} | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct MemoryModel { | ||
addressing_model: spirv::AddressingModel, | ||
memory_model: spirv::MemoryModel, | ||
} | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct EntryPoint { | ||
execution_model: spirv::ExecutionModel, | ||
entry_point: spirv::Word, | ||
name: String, | ||
interface: Vec<spirv::Word>, | ||
} | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct ExecutionMode { | ||
entry_point: spirv::Word, | ||
mode: spirv::ExecutionMode, | ||
} | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct Capability { | ||
capability: spirv::Capability, | ||
} | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct Function { | ||
function_control: spirv::FunctionControl, | ||
function_type: spirv::Word, | ||
} | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct FunctionParameter {} | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct FunctionEnd {} | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct Label {} | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct ExecutionModeId { | ||
entry_point: spirv::Word, | ||
mode: spirv::ExecutionMode, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
use spirv; | ||
|
||
include!("autogen_instruction_enums.rs"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
use crate::{ | ||
mr::ModuleHeader, | ||
sr::{op, Token}, | ||
sr::instructions::{Instruction, Terminator}, | ||
sr::types::{Type}, | ||
}; | ||
use spirv; | ||
|
||
pub struct EntryPoint { | ||
pub execution_model: spirv::ExecutionModel, | ||
pub entry_point: Token<Function>, | ||
pub name: String, | ||
//pub interface: Vec<spirv::Word>, | ||
} | ||
|
||
pub struct BasicBlock { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is the Vector for instructions? |
||
pub terminator: Terminator, | ||
pub instructions: Vec<Instruction>, | ||
} | ||
|
||
pub struct Function { | ||
pub control: spirv::FunctionControl, | ||
/// Function result type. | ||
pub result: Token<Type>, | ||
/// Function parameters. | ||
pub parameters: Vec<Token<Type>>, | ||
/// Basic blocks in this function. | ||
pub basic_blocks: Vec<BasicBlock>, | ||
} | ||
|
||
pub struct Module { | ||
/// The module header. | ||
pub header: ModuleHeader, | ||
/// All OpCapability instructions. | ||
pub capabilities: Vec<op::Capability>, | ||
/// All OpExtension instructions. | ||
pub extensions: Vec<op::Extension>, | ||
/// All OpExtInstImport instructions. | ||
pub ext_inst_imports: Vec<op::ExtInstImport>, | ||
/// The OpMemoryModel instruction. | ||
/// | ||
/// Although it is required by the specification to appear exactly once | ||
/// per module, we keep it optional here to allow flexibility. | ||
pub memory_model: op::MemoryModel, | ||
/// All entry point declarations, using OpEntryPoint. | ||
pub entry_points: Vec<op::EntryPoint>, | ||
/// All execution mode declarations, using OpExecutionMode. | ||
pub execution_modes: Vec<op::ExecutionMode>, | ||
|
||
// some missing here... | ||
|
||
/// All functions. | ||
pub functions: Vec<Function>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
use spirv; | ||
|
||
include!("autogen_instruction_structs.rs"); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still want to have separate ops for these function components? I think they should be folded into the function SR itself. I mean,
FunctionEnd
is useful for marking the end of a function in SPIR-V binary, but not useful for SR. Similarly forLabel
, it should be implicit for BasicBlock SR. Letting each pass processing Function or BasicBlock to worry aboutFunctionEnd
andLabel
is not helpful.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, we'll need to set up a list of ops that don't need SR autogen generation, and which we are going to be converting to and from DR manually. We'll do it as a follow-up.