From 92d82b1191ff86208c077e40255d0ba947bb8db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Maseli?= Date: Mon, 27 May 2024 21:53:09 +0200 Subject: [PATCH 01/28] Split 'addInto' stats into graph and cycle detection counters (#683) --- .../alias/InclusionBasedPointerAnalysis.java | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/alias/InclusionBasedPointerAnalysis.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/alias/InclusionBasedPointerAnalysis.java index 98e06bc402..fb16f3e3b5 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/alias/InclusionBasedPointerAnalysis.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/alias/InclusionBasedPointerAnalysis.java @@ -107,10 +107,8 @@ private record IntPair(int x, int y) { private int totalVariables = 0; // Count variable substitutions. private int totalReplacements = 0; - // Count new edges already covered by existing ones. - private int failedAddInto = 0; // Count times a piece of new information was added to the graph. - private int succeededAddInto = 0; + private int addIntoGraphSucceesses, addIntoGraphFails, addIntoCyclesSuccesses, addIntoCyclesFails; // Count cycle checks, which can result in fast or slow rejects, or accepts. private int cyclesFastCulled; private int cyclesSlowCulled; @@ -127,9 +125,12 @@ public static InclusionBasedPointerAnalysis fromConfig(Program program, Context analysis.totalReplacements); logger.debug("alignment sizes: {}", analysis.totalAlignmentSizes); - logger.debug("addInto: {} successes vs {} fails", - analysis.succeededAddInto, - analysis.failedAddInto); + logger.debug("addInto graph: {} successes vs {} fails", + analysis.addIntoGraphSucceesses, + analysis.addIntoGraphFails); + logger.debug("addInto for cycle detection: {} successes vs {} fails", + analysis.addIntoCyclesSuccesses, + analysis.addIntoCyclesFails); logger.debug("cycles: {} detected vs {} fast-culled vs {} slow-culled", analysis.cyclesDetected, analysis.cyclesFastCulled, @@ -473,7 +474,7 @@ private Variable newVariable(String name) { // Inserts a single inclusion relationship into the graph. // Any cycle closed by this edge will eventually be detected and resolved. private void addInclude(Variable variable, IncludeEdge edge) { - if (!addInto(variable.includes, edge)) { + if (!addInto(variable.includes, edge, true)) { return; } edge.source.seeAlso.add(variable); @@ -568,7 +569,7 @@ private List getAllCyclicPaths(IncludeEdge edge, Set incl if (edge.source != i.source && includerSet.contains(i.source)) { final IncludeEdge joinedEdge = compose(i, current.modifier); if (set.add(joinedEdge) && - addInto(edges.computeIfAbsent(i.source, k -> new ArrayList<>()), joinedEdge)) { + addInto(edges.computeIfAbsent(i.source, k -> new ArrayList<>()), joinedEdge, false)) { next.add(joinedEdge); } } @@ -581,15 +582,23 @@ private List getAllCyclicPaths(IncludeEdge edge, Set incl return result; } - private boolean addInto(List list, IncludeEdge element) { + private boolean addInto(List list, IncludeEdge element, boolean isGraphModification) { //NOTE The Stream API is too costly here for (final IncludeEdge o : list) { if (element.source.equals(o.source) && includes(o.modifier, element.modifier)) { - failedAddInto++; + if(isGraphModification) { + addIntoGraphFails++; + } else { + addIntoCyclesFails++; + } return false; } } - succeededAddInto++; + if(isGraphModification) { + addIntoGraphSucceesses++; + } else { + addIntoCyclesSuccesses++; + } list.removeIf(o -> element.source.equals(o.source) && includes(element.modifier, o.modifier)); list.add(element); return true; From 016aaf418dff5b67447bb9805f74eee8995459fc Mon Sep 17 00:00:00 2001 From: Thomas Haas Date: Fri, 31 May 2024 11:22:18 +0200 Subject: [PATCH 02/28] UI update (#684) * Updated witness generation functions to return the generated File. * Improved UI: - can select property to check for (only one property at a time) - can generate and render the violation witness in the UI - UI can be scaled with 'ctrl' + '+/-' - Added simple zoom option to displayed witnesses * Added ability to pass configuration options via the UI. * UI programs now get a unified name. Fixed witness generation for programs without names or without file suffix. --- .../java/com/dat3m/dartagnan/Dartagnan.java | 58 +++-- .../graphviz/ExecutionGraphVisualizer.java | 8 +- .../dartagnan/witness/graphviz/Graphviz.java | 10 +- ui/src/main/java/com/dat3m/ui/Dat3M.java | 218 +++++++++++------- .../java/com/dat3m/ui/button/ClearButton.java | 17 +- .../java/com/dat3m/ui/button/TestButton.java | 17 +- .../main/java/com/dat3m/ui/editor/Editor.java | 93 ++++---- .../java/com/dat3m/ui/editor/EditorCode.java | 52 ++--- .../java/com/dat3m/ui/editor/EditorsPane.java | 20 +- .../com/dat3m/ui/editor/LineNumbersView.java | 82 ------- .../main/java/com/dat3m/ui/icon/IconCode.java | 29 +-- .../java/com/dat3m/ui/icon/IconHelper.java | 12 +- .../com/dat3m/ui/listener/BoundListener.java | 100 ++++---- .../com/dat3m/ui/listener/EditorListener.java | 39 ++-- .../dat3m/ui/listener/TimeoutListener.java | 100 ++++---- .../java/com/dat3m/ui/options/BoundField.java | 49 ++-- .../java/com/dat3m/ui/options/BoundPane.java | 12 +- .../com/dat3m/ui/options/OptionsPane.java | 106 +++++---- .../com/dat3m/ui/options/TimeoutField.java | 49 ++-- .../com/dat3m/ui/options/TimeoutPane.java | 12 +- .../dat3m/ui/options/utils/ControlCode.java | 66 ++---- .../com/dat3m/ui/options/utils/Helper.java | 16 +- .../dat3m/ui/result/ReachabilityResult.java | 135 ++++++----- .../java/com/dat3m/ui/utils/ImageLabel.java | 42 ++++ .../java/com/dat3m/ui/utils/UiOptions.java | 44 +--- .../main/java/com/dat3m/ui/utils/Utils.java | 29 ++- 26 files changed, 709 insertions(+), 706 deletions(-) delete mode 100644 ui/src/main/java/com/dat3m/ui/editor/LineNumbersView.java create mode 100644 ui/src/main/java/com/dat3m/ui/utils/ImageLabel.java diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/Dartagnan.java b/dartagnan/src/main/java/com/dat3m/dartagnan/Dartagnan.java index 1a066032b6..91cf646429 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/Dartagnan.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/Dartagnan.java @@ -20,11 +20,16 @@ import com.dat3m.dartagnan.verification.VerificationTask; import com.dat3m.dartagnan.verification.VerificationTask.VerificationTaskBuilder; import com.dat3m.dartagnan.verification.model.ExecutionModel; -import com.dat3m.dartagnan.verification.solving.*; +import com.dat3m.dartagnan.verification.solving.AssumeSolver; +import com.dat3m.dartagnan.verification.solving.DataRaceSolver; +import com.dat3m.dartagnan.verification.solving.ModelChecker; +import com.dat3m.dartagnan.verification.solving.RefinementSolver; +import com.dat3m.dartagnan.witness.WitnessType; import com.dat3m.dartagnan.witness.graphml.WitnessBuilder; import com.dat3m.dartagnan.witness.graphml.WitnessGraph; import com.dat3m.dartagnan.wmm.Wmm; import com.dat3m.dartagnan.wmm.axiom.Axiom; +import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableSet; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -40,8 +45,10 @@ import org.sosy_lab.java_smt.api.SolverContext; import org.sosy_lab.java_smt.api.SolverContext.ProverOptions; import org.sosy_lab.java_smt.api.SolverException; + import java.io.File; import java.io.FileReader; +import java.io.IOException; import java.math.BigInteger; import java.util.*; @@ -54,7 +61,7 @@ import static com.dat3m.dartagnan.program.analysis.SyntacticContextAnalysis.*; import static com.dat3m.dartagnan.utils.GitInfo.*; import static com.dat3m.dartagnan.utils.Result.*; -import static com.dat3m.dartagnan.witness.WitnessType.*; +import static com.dat3m.dartagnan.witness.WitnessType.GRAPHML; import static com.dat3m.dartagnan.witness.graphviz.ExecutionGraphVisualizer.generateGraphvizFile; import static java.lang.Boolean.FALSE; import static java.lang.Boolean.TRUE; @@ -165,33 +172,17 @@ public static void main(String[] args) throws Exception { modelChecker = DataRaceSolver.run(ctx, prover, task); } else { // Property is either PROGRAM_SPEC, LIVENESS, or CAT_SPEC - switch (o.getMethod()) { - case EAGER: - modelChecker = AssumeSolver.run(ctx, prover, task); - break; - case LAZY: - modelChecker = RefinementSolver.run(ctx, prover, task); - break; - default: - throw new InvalidConfigurationException("unsupported method " + o.getMethod()); - } + modelChecker = switch (o.getMethod()) { + case EAGER -> AssumeSolver.run(ctx, prover, task); + case LAZY -> RefinementSolver.run(ctx, prover, task); + }; } // Verification ended, we can interrupt the timeout Thread t.interrupt(); if (modelChecker.hasModel() && o.getWitnessType().generateGraphviz()) { - final ExecutionModel m = ExecutionModel.withContext(modelChecker.getEncodingContext()); - m.initialize(prover.getModel()); - final SyntacticContextAnalysis synContext = newInstance(task.getProgram()); - final String name = task.getProgram().getName().substring(0, task.getProgram().getName().lastIndexOf('.')); - // RF edges give both ordering and data flow information, thus even when the pair is in PO - // we get some data flow information by observing the edge - // FR edges only give ordering information which is known if the pair is also in PO - // CO edges only give ordering information which is known if the pair is also in PO - generateGraphvizFile(m, 1, (x, y) -> true, (x, y) -> !x.getThread().equals(y.getThread()), - (x, y) -> !x.getThread().equals(y.getThread()), getOrCreateOutputDirectory() + "/", name, - synContext, o.getWitnessType().convertToPng()); + generateExecutionGraphFile(task, prover, modelChecker, o.getWitnessType()); } long endTime = System.currentTimeMillis(); @@ -215,6 +206,27 @@ public static void main(String[] args) throws Exception { } } + public static File generateExecutionGraphFile(VerificationTask task, ProverEnvironment prover, ModelChecker modelChecker, + WitnessType witnessType) + throws InvalidConfigurationException, SolverException, IOException { + Preconditions.checkArgument(modelChecker.hasModel(), "No execution graph to generate."); + + final ExecutionModel m = ExecutionModel.withContext(modelChecker.getEncodingContext()); + m.initialize(prover.getModel()); + final SyntacticContextAnalysis synContext = newInstance(task.getProgram()); + final String progName = task.getProgram().getName(); + final int fileSuffixIndex = progName.lastIndexOf('.'); + final String name = progName.isEmpty() ? "unnamed_program" : + (fileSuffixIndex == - 1) ? progName : progName.substring(0, fileSuffixIndex); + // RF edges give both ordering and data flow information, thus even when the pair is in PO + // we get some data flow information by observing the edge + // FR edges only give ordering information which is known if the pair is also in PO + // CO edges only give ordering information which is known if the pair is also in PO + return generateGraphvizFile(m, 1, (x, y) -> true, (x, y) -> !x.getThread().equals(y.getThread()), + (x, y) -> !x.getThread().equals(y.getThread()), getOrCreateOutputDirectory() + "/", name, + synContext, witnessType.convertToPng()); + } + private static void generateWitnessIfAble(VerificationTask task, ProverEnvironment prover, ModelChecker modelChecker, String summary) { // ------------------ Generate Witness, if possible ------------------ diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/witness/graphviz/ExecutionGraphVisualizer.java b/dartagnan/src/main/java/com/dat3m/dartagnan/witness/graphviz/ExecutionGraphVisualizer.java index 4f535f402a..0bd5707727 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/witness/graphviz/ExecutionGraphVisualizer.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/witness/graphviz/ExecutionGraphVisualizer.java @@ -9,7 +9,6 @@ import com.dat3m.dartagnan.program.event.metadata.MemoryOrder; import com.dat3m.dartagnan.verification.model.EventData; import com.dat3m.dartagnan.verification.model.ExecutionModel; - import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -225,7 +224,7 @@ private void appendEdge(EventData a, EventData b, String... options) { graphviz.addEdge(eventToNode(a), eventToNode(b), options); } - public static void generateGraphvizFile(ExecutionModel model, int iterationCount, + public static File generateGraphvizFile(ExecutionModel model, int iterationCount, BiPredicate rfFilter, BiPredicate frFilter, BiPredicate coFilter, String directoryName, String fileNameBase, SyntacticContextAnalysis synContext, @@ -243,11 +242,14 @@ public static void generateGraphvizFile(ExecutionModel model, int iterationCount writer.flush(); if (convert) { - Graphviz.convert(fileVio); + fileVio = Graphviz.convert(fileVio); } + return fileVio; } catch (Exception e) { logger.error(e); } + + return null; } public static void generateGraphvizFile(ExecutionModel model, int iterationCount, diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/witness/graphviz/Graphviz.java b/dartagnan/src/main/java/com/dat3m/dartagnan/witness/graphviz/Graphviz.java index b3385fc26a..bb95e22eb4 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/witness/graphviz/Graphviz.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/witness/graphviz/Graphviz.java @@ -96,11 +96,13 @@ public void generateOutput(Writer writer) throws IOException { * @throws IOException The program is not installed, or the directory of {@code dotFile} does not exist. * @throws InterruptedException The current thread is interrupted while waiting for the command to finish. */ - public static void convert(File dotFile) throws IOException, InterruptedException { - String fileName = dotFile.getName(); - String fileNameBase = fileName.substring(0, fileName.lastIndexOf('.')); + public static File convert(File dotFile) throws IOException, InterruptedException { + final String dotFileName = dotFile.getName(); + final String pngFileName = dotFileName.substring(0, dotFileName.lastIndexOf('.')) + ".png"; Process p = new ProcessBuilder().directory(dotFile.getParentFile()) - .command("dot", "-Tpng", fileName, "-o", fileNameBase + ".png").start(); + .command("dot", "-Tpng", dotFileName, "-o", pngFileName).start(); p.waitFor(1000, TimeUnit.MILLISECONDS); + + return new File(dotFile.getParentFile(), pngFileName); } } diff --git a/ui/src/main/java/com/dat3m/ui/Dat3M.java b/ui/src/main/java/com/dat3m/ui/Dat3M.java index c706aac778..fbeb33d53a 100644 --- a/ui/src/main/java/com/dat3m/ui/Dat3M.java +++ b/ui/src/main/java/com/dat3m/ui/Dat3M.java @@ -4,22 +4,24 @@ import com.dat3m.dartagnan.parsers.program.ProgramParser; import com.dat3m.dartagnan.program.Program; import com.dat3m.dartagnan.wmm.Wmm; -import com.dat3m.ui.editor.EditorsPane; import com.dat3m.ui.editor.Editor; import com.dat3m.ui.editor.EditorCode; +import com.dat3m.ui.editor.EditorsPane; import com.dat3m.ui.listener.EditorListener; -import com.dat3m.ui.utils.UiOptions; import com.dat3m.ui.options.OptionsPane; import com.dat3m.ui.options.utils.ControlCode; import com.dat3m.ui.result.ReachabilityResult; -import javax.swing.*; - +import com.dat3m.ui.utils.ImageLabel; +import com.dat3m.ui.utils.UiOptions; import org.antlr.v4.runtime.InputMismatchException; import org.antlr.v4.runtime.Token; +import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; import static com.dat3m.ui.utils.Utils.showError; import static javax.swing.BorderFactory.createEmptyBorder; @@ -27,88 +29,136 @@ public class Dat3M extends JFrame implements ActionListener { - private final OptionsPane optionsPane = new OptionsPane(); - private final EditorsPane editorsPane = new EditorsPane(); - - private ReachabilityResult testResult; - - private Dat3M() { - getDefaults().put("SplitPane.border", createEmptyBorder()); - - setTitle("Dat3M"); - setExtendedState(JFrame.MAXIMIZED_BOTH); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - setLayout(new BorderLayout()); -// setIconImage(IconHelper.getIcon(IconCode.DAT3M).getImage()); - - JMenuBar menuBar = new JMenuBar(); - JMenu fileMenu = new JMenu("File"); - fileMenu.add(editorsPane.getMenuImporter()); - fileMenu.add(editorsPane.getMenuExporter()); - menuBar.add(fileMenu); - setJMenuBar(menuBar); - - JSplitPane mainPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, optionsPane, editorsPane.getMainPane()); - mainPane.setDividerSize(2); - add(mainPane); - - // Start listening to button events - optionsPane.getTestButton().addActionListener(this); - - // optionsPane needs to listen to editor to clean the console - editorsPane.getEditor(EditorCode.PROGRAM).addActionListener(optionsPane); - editorsPane.getEditor(EditorCode.TARGET_MM).addActionListener(optionsPane); - - // The console shall be cleaned every time the program or MM is modified from the editor - EditorListener listener = new EditorListener(optionsPane.getConsolePane()); - editorsPane.getEditor(EditorCode.PROGRAM).getEditorPane().addKeyListener(listener); - editorsPane.getEditor(EditorCode.TARGET_MM).getEditorPane().addKeyListener(listener); - - pack(); - } - - public static void main(String[] args) { - EventQueue.invokeLater(() -> { - Dat3M app = new Dat3M(); - app.setVisible(true); - }); - } - - @Override - public void actionPerformed(ActionEvent event) { - String command = event.getActionCommand(); - if(ControlCode.TEST.actionCommand().equals(command)){ + private final OptionsPane optionsPane = new OptionsPane(); + private final EditorsPane editorsPane = new EditorsPane(); + + private ReachabilityResult testResult; + + private Dat3M() { + getDefaults().put("SplitPane.border", createEmptyBorder()); + + setTitle("Dat3M"); + setExtendedState(JFrame.MAXIMIZED_BOTH); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setLayout(new BorderLayout()); +// setIconImage(IconHelper.getIcon(IconCode.DAT3M).getImage()); + + JMenuBar menuBar = new JMenuBar(); + JMenu fileMenu = new JMenu("File"); + fileMenu.add(editorsPane.getMenuImporter()); + fileMenu.add(editorsPane.getMenuExporter()); + menuBar.add(fileMenu); + setJMenuBar(menuBar); + + JSplitPane mainPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, optionsPane, editorsPane.getMainPane()); + mainPane.setDividerSize(2); + add(mainPane); + + // Start listening to button events + optionsPane.getTestButton().addActionListener(this); + + // optionsPane needs to listen to editor to clean the console + editorsPane.getEditor(EditorCode.PROGRAM).addActionListener(optionsPane); + editorsPane.getEditor(EditorCode.TARGET_MM).addActionListener(optionsPane); + + // The console shall be cleaned every time the program or MM is modified from the editor + EditorListener listener = new EditorListener(optionsPane.getConsolePane()); + editorsPane.getEditor(EditorCode.PROGRAM).getEditorPane().addKeyListener(listener); + editorsPane.getEditor(EditorCode.TARGET_MM).getEditorPane().addKeyListener(listener); + + pack(); + } + + public static void main(String[] args) { + EventQueue.invokeLater(() -> { + Dat3M app = new Dat3M(); + app.setVisible(true); + }); + } + + @Override + public void actionPerformed(ActionEvent event) { + String command = event.getActionCommand(); + if (ControlCode.TEST.actionCommand().equals(command)) { runTest(); - if(testResult != null){ + if (testResult != null) { optionsPane.getConsolePane().setText(testResult.getVerdict()); + if (optionsPane.getOptions().showWitness() && testResult.hasWitness()) { + showViolation(testResult); + } + } + } + } + + private void showViolation(ReachabilityResult testResult) { + final String filePath = testResult.getWitnessFile().getAbsolutePath(); + + // Generate scroll pane with image of violation + final ImageIcon imageIcon = new ImageIcon(filePath); + imageIcon.getImage().flush(); // Flush the caches for otherwise we might show a previously loaded file!!! + + final ImageLabel imgLabel = new ImageLabel(imageIcon); + final JScrollPane scrollPane = new JScrollPane(imgLabel); + + scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + + // Generate window frame at center of screen that embeds the scrollable image + final JFrame imageFrame = new JFrame(); + final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + final int x = (screenSize.width - imageFrame.getSize().width) / 2; + final int y = (screenSize.height - imageFrame.getSize().height) / 2; + final int extraFrameSize = 100; + + // Add zoomability to the witness + imageFrame.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.getKeyChar() == '+') { + imgLabel.zoom(1.05); + } else if (e.getKeyChar() == '-') { + imgLabel.zoom(0.95); + } + } + }); + + imageFrame.setSize(imageIcon.getIconWidth() + extraFrameSize, imageIcon.getIconHeight() + extraFrameSize); + imageFrame.getContentPane().add(scrollPane); + imageFrame.setLocation(x, y); + imageFrame.setVisible(true); + + optionsPane.getConsolePane().setText( + optionsPane.getConsolePane().getText() + "\n" + "Witness file: " + filePath + ); + } + + private void runTest() { + UiOptions options = optionsPane.getOptions(); + testResult = null; + try { + final Editor programEditor = editorsPane.getEditor(EditorCode.PROGRAM); + // We default to "c" code, if we do not know + final String format = programEditor.getLoadedFormat().isEmpty() ? "c" : programEditor.getLoadedFormat(); + final Program program = new ProgramParser().parse(programEditor.getEditorPane().getText(), + programEditor.getLoadedPath(), + format, + options.cflags()); + program.setName("dat3mUI"); + try { + final Wmm targetModel = new ParserCat().parse(editorsPane.getEditor(EditorCode.TARGET_MM).getEditorPane().getText()); + testResult = new ReachabilityResult(program, targetModel, options); + } catch (Exception e) { + final String msg = e.getMessage() == null ? "Memory model cannot be parsed" : e.getMessage(); + showError(msg, "Target memory model error"); + } + } catch (Exception e) { + final Throwable cause = e.getCause(); + String msg = e.getMessage() == null ? "Program cannot be parsed" : e.getMessage(); + if (cause instanceof InputMismatchException exception) { + Token token = exception.getOffendingToken(); + msg = "Problem with \"" + token.getText() + "\" at line " + token.getLine(); } + showError(msg, "Program error"); } - } - - private void runTest(){ - UiOptions options = optionsPane.getOptions(); - testResult = null; - try { - Editor programEditor = editorsPane.getEditor(EditorCode.PROGRAM); - Program program = new ProgramParser().parse(programEditor.getEditorPane().getText(), - programEditor.getLoadedPath(), - programEditor.getLoadedFormat(), - options.getCflags()); - try { - Wmm targetModel = new ParserCat().parse(editorsPane.getEditor(EditorCode.TARGET_MM).getEditorPane().getText()); - testResult = new ReachabilityResult(program, targetModel, options); - } catch (Exception e){ - String msg = e.getMessage() == null? "Memory model cannot be parsed" : e.getMessage(); - showError(msg, "Target memory model error"); - } - } catch (Exception e){ - String msg = e.getMessage() == null? "Program cannot be parsed" : e.getMessage(); - Throwable cause = e.getCause(); - if(cause instanceof InputMismatchException exception) { - Token token = exception.getOffendingToken(); - msg = "Problem with \"" + token.getText() + "\" at line " + token.getLine(); - } - showError(msg, "Program error"); - } - } + } } diff --git a/ui/src/main/java/com/dat3m/ui/button/ClearButton.java b/ui/src/main/java/com/dat3m/ui/button/ClearButton.java index 2176e77a9e..b085b6d696 100644 --- a/ui/src/main/java/com/dat3m/ui/button/ClearButton.java +++ b/ui/src/main/java/com/dat3m/ui/button/ClearButton.java @@ -1,18 +1,17 @@ package com.dat3m.ui.button; -import static com.dat3m.ui.options.OptionsPane.OPTWIDTH; - -import java.awt.Dimension; +import com.dat3m.ui.options.utils.ControlCode; -import javax.swing.JButton; +import javax.swing.*; +import java.awt.*; -import com.dat3m.ui.options.utils.ControlCode; +import static com.dat3m.ui.options.OptionsPane.OPTWIDTH; public class ClearButton extends JButton { - public ClearButton() { - super("Clear Console"); + public ClearButton() { + super("Clear Console"); setActionCommand(ControlCode.CLEAR.actionCommand()); - setMaximumSize(new Dimension(OPTWIDTH, 50)); - } + setMaximumSize(new Dimension(OPTWIDTH, 50)); + } } diff --git a/ui/src/main/java/com/dat3m/ui/button/TestButton.java b/ui/src/main/java/com/dat3m/ui/button/TestButton.java index 1626ea1895..bad7f7694a 100644 --- a/ui/src/main/java/com/dat3m/ui/button/TestButton.java +++ b/ui/src/main/java/com/dat3m/ui/button/TestButton.java @@ -1,18 +1,17 @@ package com.dat3m.ui.button; -import static com.dat3m.ui.options.OptionsPane.OPTWIDTH; - -import java.awt.Dimension; +import com.dat3m.ui.options.utils.ControlCode; -import javax.swing.JButton; +import javax.swing.*; +import java.awt.*; -import com.dat3m.ui.options.utils.ControlCode; +import static com.dat3m.ui.options.OptionsPane.OPTWIDTH; public class TestButton extends JButton { - public TestButton() { - super("Test"); + public TestButton() { + super("Test"); setActionCommand(ControlCode.TEST.actionCommand()); - setMaximumSize(new Dimension(OPTWIDTH, 50)); - } + setMaximumSize(new Dimension(OPTWIDTH, 50)); + } } diff --git a/ui/src/main/java/com/dat3m/ui/editor/Editor.java b/ui/src/main/java/com/dat3m/ui/editor/Editor.java index b7a21e333d..671342e838 100644 --- a/ui/src/main/java/com/dat3m/ui/editor/Editor.java +++ b/ui/src/main/java/com/dat3m/ui/editor/Editor.java @@ -1,23 +1,22 @@ package com.dat3m.ui.editor; import com.google.common.collect.ImmutableSet; - -import javax.swing.*; -import javax.swing.border.TitledBorder; -import javax.swing.filechooser.FileNameExtensionFilter; - import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; import org.fife.ui.rsyntaxtextarea.SyntaxConstants; import org.fife.ui.rtextarea.RTextScrollPane; +import javax.swing.*; +import javax.swing.border.TitledBorder; +import javax.swing.filechooser.FileNameExtensionFilter; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.*; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.io.*; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; import static com.dat3m.ui.utils.Utils.showError; import static java.lang.System.getProperty; @@ -39,7 +38,7 @@ public class Editor extends RTextScrollPane implements ActionListener { private Set actionListeners = new HashSet<>(); - Editor(EditorCode code, RSyntaxTextArea editorPane, String... formats){ + Editor(EditorCode code, RSyntaxTextArea editorPane, String... formats) { super(editorPane); this.code = code; this.editorPane = editorPane; @@ -51,10 +50,10 @@ public class Editor extends RTextScrollPane implements ActionListener { this.exporterItem = new JMenuItem(code.toString()); exporterItem.setActionCommand(code.editorMenuExportActionCommand()); exporterItem.addActionListener(this); - + this.allowedFormats = ImmutableSet.copyOf(Arrays.asList(formats)); this.chooser = new JFileChooser(); - for(String format : allowedFormats) { + for (String format : allowedFormats) { chooser.addChoosableFileFilter(new FileNameExtensionFilter("*." + format, format)); } @@ -64,80 +63,96 @@ public class Editor extends RTextScrollPane implements ActionListener { TitledBorder border = createTitledBorder(code.toString()); border.setTitleJustification(TitledBorder.CENTER); setBorder(border); + + editorPane.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.isControlDown() && e.getKeyChar() == '+') { + changeFontSize(1); + } else if (e.isControlDown() && e.getKeyChar() == '-') { + changeFontSize(-1); + } + } + }); + } + + private void changeFontSize(int change) { + Font scaledFont = new Font(Font.DIALOG, Font.PLAIN, editorPane.getFont().getSize() + change); + editorPane.setFont(scaledFont); } - public void addActionListener(ActionListener actionListener){ + public void addActionListener(ActionListener actionListener) { actionListeners.add(actionListener); } - public String getLoadedFormat(){ + public String getLoadedFormat() { return loadedFormat; } - public String getLoadedPath(){ + public String getLoadedPath() { return loadedPath; } @Override public void actionPerformed(ActionEvent event) { - if(code.editorMenuImportActionCommand().equals(event.getActionCommand())){ + if (code.editorMenuImportActionCommand().equals(event.getActionCommand())) { chooser.setCurrentDirectory(new File(getProperty("user.dir") + "/..")); - if(chooser.showOpenDialog(null) == APPROVE_OPTION){ + if (chooser.showOpenDialog(null) == APPROVE_OPTION) { String path = chooser.getSelectedFile().getPath(); loadedPath = path.substring(0, path.lastIndexOf('/') + 1); String format = path.substring(path.lastIndexOf('.') + 1).trim(); - if(allowedFormats.contains(format)){ + if (allowedFormats.contains(format)) { loadedFormat = format; notifyListeners(); try { editorPane.read(new InputStreamReader(new FileInputStream(path)), null); } catch (IOException e) { - showError("Error reading input file"); + showError("Error reading input file"); } } else { - showError("Please select a *." + String.join(", *.", allowedFormats) + " file", + showError("Please select a *." + String.join(", *.", allowedFormats) + " file", "Invalid file format"); } } } - if(code.editorMenuExportActionCommand().equals(event.getActionCommand())){ + if (code.editorMenuExportActionCommand().equals(event.getActionCommand())) { chooser.setCurrentDirectory(new File(getProperty("user.dir") + "/..")); - if(chooser.showSaveDialog(null) == APPROVE_OPTION){ + if (chooser.showSaveDialog(null) == APPROVE_OPTION) { String path = chooser.getSelectedFile().getPath(); String format = path.substring(path.lastIndexOf('.') + 1).trim(); - if(allowedFormats.contains(format)){ + if (allowedFormats.contains(format)) { notifyListeners(); - try { - File newTextFile = new File(path); - FileWriter fw = new FileWriter(newTextFile); - fw.write(editorPane.getText()); - fw.close(); - } catch (IOException e) { - // This should never happen since the file is created above - } + try { + File newTextFile = new File(path); + FileWriter fw = new FileWriter(newTextFile); + fw.write(editorPane.getText()); + fw.close(); + } catch (IOException e) { + // This should never happen since the file is created above + } } else { - showError("Please select a *." + String.join(", *.", allowedFormats) + " file", + showError("Please select a *." + String.join(", *.", allowedFormats) + " file", "Invalid file format"); } } } } - JMenuItem getImporterItem(){ + JMenuItem getImporterItem() { return importerItem; } - JMenuItem getExporterItem(){ + JMenuItem getExporterItem() { return exporterItem; } - public RSyntaxTextArea getEditorPane(){ + public RSyntaxTextArea getEditorPane() { return editorPane; } - private void notifyListeners(){ + private void notifyListeners() { ActionEvent dataLoadedEvent = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, code.editorActionCommand()); - for(ActionListener actionListener : actionListeners){ + for (ActionListener actionListener : actionListeners) { actionListener.actionPerformed(dataLoadedEvent); } } diff --git a/ui/src/main/java/com/dat3m/ui/editor/EditorCode.java b/ui/src/main/java/com/dat3m/ui/editor/EditorCode.java index 6b62380248..88c9566448 100644 --- a/ui/src/main/java/com/dat3m/ui/editor/EditorCode.java +++ b/ui/src/main/java/com/dat3m/ui/editor/EditorCode.java @@ -5,43 +5,31 @@ public enum EditorCode { PROGRAM, TARGET_MM; @Override - public String toString(){ - switch(this){ - case PROGRAM: - return "Program"; - case TARGET_MM: - return "Target Memory Model"; - } - return super.toString(); + public String toString() { + return switch (this) { + case PROGRAM -> "Program"; + case TARGET_MM -> "Target Memory Model"; + }; } - public String editorMenuImportActionCommand(){ - switch(this){ - case PROGRAM: - return "editor_menu_import_action_program"; - case TARGET_MM: - return "editor_menu_import_action_target_mm"; - } - throw new RuntimeException("Illegal EditorCode"); + public String editorMenuImportActionCommand() { + return switch (this) { + case PROGRAM -> "editor_menu_import_action_program"; + case TARGET_MM -> "editor_menu_import_action_target_mm"; + }; } - public String editorMenuExportActionCommand(){ - switch(this){ - case PROGRAM: - return "editor_menu_export_action_program"; - case TARGET_MM: - return "editor_menu_export_action_target_mm"; - } - throw new RuntimeException("Illegal EditorCode"); + public String editorMenuExportActionCommand() { + return switch (this) { + case PROGRAM -> "editor_menu_export_action_program"; + case TARGET_MM -> "editor_menu_export_action_target_mm"; + }; } - public String editorActionCommand(){ - switch(this){ - case PROGRAM: - return "editor_action_program"; - case TARGET_MM: - return "editor_action_target_mm"; - } - throw new RuntimeException("Illegal EditorCode"); + public String editorActionCommand() { + return switch (this) { + case PROGRAM -> "editor_action_program"; + case TARGET_MM -> "editor_action_target_mm"; + }; } } diff --git a/ui/src/main/java/com/dat3m/ui/editor/EditorsPane.java b/ui/src/main/java/com/dat3m/ui/editor/EditorsPane.java index 98556c8622..1601801b04 100644 --- a/ui/src/main/java/com/dat3m/ui/editor/EditorsPane.java +++ b/ui/src/main/java/com/dat3m/ui/editor/EditorsPane.java @@ -1,12 +1,10 @@ package com.dat3m.ui.editor; import com.google.common.collect.ImmutableMap; +import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; import javax.swing.*; import javax.swing.border.TitledBorder; - -import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; - import java.awt.*; public class EditorsPane { @@ -21,7 +19,7 @@ EditorCode.TARGET_MM, new Editor(EditorCode.TARGET_MM, new RSyntaxTextArea(), "c private final JMenu menuImporter; private final JMenu menuExporter; - public EditorsPane(){ + public EditorsPane() { menuImporter = new JMenu("Import"); menuImporter.add(editors.get(EditorCode.PROGRAM).getImporterItem()); menuImporter.add(editors.get(EditorCode.TARGET_MM).getImporterItem()); @@ -31,10 +29,10 @@ public EditorsPane(){ menuExporter.add(editors.get(EditorCode.TARGET_MM).getExporterItem()); Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); - Dimension editorsDimension = new Dimension((int)(screenDimension.getWidth() *1/3), (int)screenDimension.getHeight()); - editors.get(EditorCode.PROGRAM).setPreferredSize(editorsDimension); + Dimension editorsDimension = new Dimension((int) (screenDimension.getWidth() * 1 / 3), (int) screenDimension.getHeight()); + editors.get(EditorCode.PROGRAM).setPreferredSize(editorsDimension); editors.get(EditorCode.TARGET_MM).setPreferredSize(editorsDimension); - + mmPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); mmPane.setBottomComponent(editors.get(EditorCode.TARGET_MM)); mmPane.setOneTouchExpandable(true); @@ -48,19 +46,19 @@ public EditorsPane(){ mainPane.setBorder(new TitledBorder("")); } - public JMenu getMenuImporter(){ + public JMenu getMenuImporter() { return menuImporter; } - public JMenu getMenuExporter(){ + public JMenu getMenuExporter() { return menuExporter; } - public JSplitPane getMainPane(){ + public JSplitPane getMainPane() { return mainPane; } - public Editor getEditor(EditorCode code){ + public Editor getEditor(EditorCode code) { return editors.get(code); } } diff --git a/ui/src/main/java/com/dat3m/ui/editor/LineNumbersView.java b/ui/src/main/java/com/dat3m/ui/editor/LineNumbersView.java deleted file mode 100644 index 74558dfa6e..0000000000 --- a/ui/src/main/java/com/dat3m/ui/editor/LineNumbersView.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.dat3m.ui.editor; - -import static java.lang.String.valueOf; -import static javax.swing.text.Utilities.getRowEnd; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Graphics; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import javax.swing.JComponent; -import javax.swing.event.CaretEvent; -import javax.swing.event.CaretListener; -import javax.swing.text.BadLocationException; -import javax.swing.text.Element; -import javax.swing.text.JTextComponent; - -class LineNumbersView extends JComponent implements CaretListener, ActionListener { - - private final JTextComponent editor; - - LineNumbersView(JTextComponent editor) { - this.editor = editor; - editor.addCaretListener(this); - Dimension size = new Dimension(28, editor.getHeight()); - setPreferredSize(size); - setSize(size); - } - - @Override - public void paintComponent(Graphics g) { - super.paintComponent(g); - - Rectangle clip = g.getClipBounds(); - int currentOffset = editor.viewToModel(new Point(0, clip.y)); - int endOffset = editor.viewToModel(new Point(0, clip.y + clip.height)); - - while (currentOffset <= endOffset) { - try { - // Computes the line number based on the offset - int lineNumber = editor.getDocument().getDefaultRootElement().getElementIndex(currentOffset) + 1; - // x position of the line number is fixed - int x = getInsets().left + 2; - // y position is different for each line number - int y = getOffsetY(currentOffset); - - g.setFont(new Font(Font.MONOSPACED, Font.BOLD, editor.getFont().getSize())); - g.setColor(isCurrentLine(currentOffset) ? Color.RED : Color.BLACK); - g.drawString(valueOf(lineNumber), x, y); - - // Update offset - currentOffset = getRowEnd(editor, currentOffset) + 1; - } catch (BadLocationException e) { - e.printStackTrace(); - } - } - } - - private int getOffsetY(int offset) throws BadLocationException { - int descent = editor.getFontMetrics(editor.getFont()).getDescent(); - Rectangle r = editor.modelToView(offset); - return r.y + r.height - descent; - } - - private boolean isCurrentLine(int offset) { - Element root = editor.getDocument().getDefaultRootElement(); - return root.getElementIndex(offset) == root.getElementIndex(editor.getCaretPosition()); - } - - @Override - public void caretUpdate(CaretEvent e) { - repaint(); - } - - @Override - public void actionPerformed(ActionEvent e) { - repaint(); - } -} \ No newline at end of file diff --git a/ui/src/main/java/com/dat3m/ui/icon/IconCode.java b/ui/src/main/java/com/dat3m/ui/icon/IconCode.java index b75b920535..c6e6d6a9f7 100644 --- a/ui/src/main/java/com/dat3m/ui/icon/IconCode.java +++ b/ui/src/main/java/com/dat3m/ui/icon/IconCode.java @@ -5,31 +5,24 @@ import java.net.URL; public enum IconCode { - DAT3M, DARTAGNAN; @Override - public String toString(){ - switch(this){ - case DAT3M: - return "Dat3M"; - case DARTAGNAN: - return "Dartagnan"; - } - return super.toString(); + public String toString() { + return switch (this) { + case DAT3M -> "Dat3M"; + case DARTAGNAN -> "Dartagnan"; + }; } - public URL getPath(){ - switch(this){ - case DAT3M: - return getResource("/dat3m.png"); - case DARTAGNAN: - return getResource("/dartagnan.jpg"); - } - throw new RuntimeException("Illegal IconCode option"); + public URL getPath() { + return switch (this) { + case DAT3M -> getResource("/dat3m.png"); + case DARTAGNAN -> getResource("/dartagnan.jpg"); + }; } - private URL getResource(String filename){ + private URL getResource(String filename) { return Dat3M.class.getResource(filename); } } diff --git a/ui/src/main/java/com/dat3m/ui/icon/IconHelper.java b/ui/src/main/java/com/dat3m/ui/icon/IconHelper.java index 8ace82c641..1a1e61f2c5 100644 --- a/ui/src/main/java/com/dat3m/ui/icon/IconHelper.java +++ b/ui/src/main/java/com/dat3m/ui/icon/IconHelper.java @@ -9,27 +9,27 @@ public class IconHelper { private static Map> data = new HashMap<>(); - public static ImageIcon getIcon(IconCode code){ + public static ImageIcon getIcon(IconCode code) { return getIcon(code, -1); } - public static ImageIcon getIcon(IconCode code, int height){ + public static ImageIcon getIcon(IconCode code, int height) { data.putIfAbsent(code, new HashMap<>()); Map heightMap = data.get(code); height = Math.max(-1, height); - if(!heightMap.containsKey(height)){ + if (!heightMap.containsKey(height)) { heightMap.put(height, mkIcon(code, height)); } return heightMap.get(height); } - private static ImageIcon mkIcon(IconCode code, int height){ + private static ImageIcon mkIcon(IconCode code, int height) { ImageIcon origImage = new ImageIcon(code.getPath(), code.toString()); - if(height == -1){ + if (height == -1) { return origImage; } - if(height > origImage.getIconHeight()){ + if (height > origImage.getIconHeight()) { System.err.println("Warning: scaling image large its original size might degrade image quality"); } diff --git a/ui/src/main/java/com/dat3m/ui/listener/BoundListener.java b/ui/src/main/java/com/dat3m/ui/listener/BoundListener.java index 57cea9c509..44209e2cac 100644 --- a/ui/src/main/java/com/dat3m/ui/listener/BoundListener.java +++ b/ui/src/main/java/com/dat3m/ui/listener/BoundListener.java @@ -1,66 +1,66 @@ package com.dat3m.ui.listener; -import static com.dat3m.ui.utils.Utils.showError; +import com.dat3m.ui.options.BoundField; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; -import com.dat3m.ui.options.BoundField; +import static com.dat3m.ui.utils.Utils.showError; public class BoundListener implements KeyListener, FocusListener { - - private BoundField boundPane; - public BoundListener(BoundField pane) { - this.boundPane = pane; - } - - @Override - public void keyPressed(KeyEvent e) { - runTest(); - } + private BoundField boundPane; + + public BoundListener(BoundField pane) { + this.boundPane = pane; + } + + @Override + public void keyPressed(KeyEvent e) { + runTest(); + } + + @Override + public void keyReleased(KeyEvent e) { + runTest(); + } - @Override - public void keyReleased(KeyEvent e) { - runTest(); - } + @Override + public void keyTyped(KeyEvent e) { + runTest(); + } - @Override - public void keyTyped(KeyEvent e) { - runTest(); - } - - private void runTest() { - String cText = boundPane.getText(); - try { - int cBound = Integer.parseInt(cText); - if(cBound <= 0) { - showError("The bound should be greater than 1", "Option error"); - boundPane.setText(boundPane.getStableBound()); - } - boundPane.setStableBound(cText); - } catch (Exception e) { - // Empty string is allowed here to allow deleting. It will be handled by focusLost - if(cText.isEmpty()) { - return; - } - boundPane.setText(boundPane.getStableBound()); - showError("The bound should be greater than 1", "Option error"); - } - } + private void runTest() { + String cText = boundPane.getText(); + try { + int cBound = Integer.parseInt(cText); + if (cBound <= 0) { + showError("The bound should be greater than 1", "Option error"); + boundPane.setText(boundPane.getStableBound()); + } + boundPane.setStableBound(cText); + } catch (Exception e) { + // Empty string is allowed here to allow deleting. It will be handled by focusLost + if (cText.isEmpty()) { + return; + } + boundPane.setText(boundPane.getStableBound()); + showError("The bound should be greater than 1", "Option error"); + } + } - @Override - public void focusGained(FocusEvent arg0) { - // Nothing t be done here - } + @Override + public void focusGained(FocusEvent arg0) { + // Nothing to be done here + } - @Override - public void focusLost(FocusEvent arg0) { - if(boundPane.getText().isEmpty()) { - boundPane.setText(boundPane.getStableBound()); - showError("The bound should be greater than 1", "Option error"); - } - } + @Override + public void focusLost(FocusEvent arg0) { + if (boundPane.getText().isEmpty()) { + boundPane.setText(boundPane.getStableBound()); + showError("The bound should be greater than 1", "Option error"); + } + } } diff --git a/ui/src/main/java/com/dat3m/ui/listener/EditorListener.java b/ui/src/main/java/com/dat3m/ui/listener/EditorListener.java index 8a3ca9f158..799dc7f5a8 100644 --- a/ui/src/main/java/com/dat3m/ui/listener/EditorListener.java +++ b/ui/src/main/java/com/dat3m/ui/listener/EditorListener.java @@ -1,30 +1,29 @@ package com.dat3m.ui.listener; +import javax.swing.*; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; -import javax.swing.JTextPane; - public class EditorListener implements KeyListener { - - private JTextPane consolePane; - public EditorListener(JTextPane pane) { - this.consolePane = pane; - } - - @Override - public void keyPressed(KeyEvent e) { - // Nothing to be done - } + private JTextPane consolePane; + + public EditorListener(JTextPane pane) { + this.consolePane = pane; + } + + @Override + public void keyPressed(KeyEvent e) { + // Nothing to be done + } - @Override - public void keyReleased(KeyEvent e) { - // Nothing to be done - } + @Override + public void keyReleased(KeyEvent e) { + // Nothing to be done + } - @Override - public void keyTyped(KeyEvent e) { - consolePane.setText(""); - } + @Override + public void keyTyped(KeyEvent e) { + consolePane.setText(""); + } } diff --git a/ui/src/main/java/com/dat3m/ui/listener/TimeoutListener.java b/ui/src/main/java/com/dat3m/ui/listener/TimeoutListener.java index a0b1779cfc..59ed45b3d5 100644 --- a/ui/src/main/java/com/dat3m/ui/listener/TimeoutListener.java +++ b/ui/src/main/java/com/dat3m/ui/listener/TimeoutListener.java @@ -1,66 +1,66 @@ package com.dat3m.ui.listener; -import static com.dat3m.ui.utils.Utils.showError; +import com.dat3m.ui.options.TimeoutField; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; -import com.dat3m.ui.options.TimeoutField; +import static com.dat3m.ui.utils.Utils.showError; public class TimeoutListener implements KeyListener, FocusListener { - - private TimeoutField timeoutPane; - public TimeoutListener(TimeoutField pane) { - this.timeoutPane = pane; - } - - @Override - public void keyPressed(KeyEvent e) { - runTest(); - } + private TimeoutField timeoutPane; + + public TimeoutListener(TimeoutField pane) { + this.timeoutPane = pane; + } + + @Override + public void keyPressed(KeyEvent e) { + runTest(); + } + + @Override + public void keyReleased(KeyEvent e) { + runTest(); + } - @Override - public void keyReleased(KeyEvent e) { - runTest(); - } + @Override + public void keyTyped(KeyEvent e) { + runTest(); + } - @Override - public void keyTyped(KeyEvent e) { - runTest(); - } - - private void runTest() { - String cText = timeoutPane.getText(); - try { - int cBound = Integer.parseInt(cText); - if(cBound <= 0) { - showError("The timeout should be greater than 1", "Option error"); - timeoutPane.setText(timeoutPane.getStableBound()); - } - timeoutPane.setStableBound(cText); - } catch (Exception e) { - // Empty string is allowed here to allow deleting. It will be handled by focusLost - if(cText.isEmpty()) { - return; - } - timeoutPane.setText(timeoutPane.getStableBound()); - showError("The timeout should be greater than 1", "Option error"); - } - } + private void runTest() { + String cText = timeoutPane.getText(); + try { + int cBound = Integer.parseInt(cText); + if (cBound <= 0) { + showError("The timeout should be greater than 1", "Option error"); + timeoutPane.setText(timeoutPane.getStableBound()); + } + timeoutPane.setStableBound(cText); + } catch (Exception e) { + // Empty string is allowed here to allow deleting. It will be handled by focusLost + if (cText.isEmpty()) { + return; + } + timeoutPane.setText(timeoutPane.getStableBound()); + showError("The timeout should be greater than 1", "Option error"); + } + } - @Override - public void focusGained(FocusEvent arg0) { - // Nothing t be done here - } + @Override + public void focusGained(FocusEvent arg0) { + // Nothing to be done here + } - @Override - public void focusLost(FocusEvent arg0) { - if(timeoutPane.getText().isEmpty()) { - timeoutPane.setText(timeoutPane.getStableBound()); - showError("The timeout should be greater than 1", "Option error"); - } - } + @Override + public void focusLost(FocusEvent arg0) { + if (timeoutPane.getText().isEmpty()) { + timeoutPane.setText(timeoutPane.getStableBound()); + showError("The timeout should be greater than 1", "Option error"); + } + } } diff --git a/ui/src/main/java/com/dat3m/ui/options/BoundField.java b/ui/src/main/java/com/dat3m/ui/options/BoundField.java index e27e315153..e69ef1de04 100644 --- a/ui/src/main/java/com/dat3m/ui/options/BoundField.java +++ b/ui/src/main/java/com/dat3m/ui/options/BoundField.java @@ -1,46 +1,45 @@ package com.dat3m.ui.options; -import static com.dat3m.ui.options.utils.ControlCode.BOUND; +import com.dat3m.ui.listener.BoundListener; +import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.HashSet; import java.util.Set; -import javax.swing.JTextField; - -import com.dat3m.ui.listener.BoundListener; +import static com.dat3m.ui.options.utils.ControlCode.BOUND; public class BoundField extends JTextField { - private String stableBound; - + private String stableBound; + private Set actionListeners = new HashSet<>(); - public BoundField() { - this.stableBound = "1"; - this.setColumns(3); - this.setText("1"); - - BoundListener listener = new BoundListener(this); - this.addKeyListener(listener); - this.addFocusListener(listener); - } - - public void addActionListener(ActionListener actionListener){ + public BoundField() { + this.stableBound = "1"; + this.setColumns(3); + this.setText("1"); + + BoundListener listener = new BoundListener(this); + this.addKeyListener(listener); + this.addFocusListener(listener); + } + + public void addActionListener(ActionListener actionListener) { actionListeners.add(actionListener); } - public void setStableBound(String bound) { - this.stableBound = bound; - // Listeners are notified when a new stable bound is set + public void setStableBound(String bound) { + this.stableBound = bound; + // Listeners are notified when a new stable bound is set ActionEvent boundChanged = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, BOUND.actionCommand()); - for(ActionListener actionListener : actionListeners){ + for (ActionListener actionListener : actionListeners) { actionListener.actionPerformed(boundChanged); } - } + } - public String getStableBound() { - return stableBound; - } + public String getStableBound() { + return stableBound; + } } diff --git a/ui/src/main/java/com/dat3m/ui/options/BoundPane.java b/ui/src/main/java/com/dat3m/ui/options/BoundPane.java index 46af8396fc..a3e00e0a5e 100644 --- a/ui/src/main/java/com/dat3m/ui/options/BoundPane.java +++ b/ui/src/main/java/com/dat3m/ui/options/BoundPane.java @@ -1,16 +1,14 @@ package com.dat3m.ui.options; -import static java.awt.FlowLayout.LEFT; - -import java.awt.FlowLayout; +import javax.swing.*; +import java.awt.*; -import javax.swing.JLabel; -import javax.swing.JPanel; +import static java.awt.FlowLayout.LEFT; public class BoundPane extends JPanel { - public BoundPane() { + public BoundPane() { super(new FlowLayout(LEFT)); add(new JLabel("Unrolling: ")); - } + } } diff --git a/ui/src/main/java/com/dat3m/ui/options/OptionsPane.java b/ui/src/main/java/com/dat3m/ui/options/OptionsPane.java index 063d819891..6e4ff895a6 100644 --- a/ui/src/main/java/com/dat3m/ui/options/OptionsPane.java +++ b/ui/src/main/java/com/dat3m/ui/options/OptionsPane.java @@ -1,7 +1,8 @@ package com.dat3m.ui.options; -import com.dat3m.dartagnan.configuration.Method; import com.dat3m.dartagnan.configuration.Arch; +import com.dat3m.dartagnan.configuration.Method; +import com.dat3m.dartagnan.configuration.Property; import com.dat3m.ui.button.ClearButton; import com.dat3m.ui.button.TestButton; import com.dat3m.ui.options.utils.ControlCode; @@ -15,6 +16,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Arrays; +import java.util.EnumSet; import java.util.Iterator; import static com.dat3m.ui.options.utils.Helper.solversOrderedValues; @@ -24,45 +26,56 @@ public class OptionsPane extends JPanel implements ActionListener { - public final static int OPTWIDTH = 300; - + public final static int OPTWIDTH = 300; + private final JLabel iconPane; private final Selector methodPane; private final Selector solverPane; - + private final Selector propertyPane; + private final Selector targetPane; private final BoundField boundField; private final TimeoutField timeoutField; - + private final JTextField cflagsField; + private final JTextField configField; private final JButton testButton; private final JButton clearButton; + private final JRadioButton showViolationField; + private final JTextPane consolePane; - public OptionsPane(){ - super(new GridLayout(1,0)); + public OptionsPane() { + super(new GridLayout(1, 0)); iconPane = new JLabel(); methodPane = new Selector<>(Method.orderedValues(), ControlCode.METHOD); methodPane.setSelectedItem(Method.getDefault()); - + solverPane = new Selector<>(solversOrderedValues(), ControlCode.SOLVER); solverPane.setSelectedItem(Solvers.Z3); + propertyPane = new Selector<>(Property.orderedValues(), ControlCode.PROPERTY); + solverPane.setSelectedItem(Property.PROGRAM_SPEC); + targetPane = new Selector<>(Arch.orderedValues(), ControlCode.TARGET); targetPane.setSelectedItem(Arch.getDefault()); - + boundField = new BoundField(); timeoutField = new TimeoutField(); - + showViolationField = new JRadioButton(); + cflagsField = new JTextField(); cflagsField.setColumns(20); + configField = new JTextField(); + configField.setColumns(20); + testButton = new TestButton(); clearButton = new ClearButton(); @@ -73,34 +86,38 @@ public OptionsPane(){ mkGrid(); } - private void bindListeners(){ - // optionsPane needs to listen to options to clean the console - // Alias and Mode do not change the result and thus we don't listen to them - targetPane.addActionListener(this); - boundField.addActionListener(this); - timeoutField.addActionListener(this); - clearButton.addActionListener(this); + private void bindListeners() { + // optionsPane needs to listen to options to clean the console + // Alias and Mode do not change the result, and thus we don't listen to them + targetPane.addActionListener(this); + boundField.addActionListener(this); + timeoutField.addActionListener(this); + clearButton.addActionListener(this); + propertyPane.addActionListener(this); } - public JButton getTestButton(){ + public JButton getTestButton() { return testButton; } - public JTextPane getConsolePane(){ + public JTextPane getConsolePane() { return consolePane; } - public UiOptions getOptions(){ + public UiOptions getOptions() { int bound = Integer.parseInt(boundField.getText()); int timeout = Integer.parseInt(timeoutField.getText()); - String cflags = cflagsField.getText(); - Arch target = (Arch)targetPane.getSelectedItem(); - Method method = (Method)methodPane.getSelectedItem(); - Solvers solver = (Solvers)solverPane.getSelectedItem(); - return new UiOptions(target, method, bound, solver, timeout, cflags); + boolean showViolationGraph = showViolationField.isSelected(); + String cflags = cflagsField.getText().strip(); + String config = configField.getText().strip(); + Arch target = (Arch) targetPane.getSelectedItem(); + Method method = (Method) methodPane.getSelectedItem(); + Solvers solver = (Solvers) solverPane.getSelectedItem(); + EnumSet properties = EnumSet.of((Property) propertyPane.getSelectedItem()); + return new UiOptions(target, method, bound, solver, timeout, showViolationGraph, cflags, config, properties); } - private void mkGrid(){ + private void mkGrid() { JScrollPane scrollConsole = new JScrollPane(consolePane); scrollConsole.setMaximumSize(new Dimension(OPTWIDTH, 120)); @@ -120,23 +137,32 @@ private void mkGrid(){ cflagsPane.add(new JLabel("CFLAGS: ")); cflagsPane.add(cflagsField); + JPanel configPane = new JPanel(new FlowLayout(LEFT)); + configPane.add(new JLabel("Extra options: ")); + configPane.add(configField); + + JPanel showViolationPane = new JPanel(new FlowLayout(LEFT)); + showViolationPane.add(new JLabel("Show witness graph")); + showViolationPane.add(showViolationField); + // Inner borders Border emptyBorder = BorderFactory.createEmptyBorder(); JSplitPane graphPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); graphPane.setDividerSize(0); - JComponent[] panes = { targetPane, methodPane, solverPane, boundsPane, cflagsPane, testButton, clearButton, graphPane, scrollConsole }; + JComponent[] panes = { targetPane, methodPane, solverPane, propertyPane, boundsPane, showViolationPane, configPane, + cflagsPane, testButton, clearButton, graphPane, scrollConsole }; Iterator it = Arrays.asList(panes).iterator(); JComponent current = iconPane; current.setBorder(emptyBorder); - while(it.hasNext()) { - JComponent next = it.next(); - current = new JSplitPane(JSplitPane.VERTICAL_SPLIT, current, next); - ((JSplitPane)current).setDividerSize(2); - current.setBorder(emptyBorder); - if(!(next instanceof JButton)) { - next.setBorder(emptyBorder); - } + while (it.hasNext()) { + JComponent next = it.next(); + current = new JSplitPane(JSplitPane.VERTICAL_SPLIT, current, next); + ((JSplitPane) current).setDividerSize(2); + current.setBorder(emptyBorder); + if (!(next instanceof JButton)) { + next.setBorder(emptyBorder); + } } add(current); @@ -146,9 +172,9 @@ private void mkGrid(){ setBorder(titledBorder); } - @Override - public void actionPerformed(ActionEvent e) { - // Any change in the (relevant) options clears the console - getConsolePane().setText(""); - } + @Override + public void actionPerformed(ActionEvent e) { + // Any change in the (relevant) options clears the console + getConsolePane().setText(""); + } } \ No newline at end of file diff --git a/ui/src/main/java/com/dat3m/ui/options/TimeoutField.java b/ui/src/main/java/com/dat3m/ui/options/TimeoutField.java index 49379c916e..ed43adf4f2 100644 --- a/ui/src/main/java/com/dat3m/ui/options/TimeoutField.java +++ b/ui/src/main/java/com/dat3m/ui/options/TimeoutField.java @@ -1,46 +1,45 @@ package com.dat3m.ui.options; -import static com.dat3m.ui.options.utils.ControlCode.BOUND; +import com.dat3m.ui.listener.TimeoutListener; +import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.HashSet; import java.util.Set; -import javax.swing.JTextField; - -import com.dat3m.ui.listener.TimeoutListener; +import static com.dat3m.ui.options.utils.ControlCode.BOUND; public class TimeoutField extends JTextField { - private String stableTimeout; - + private String stableTimeout; + private Set actionListeners = new HashSet<>(); - public TimeoutField() { - this.stableTimeout = "60"; - this.setColumns(3); - this.setText("60"); - - TimeoutListener listener = new TimeoutListener(this); - this.addKeyListener(listener); - this.addFocusListener(listener); - } - - public void addActionListener(ActionListener actionListener){ + public TimeoutField() { + this.stableTimeout = "60"; + this.setColumns(3); + this.setText("60"); + + TimeoutListener listener = new TimeoutListener(this); + this.addKeyListener(listener); + this.addFocusListener(listener); + } + + public void addActionListener(ActionListener actionListener) { actionListeners.add(actionListener); } - public void setStableBound(String bound) { - this.stableTimeout = bound; - // Listeners are notified when a new stable bound is set + public void setStableBound(String bound) { + this.stableTimeout = bound; + // Listeners are notified when a new stable bound is set ActionEvent boundChanged = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, BOUND.actionCommand()); - for(ActionListener actionListener : actionListeners){ + for (ActionListener actionListener : actionListeners) { actionListener.actionPerformed(boundChanged); } - } + } - public String getStableBound() { - return stableTimeout; - } + public String getStableBound() { + return stableTimeout; + } } diff --git a/ui/src/main/java/com/dat3m/ui/options/TimeoutPane.java b/ui/src/main/java/com/dat3m/ui/options/TimeoutPane.java index b1e9a92da3..c5a8f7df00 100644 --- a/ui/src/main/java/com/dat3m/ui/options/TimeoutPane.java +++ b/ui/src/main/java/com/dat3m/ui/options/TimeoutPane.java @@ -1,16 +1,14 @@ package com.dat3m.ui.options; -import static java.awt.FlowLayout.LEFT; - -import java.awt.FlowLayout; +import javax.swing.*; +import java.awt.*; -import javax.swing.JLabel; -import javax.swing.JPanel; +import static java.awt.FlowLayout.LEFT; public class TimeoutPane extends JPanel { - public TimeoutPane() { + public TimeoutPane() { super(new FlowLayout(LEFT)); add(new JLabel("Solver timeout: ")); - } + } } diff --git a/ui/src/main/java/com/dat3m/ui/options/utils/ControlCode.java b/ui/src/main/java/com/dat3m/ui/options/utils/ControlCode.java index 23c4632bc0..0535a2ba67 100644 --- a/ui/src/main/java/com/dat3m/ui/options/utils/ControlCode.java +++ b/ui/src/main/java/com/dat3m/ui/options/utils/ControlCode.java @@ -2,50 +2,34 @@ public enum ControlCode { - TASK, TARGET, BOUND, TIMEOUT, TEST, CLEAR, METHOD, SOLVER; + TASK, TARGET, BOUND, TIMEOUT, TEST, CLEAR, METHOD, SOLVER, PROPERTY; @Override - public String toString(){ - switch(this){ - case TASK: - return "Task"; - case TARGET: - return "Target"; - case BOUND: - return "Bound"; - case TIMEOUT: - return "Timeout"; - case TEST: - return "Test"; - case CLEAR: - return "Clear"; - case METHOD: - return "Method"; - case SOLVER: - return "Solver"; - } - return super.toString(); + public String toString() { + return switch (this) { + case TASK -> "Task"; + case TARGET -> "Target"; + case BOUND -> "Bound"; + case TIMEOUT -> "Timeout"; + case TEST -> "Test"; + case CLEAR -> "Clear"; + case METHOD -> "Method"; + case SOLVER -> "Solver"; + case PROPERTY -> "Property"; + }; } - public String actionCommand(){ - switch(this){ - case TASK: - return "control_command_task"; - case TARGET: - return "control_command_target"; - case BOUND: - return "control_command_bound"; - case TIMEOUT: - return "control_command_timeout"; - case TEST: - return "control_command_test"; - case CLEAR: - return "control_command_clear"; - case METHOD: - return "control_command_method"; - case SOLVER: - return "control_command_solver"; - } - throw new RuntimeException("Illegal EditorCode"); + public String actionCommand() { + return switch (this) { + case TASK -> "control_command_task"; + case TARGET -> "control_command_target"; + case BOUND -> "control_command_bound"; + case TIMEOUT -> "control_command_timeout"; + case TEST -> "control_command_test"; + case CLEAR -> "control_command_clear"; + case METHOD -> "control_command_method"; + case SOLVER -> "control_command_solver"; + case PROPERTY -> "control_command_property"; + }; } } diff --git a/ui/src/main/java/com/dat3m/ui/options/utils/Helper.java b/ui/src/main/java/com/dat3m/ui/options/utils/Helper.java index e22e91845e..5b657e36f2 100644 --- a/ui/src/main/java/com/dat3m/ui/options/utils/Helper.java +++ b/ui/src/main/java/com/dat3m/ui/options/utils/Helper.java @@ -1,16 +1,16 @@ package com.dat3m.ui.options.utils; +import org.sosy_lab.java_smt.SolverContextFactory.Solvers; + import java.util.Arrays; import java.util.Comparator; -import org.sosy_lab.java_smt.SolverContextFactory.Solvers; - public class Helper { - // Used to decide the solvers order shown by the selector in the UI - public static Solvers[] solversOrderedValues() { - return Arrays.stream(Solvers.values()) - .sorted(Comparator.comparing(Solvers::toString)) - .toArray(Solvers[]::new); - } + // Used to decide the solvers order shown by the selector in the UI + public static Solvers[] solversOrderedValues() { + return Arrays.stream(Solvers.values()) + .sorted(Comparator.comparing(Solvers::toString)) + .toArray(Solvers[]::new); + } } diff --git a/ui/src/main/java/com/dat3m/ui/result/ReachabilityResult.java b/ui/src/main/java/com/dat3m/ui/result/ReachabilityResult.java index 00464c2df8..6f2f6e622b 100644 --- a/ui/src/main/java/com/dat3m/ui/result/ReachabilityResult.java +++ b/ui/src/main/java/com/dat3m/ui/result/ReachabilityResult.java @@ -1,12 +1,15 @@ package com.dat3m.ui.result; import com.dat3m.dartagnan.Dartagnan; +import com.dat3m.dartagnan.configuration.Arch; import com.dat3m.dartagnan.program.Program; +import com.dat3m.dartagnan.utils.Result; import com.dat3m.dartagnan.verification.VerificationTask; -import com.dat3m.dartagnan.verification.solving.*; +import com.dat3m.dartagnan.verification.solving.AssumeSolver; +import com.dat3m.dartagnan.verification.solving.ModelChecker; +import com.dat3m.dartagnan.verification.solving.RefinementSolver; +import com.dat3m.dartagnan.witness.WitnessType; import com.dat3m.dartagnan.wmm.Wmm; -import com.dat3m.dartagnan.configuration.Arch; -import com.dat3m.dartagnan.configuration.Property; import com.dat3m.ui.utils.UiOptions; import com.dat3m.ui.utils.Utils; import org.sosy_lab.common.ShutdownManager; @@ -16,6 +19,9 @@ import org.sosy_lab.java_smt.api.ProverEnvironment; import org.sosy_lab.java_smt.api.SolverContext; import org.sosy_lab.java_smt.api.SolverContext.ProverOptions; + +import java.io.File; + import static com.dat3m.dartagnan.configuration.OptionNames.PHANTOM_REFERENCES; public class ReachabilityResult { @@ -25,78 +31,91 @@ public class ReachabilityResult { private final UiOptions options; private String verdict; + private File witnessFile; - public ReachabilityResult(Program program, Wmm wmm, UiOptions options){ + + public ReachabilityResult(Program program, Wmm wmm, UiOptions options) { this.program = program; this.wmm = wmm; this.options = options; run(); } - public String getVerdict(){ + public String getVerdict() { return verdict; } - private void run(){ - if(validate()){ - - ShutdownManager sdm = ShutdownManager.create(); - Thread t = new Thread(() -> { - try { - if(options.getTimeout() > 0) { - // Converts timeout from secs to millisecs - Thread.sleep(1000L * options.getTimeout()); - sdm.requestShutdown("Shutdown Request"); - } - } catch (InterruptedException e) { - // Verification ended, nothing to be done. - }}); + public boolean hasWitness() { + return witnessFile != null; + } + + public File getWitnessFile() { + return witnessFile; + } + + private void run() { + if (!validate()) { + return; + } + final ShutdownManager sdm = ShutdownManager.create(); + final Thread t = new Thread(() -> { try { - ModelChecker modelChecker; - Arch arch = program.getArch() != null ? program.getArch() : options.getTarget(); - VerificationTask task = VerificationTask.builder() - .withBound(options.getBound()) - .withSolverTimeout(options.getTimeout()) - .withTarget(arch) - .build(program, wmm, Property.getDefault()); - - t.start(); - Configuration config = Configuration.builder() - .setOption(PHANTOM_REFERENCES, "true") - .build(); - try (SolverContext ctx = SolverContextFactory.createSolverContext( - config, - BasicLogManager.create(config), - sdm.getNotifier(), - options.getSolver()); - ProverEnvironment prover = ctx.newProverEnvironment(ProverOptions.GENERATE_MODELS)) { - - switch (options.getMethod()) { - case EAGER: - modelChecker = AssumeSolver.run(ctx, prover, task); - break; - case LAZY: - modelChecker = RefinementSolver.run(ctx, prover, task); - break; - default: - throw new IllegalArgumentException("method " + options.getMethod()); - } - // Verification ended, we can interrupt the timeout Thread - t.interrupt(); - verdict = Dartagnan.generateResultSummary(task, prover, modelChecker); + if (options.timeout() > 0) { + // Converts timeout from secs to millisecs + Thread.sleep(1000L * options.timeout()); + sdm.requestShutdown("Shutdown Request"); + } + } catch (InterruptedException e) { + // Verification ended, nothing to be done. + } + }); + + try { + final Arch arch = program.getArch() != null ? program.getArch() : options.target(); + final Configuration config = options.config().isEmpty() ? + Configuration.defaultConfiguration() : + Configuration.fromCmdLineArguments(options.config().split(" ")); + final VerificationTask task = VerificationTask.builder() + .withConfig(config) + .withBound(options.bound()) + .withSolverTimeout(options.timeout()) + .withTarget(arch) + .build(program, wmm, options.properties()); + + t.start(); + final Configuration solverConfig = Configuration.builder() + .setOption(PHANTOM_REFERENCES, "true") + .build(); + try (SolverContext ctx = SolverContextFactory.createSolverContext( + solverConfig, + BasicLogManager.create(solverConfig), + sdm.getNotifier(), + options.solver()); + ProverEnvironment prover = ctx.newProverEnvironment(ProverOptions.GENERATE_MODELS)) { + + final ModelChecker modelChecker; modelChecker = switch (options.method()) { + case EAGER -> AssumeSolver.run(ctx, prover, task); + case LAZY -> RefinementSolver.run(ctx, prover, task); + }; + // Verification ended, we can interrupt the timeout Thread + t.interrupt(); + verdict = Dartagnan.generateResultSummary(task, prover, modelChecker); + + if (modelChecker.hasModel() && modelChecker.getResult() != Result.UNKNOWN) { + witnessFile = Dartagnan.generateExecutionGraphFile(task, prover, modelChecker, WitnessType.PNG); } - } catch (InterruptedException e){ - verdict = "TIMEOUT"; - } catch (Exception e) { - verdict = "ERROR: " + e.getMessage(); } + } catch (InterruptedException e) { + verdict = "TIMEOUT"; + } catch (Exception e) { + verdict = "ERROR: " + e; } } - private boolean validate(){ - Arch target = program.getArch() == null ? options.getTarget() : program.getArch(); - if(target == null) { + private boolean validate() { + Arch target = program.getArch() == null ? options.target() : program.getArch(); + if (target == null) { Utils.showError("Missing target architecture."); return false; } diff --git a/ui/src/main/java/com/dat3m/ui/utils/ImageLabel.java b/ui/src/main/java/com/dat3m/ui/utils/ImageLabel.java new file mode 100644 index 0000000000..6e089ff413 --- /dev/null +++ b/ui/src/main/java/com/dat3m/ui/utils/ImageLabel.java @@ -0,0 +1,42 @@ +package com.dat3m.ui.utils; + +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; + +public class ImageLabel extends JLabel { + final ImageIcon imageIcon; + final Image originalImage; + final int originalWidth, originalHeight; + double zoomLevel = 1.0; + + public ImageLabel(ImageIcon imageIcon) { + super(imageIcon); + this.imageIcon = imageIcon; + originalImage = imageIcon.getImage(); + originalWidth = originalImage.getWidth(null); + originalHeight = originalImage.getHeight(null); + } + + public void zoom(double zoom) { + this.zoomLevel *= zoom; + setDimensions((int)(originalWidth * zoomLevel), (int)(originalHeight * zoomLevel)); + } + + public void setDimensions(int width, int height) { + BufferedImage resizedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + Graphics2D g = resizedImage.createGraphics(); + g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); + g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g.drawImage(originalImage, 0, 0, width, height, null); + g.dispose(); + + imageIcon.setImage(resizedImage); + + Container parent = this.getParent(); + if (parent != null) { + parent.repaint(); + } + this.repaint(); + } +} \ No newline at end of file diff --git a/ui/src/main/java/com/dat3m/ui/utils/UiOptions.java b/ui/src/main/java/com/dat3m/ui/utils/UiOptions.java index bb76a0a1e3..993205b492 100644 --- a/ui/src/main/java/com/dat3m/ui/utils/UiOptions.java +++ b/ui/src/main/java/com/dat3m/ui/utils/UiOptions.java @@ -1,48 +1,14 @@ package com.dat3m.ui.utils; -import com.dat3m.dartagnan.configuration.Method; import com.dat3m.dartagnan.configuration.Arch; +import com.dat3m.dartagnan.configuration.Method; +import com.dat3m.dartagnan.configuration.Property; import org.sosy_lab.java_smt.SolverContextFactory.Solvers; -public class UiOptions { - - private final Arch target; - private final Method method; - private final int bound; - private final Solvers solver; - private final int timeout; - private final String cflags; - - public UiOptions(Arch target, Method method, int bound, Solvers solver, int timeout, String cflags) { - this.target = target; - this.method = method; - this.bound = bound; - this.solver = solver; - this.timeout = timeout; - this.cflags = cflags; - } - - public Arch getTarget(){ - return target; - } - - public Method getMethod() { - return method; - } +import java.util.EnumSet; - public int getBound() { - return bound; - } +public record UiOptions(Arch target, Method method, int bound, Solvers solver, int timeout, boolean showWitness, + String cflags, String config, EnumSet properties) { - public Solvers getSolver() { - return solver; - } - public int getTimeout() { - return timeout; - } - - public String getCflags(){ - return cflags; - } } \ No newline at end of file diff --git a/ui/src/main/java/com/dat3m/ui/utils/Utils.java b/ui/src/main/java/com/dat3m/ui/utils/Utils.java index 8893b8d59c..707009f710 100644 --- a/ui/src/main/java/com/dat3m/ui/utils/Utils.java +++ b/ui/src/main/java/com/dat3m/ui/utils/Utils.java @@ -1,24 +1,21 @@ package com.dat3m.ui.utils; -import java.awt.Dimension; - -import javax.swing.JOptionPane; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; +import javax.swing.*; +import java.awt.*; public class Utils { - - public static void showError(String msg, String title){ - JTextArea textArea = new JTextArea(msg); - JScrollPane scrollPane = new JScrollPane(textArea); - Dimension size = new Dimension( Math.min(textArea.getPreferredSize().width + 1, 1000) , - Math.min(textArea.getPreferredSize().height + 1, 500) ); - scrollPane.setPreferredSize( size ); - JOptionPane.showMessageDialog(null, scrollPane, title, - JOptionPane.ERROR_MESSAGE); + + public static void showError(String msg, String title) { + JTextArea textArea = new JTextArea(msg); + JScrollPane scrollPane = new JScrollPane(textArea); + Dimension size = new Dimension(Math.min(textArea.getPreferredSize().width + 1, 1000), + Math.min(textArea.getPreferredSize().height + 1, 500)); + scrollPane.setPreferredSize(size); + JOptionPane.showMessageDialog(null, scrollPane, title, + JOptionPane.ERROR_MESSAGE); } - public static void showError(String msg){ - showError(msg, "Error"); + public static void showError(String msg) { + showError(msg, "Error"); } } From 184fab4ae27375279d90df2124ba2fef0fd2a2af Mon Sep 17 00:00:00 2001 From: Hernan Ponce de Leon Date: Mon, 3 Jun 2024 18:48:25 +0200 Subject: [PATCH 03/28] Add support for memcpy_s (#686) Signed-off-by: Hernan Ponce de Leon Co-authored-by: Hernan Ponce de Leon --- benchmarks/c/miscellaneous/memcpy_s.c | 62 +++ .../program/processing/Intrinsics.java | 113 +++++ .../dat3m/dartagnan/c/MiscellaneousTest.java | 3 +- .../test/resources/miscellaneous/memcpy_s.ll | 445 ++++++++++++++++++ 4 files changed, 622 insertions(+), 1 deletion(-) create mode 100644 benchmarks/c/miscellaneous/memcpy_s.c create mode 100644 dartagnan/src/test/resources/miscellaneous/memcpy_s.ll diff --git a/benchmarks/c/miscellaneous/memcpy_s.c b/benchmarks/c/miscellaneous/memcpy_s.c new file mode 100644 index 0000000000..969364dbf3 --- /dev/null +++ b/benchmarks/c/miscellaneous/memcpy_s.c @@ -0,0 +1,62 @@ +#include +#include + +#ifdef __STDC_LIB_EXT1__ + #define __STDC_WANT_LIB_EXT1__ 1 + #include +#else + #define rsize_t size_t + #define errno_t int + extern errno_t memcpy_s( void *restrict dest, rsize_t destsz, const void *restrict src, rsize_t count ); +#endif + +int main() +{ + int a[4] = { 1, 2, 3, 4 }; + int b[3] = { 5, 6, 7}; + + int ret; + + // NULL dest + ret = memcpy_s(NULL, 3*sizeof(int), a, 3*sizeof(int)); + assert(ret > 0); + + // NULL src + ret = memcpy_s(b, 3*sizeof(int), NULL, 3*sizeof(int)); + assert(ret > 0); + assert(b[0] == 0); + assert(b[1] == 0); + assert(b[2] == 0); + b[0] = 5; + b[1] = 6; + b[2] = 7; + + // count > destsz + ret = memcpy_s(b, 2*sizeof(int), a, 4*sizeof(int)); + assert(ret > 0); + assert(b[0] == 0); + assert(b[1] == 0); + // only [dest, dest+destsz) is zeroed + assert(b[2] == 7); + b[0] = 5; + b[1] = 6; + + // Overlapping src and dest + ret = memcpy_s(b, 3*sizeof(int), b, 3*sizeof(int)); + assert(ret > 0); + assert(b[0] == 0); + assert(b[1] == 0); + assert(b[2] == 0); + b[0] = 5; + b[1] = 6; + b[2] = 7; + + // Success + ret = memcpy_s(b, 3*sizeof(int), a, 3*sizeof(int)); + assert(ret == 0); + assert(b[0] == 1); + assert(b[1] == 2); + assert(b[2] == 3); + + return 0; +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java index a4ec500381..d5efbf529d 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java @@ -15,8 +15,10 @@ import com.dat3m.dartagnan.program.event.Event; import com.dat3m.dartagnan.program.event.EventFactory; import com.dat3m.dartagnan.program.event.Tag; +import com.dat3m.dartagnan.program.event.core.CondJump; import com.dat3m.dartagnan.program.event.core.ExecutionStatus; import com.dat3m.dartagnan.program.event.core.Label; +import com.dat3m.dartagnan.program.event.core.Local; import com.dat3m.dartagnan.program.event.functions.FunctionCall; import com.dat3m.dartagnan.program.event.functions.ValueFunctionCall; import com.dat3m.dartagnan.program.event.lang.svcomp.BeginAtomic; @@ -209,6 +211,7 @@ public enum Info { LKMM_FENCE("__LKMM_FENCE", false, false, false, true, Intrinsics::handleLKMMIntrinsic), // --------------------------- Misc --------------------------- STD_MEMCPY("memcpy", true, true, true, false, Intrinsics::inlineMemCpy), + STD_MEMCPYS("memcpy_s", true, true, true, false, Intrinsics::inlineMemCpyS), STD_MEMSET(List.of("memset", "__memset_chk"), true, false, true, false, Intrinsics::inlineMemSet), STD_MEMCMP("memcmp", false, true, true, false, Intrinsics::inlineMemCmp), STD_MALLOC("malloc", false, false, true, true, Intrinsics::inlineMalloc), @@ -1328,6 +1331,116 @@ private List inlineMemCpy(FunctionCall call) { return replacement; } + // https://en.cppreference.com/w/c/string/byte/memcpy + private List inlineMemCpyS(FunctionCall call) { + // Cast guaranteed to success by the return type of memcpy_s + final Register resultRegister = ((ValueFunctionCall)call).getResultRegister(); + final Function caller = call.getFunction(); + final Expression dest = call.getArguments().get(0); + final Expression destszExpr = call.getArguments().get(1); + final Expression src = call.getArguments().get(2); + final Expression countExpr = call.getArguments().get(3); + + // TODO remove these two checks once we support dynamically-sized memcpy + if (!(countExpr instanceof IntLiteral countValue)) { + final String error = "Cannot handle memcpy_s with dynamic count argument: " + call; + throw new UnsupportedOperationException(error); + } + final int count = countValue.getValueAsInt(); + if (!(destszExpr instanceof IntLiteral destszValue)) { + final String error = "Cannot handle memcpy_s with dynamic destsz argument: " + call; + throw new UnsupportedOperationException(error); + } + final int destsz = destszValue.getValueAsInt(); + + // Runtime checks + final Expression nullExpr = expressions.makeZero(types.getArchType()); + final Expression destIsNull = expressions.makeEQ(dest, nullExpr); + final Expression srcIsNull = expressions.makeEQ(src, nullExpr); + + // We assume RSIZE_MAX = 2^64-1 + final Expression rsize_max = expressions.makeValue(BigInteger.ONE.shiftLeft(64).subtract(BigInteger.ONE), types.getArchType()); + // These parameters have type rsize_t/size_t which we model as types.getArchType(), thus the cast + final Expression castDestszExpr = expressions.makeCast(destszExpr, types.getArchType()); + final Expression castCountExpr = expressions.makeCast(countExpr, types.getArchType()); + + final Expression invalidDestsz = expressions.makeGT(castDestszExpr, rsize_max, false); + final Expression countGtMax = expressions.makeGT(castCountExpr, rsize_max, false); + final Expression countGtdestszExpr = expressions.makeGT(castCountExpr, castDestszExpr, false); + final Expression invalidCount = expressions.makeOr(countGtMax, countGtdestszExpr); + final Expression overlap = expressions.makeAnd( + expressions.makeGT(expressions.makeAdd(src, castCountExpr), dest, false), + expressions.makeGT(expressions.makeAdd(dest, castCountExpr), src, false)); + + final List replacement = new ArrayList<>(); + + Label check1 = EventFactory.newLabel("__memcpy_s_check_1"); + Label check2 = EventFactory.newLabel("__memcpy_s_check_2"); + Label success = EventFactory.newLabel("__memcpy_s_success"); + Label end = EventFactory.newLabel("__memcpy_s_end"); + + Expression errorCodeFail = expressions.makeOne((IntegerType)resultRegister.getType()); + Expression errorCodeSuccess = expressions.makeZero((IntegerType)resultRegister.getType()); + + // Condition 1: dest == NULL or destsz > RSIZE_MAX ----> return error > 0 + final Expression cond1 = expressions.makeOr(destIsNull, invalidDestsz); + CondJump skipE1 = EventFactory.newJump(expressions.makeNot(cond1), check2); + CondJump skipRest1 = EventFactory.newGoto(end); + Local retError1 = EventFactory.newLocal(resultRegister, errorCodeFail); + replacement.addAll(List.of( + check1, + skipE1, + retError1, + skipRest1 + )); + + // Condition 2: dest != NULL && destsz <= RSIZE_MAX && (src == NULL || count > destsz || overlap(src, dest)) + // ----> return error > 0 and zero out [dest, dest+destsz) + // The first two are guaranteed by not matching cond1 + final Expression cond2 = expressions.makeOr(expressions.makeOr(srcIsNull, invalidCount), overlap); + CondJump skipE2 = EventFactory.newJump(expressions.makeNot(cond2), success); + CondJump skipRest2 = EventFactory.newGoto(end); + Local retError2 = EventFactory.newLocal(resultRegister, errorCodeFail); + replacement.addAll(List.of( + check2, + skipE2 + )); + for (int i = 0; i < destsz; i++) { + final Expression offset = expressions.makeValue(i, types.getArchType()); + final Expression destAddr = expressions.makeAdd(dest, offset); + final Expression zero = expressions.makeZero(types.getArchType()); + replacement.add( + EventFactory.newStore(destAddr, zero) + ); + } + replacement.addAll(List.of( + retError2, + skipRest2 + )); + + // Else ----> return error = 0 and do the actual copy + Local retSuccess = EventFactory.newLocal(resultRegister, errorCodeSuccess); + replacement.add(success); + for (int i = 0; i < count; i++) { + final Expression offset = expressions.makeValue(i, types.getArchType()); + final Expression srcAddr = expressions.makeAdd(src, offset); + final Expression destAddr = expressions.makeAdd(dest, offset); + // FIXME: We have no other choice but to load ptr-sized chunks for now + final Register reg = caller.getOrNewRegister("__memcpy_" + i, types.getArchType()); + + replacement.addAll(List.of( + EventFactory.newLoad(reg, srcAddr), + EventFactory.newStore(destAddr, reg) + )); + } + replacement.addAll(List.of( + retSuccess, + end + )); + + return replacement; + } + private List inlineMemCmp(FunctionCall call) { final Function caller = call.getFunction(); final Expression src1 = call.getArguments().get(0); diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/c/MiscellaneousTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/c/MiscellaneousTest.java index 0aae989468..a87146f08e 100644 --- a/dartagnan/src/test/java/com/dat3m/dartagnan/c/MiscellaneousTest.java +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/c/MiscellaneousTest.java @@ -85,7 +85,8 @@ public static Iterable data() throws IOException { {"funcPtrInStaticMemory", IMM, PASS, 1}, {"verifierAssert", ARM8, FAIL, 1}, {"uninitRead", IMM, FAIL, 1}, - {"multipleBackJumps", IMM, UNKNOWN, 1} + {"multipleBackJumps", IMM, UNKNOWN, 1}, + {"memcpy_s", IMM, PASS, 1} }); } diff --git a/dartagnan/src/test/resources/miscellaneous/memcpy_s.ll b/dartagnan/src/test/resources/miscellaneous/memcpy_s.ll new file mode 100644 index 0000000000..bdcdd90492 --- /dev/null +++ b/dartagnan/src/test/resources/miscellaneous/memcpy_s.ll @@ -0,0 +1,445 @@ +; ModuleID = '/home/ponce/git/Dat3M/output/memcpy_s.ll' +source_filename = "/home/ponce/git/Dat3M/benchmarks/c/miscellaneous/memcpy_s.c" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-pc-linux-gnu" + +@__const.main.a = private unnamed_addr constant [4 x i32] [i32 1, i32 2, i32 3, i32 4], align 16 +@__const.main.b = private unnamed_addr constant [3 x i32] [i32 5, i32 6, i32 7], align 4 +@.str = private unnamed_addr constant [8 x i8] c"ret > 0\00", align 1 +@.str.1 = private unnamed_addr constant [60 x i8] c"/home/ponce/git/Dat3M/benchmarks/c/miscellaneous/memcpy_s.c\00", align 1 +@__PRETTY_FUNCTION__.main = private unnamed_addr constant [11 x i8] c"int main()\00", align 1 +@.str.2 = private unnamed_addr constant [10 x i8] c"b[0] == 0\00", align 1 +@.str.3 = private unnamed_addr constant [10 x i8] c"b[1] == 0\00", align 1 +@.str.4 = private unnamed_addr constant [10 x i8] c"b[2] == 0\00", align 1 +@.str.5 = private unnamed_addr constant [10 x i8] c"b[2] == 7\00", align 1 +@.str.6 = private unnamed_addr constant [9 x i8] c"ret == 0\00", align 1 +@.str.7 = private unnamed_addr constant [10 x i8] c"b[0] == 1\00", align 1 +@.str.8 = private unnamed_addr constant [10 x i8] c"b[1] == 2\00", align 1 +@.str.9 = private unnamed_addr constant [10 x i8] c"b[2] == 3\00", align 1 + +; Function Attrs: noinline nounwind uwtable +define dso_local i32 @main() #0 !dbg !9 { + %1 = alloca i32, align 4 + %2 = alloca [4 x i32], align 16 + %3 = alloca [3 x i32], align 4 + %4 = alloca i32, align 4 + store i32 0, i32* %1, align 4 + call void @llvm.dbg.declare(metadata [4 x i32]* %2, metadata !14, metadata !DIExpression()), !dbg !18 + %5 = bitcast [4 x i32]* %2 to i8*, !dbg !18 + call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 %5, i8* align 16 bitcast ([4 x i32]* @__const.main.a to i8*), i64 16, i1 false), !dbg !18 + call void @llvm.dbg.declare(metadata [3 x i32]* %3, metadata !19, metadata !DIExpression()), !dbg !23 + %6 = bitcast [3 x i32]* %3 to i8*, !dbg !23 + call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %6, i8* align 4 bitcast ([3 x i32]* @__const.main.b to i8*), i64 12, i1 false), !dbg !23 + call void @llvm.dbg.declare(metadata i32* %4, metadata !24, metadata !DIExpression()), !dbg !25 + %7 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0, !dbg !26 + %8 = bitcast i32* %7 to i8*, !dbg !26 + %9 = call i32 @memcpy_s(i8* null, i64 12, i8* %8, i64 12), !dbg !27 + store i32 %9, i32* %4, align 4, !dbg !28 + %10 = load i32, i32* %4, align 4, !dbg !29 + %11 = icmp sgt i32 %10, 0, !dbg !29 + br i1 %11, label %12, label %13, !dbg !32 + +12: ; preds = %0 + br label %14, !dbg !32 + +13: ; preds = %0 + call void @__assert_fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32 22, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #5, !dbg !29 + unreachable, !dbg !29 + +14: ; preds = %12 + %15 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0, !dbg !33 + %16 = bitcast i32* %15 to i8*, !dbg !33 + %17 = call i32 @memcpy_s(i8* %16, i64 12, i8* null, i64 12), !dbg !34 + store i32 %17, i32* %4, align 4, !dbg !35 + %18 = load i32, i32* %4, align 4, !dbg !36 + %19 = icmp sgt i32 %18, 0, !dbg !36 + br i1 %19, label %20, label %21, !dbg !39 + +20: ; preds = %14 + br label %22, !dbg !39 + +21: ; preds = %14 + call void @__assert_fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32 26, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #5, !dbg !36 + unreachable, !dbg !36 + +22: ; preds = %20 + %23 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0, !dbg !40 + %24 = load i32, i32* %23, align 4, !dbg !40 + %25 = icmp eq i32 %24, 0, !dbg !40 + br i1 %25, label %26, label %27, !dbg !43 + +26: ; preds = %22 + br label %28, !dbg !43 + +27: ; preds = %22 + call void @__assert_fail(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32 27, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #5, !dbg !40 + unreachable, !dbg !40 + +28: ; preds = %26 + %29 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1, !dbg !44 + %30 = load i32, i32* %29, align 4, !dbg !44 + %31 = icmp eq i32 %30, 0, !dbg !44 + br i1 %31, label %32, label %33, !dbg !47 + +32: ; preds = %28 + br label %34, !dbg !47 + +33: ; preds = %28 + call void @__assert_fail(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32 28, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #5, !dbg !44 + unreachable, !dbg !44 + +34: ; preds = %32 + %35 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2, !dbg !48 + %36 = load i32, i32* %35, align 4, !dbg !48 + %37 = icmp eq i32 %36, 0, !dbg !48 + br i1 %37, label %38, label %39, !dbg !51 + +38: ; preds = %34 + br label %40, !dbg !51 + +39: ; preds = %34 + call void @__assert_fail(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32 29, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #5, !dbg !48 + unreachable, !dbg !48 + +40: ; preds = %38 + %41 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0, !dbg !52 + store i32 5, i32* %41, align 4, !dbg !53 + %42 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1, !dbg !54 + store i32 6, i32* %42, align 4, !dbg !55 + %43 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2, !dbg !56 + store i32 7, i32* %43, align 4, !dbg !57 + %44 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0, !dbg !58 + %45 = bitcast i32* %44 to i8*, !dbg !58 + %46 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0, !dbg !59 + %47 = bitcast i32* %46 to i8*, !dbg !59 + %48 = call i32 @memcpy_s(i8* %45, i64 8, i8* %47, i64 16), !dbg !60 + store i32 %48, i32* %4, align 4, !dbg !61 + %49 = load i32, i32* %4, align 4, !dbg !62 + %50 = icmp sgt i32 %49, 0, !dbg !62 + br i1 %50, label %51, label %52, !dbg !65 + +51: ; preds = %40 + br label %53, !dbg !65 + +52: ; preds = %40 + call void @__assert_fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32 36, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #5, !dbg !62 + unreachable, !dbg !62 + +53: ; preds = %51 + %54 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0, !dbg !66 + %55 = load i32, i32* %54, align 4, !dbg !66 + %56 = icmp eq i32 %55, 0, !dbg !66 + br i1 %56, label %57, label %58, !dbg !69 + +57: ; preds = %53 + br label %59, !dbg !69 + +58: ; preds = %53 + call void @__assert_fail(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32 37, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #5, !dbg !66 + unreachable, !dbg !66 + +59: ; preds = %57 + %60 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1, !dbg !70 + %61 = load i32, i32* %60, align 4, !dbg !70 + %62 = icmp eq i32 %61, 0, !dbg !70 + br i1 %62, label %63, label %64, !dbg !73 + +63: ; preds = %59 + br label %65, !dbg !73 + +64: ; preds = %59 + call void @__assert_fail(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32 38, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #5, !dbg !70 + unreachable, !dbg !70 + +65: ; preds = %63 + %66 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2, !dbg !74 + %67 = load i32, i32* %66, align 4, !dbg !74 + %68 = icmp eq i32 %67, 7, !dbg !74 + br i1 %68, label %69, label %70, !dbg !77 + +69: ; preds = %65 + br label %71, !dbg !77 + +70: ; preds = %65 + call void @__assert_fail(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32 40, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #5, !dbg !74 + unreachable, !dbg !74 + +71: ; preds = %69 + %72 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0, !dbg !78 + store i32 5, i32* %72, align 4, !dbg !79 + %73 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1, !dbg !80 + store i32 6, i32* %73, align 4, !dbg !81 + %74 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0, !dbg !82 + %75 = bitcast i32* %74 to i8*, !dbg !82 + %76 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0, !dbg !83 + %77 = bitcast i32* %76 to i8*, !dbg !83 + %78 = call i32 @memcpy_s(i8* %75, i64 12, i8* %77, i64 12), !dbg !84 + store i32 %78, i32* %4, align 4, !dbg !85 + %79 = load i32, i32* %4, align 4, !dbg !86 + %80 = icmp sgt i32 %79, 0, !dbg !86 + br i1 %80, label %81, label %82, !dbg !89 + +81: ; preds = %71 + br label %83, !dbg !89 + +82: ; preds = %71 + call void @__assert_fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32 46, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #5, !dbg !86 + unreachable, !dbg !86 + +83: ; preds = %81 + %84 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0, !dbg !90 + %85 = load i32, i32* %84, align 4, !dbg !90 + %86 = icmp eq i32 %85, 0, !dbg !90 + br i1 %86, label %87, label %88, !dbg !93 + +87: ; preds = %83 + br label %89, !dbg !93 + +88: ; preds = %83 + call void @__assert_fail(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32 47, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #5, !dbg !90 + unreachable, !dbg !90 + +89: ; preds = %87 + %90 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1, !dbg !94 + %91 = load i32, i32* %90, align 4, !dbg !94 + %92 = icmp eq i32 %91, 0, !dbg !94 + br i1 %92, label %93, label %94, !dbg !97 + +93: ; preds = %89 + br label %95, !dbg !97 + +94: ; preds = %89 + call void @__assert_fail(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32 48, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #5, !dbg !94 + unreachable, !dbg !94 + +95: ; preds = %93 + %96 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2, !dbg !98 + %97 = load i32, i32* %96, align 4, !dbg !98 + %98 = icmp eq i32 %97, 0, !dbg !98 + br i1 %98, label %99, label %100, !dbg !101 + +99: ; preds = %95 + br label %101, !dbg !101 + +100: ; preds = %95 + call void @__assert_fail(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32 49, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #5, !dbg !98 + unreachable, !dbg !98 + +101: ; preds = %99 + %102 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0, !dbg !102 + store i32 5, i32* %102, align 4, !dbg !103 + %103 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1, !dbg !104 + store i32 6, i32* %103, align 4, !dbg !105 + %104 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2, !dbg !106 + store i32 7, i32* %104, align 4, !dbg !107 + %105 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0, !dbg !108 + %106 = bitcast i32* %105 to i8*, !dbg !108 + %107 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0, !dbg !109 + %108 = bitcast i32* %107 to i8*, !dbg !109 + %109 = call i32 @memcpy_s(i8* %106, i64 12, i8* %108, i64 12), !dbg !110 + store i32 %109, i32* %4, align 4, !dbg !111 + %110 = load i32, i32* %4, align 4, !dbg !112 + %111 = icmp eq i32 %110, 0, !dbg !112 + br i1 %111, label %112, label %113, !dbg !115 + +112: ; preds = %101 + br label %114, !dbg !115 + +113: ; preds = %101 + call void @__assert_fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32 56, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #5, !dbg !112 + unreachable, !dbg !112 + +114: ; preds = %112 + %115 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0, !dbg !116 + %116 = load i32, i32* %115, align 4, !dbg !116 + %117 = icmp eq i32 %116, 1, !dbg !116 + br i1 %117, label %118, label %119, !dbg !119 + +118: ; preds = %114 + br label %120, !dbg !119 + +119: ; preds = %114 + call void @__assert_fail(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32 57, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #5, !dbg !116 + unreachable, !dbg !116 + +120: ; preds = %118 + %121 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1, !dbg !120 + %122 = load i32, i32* %121, align 4, !dbg !120 + %123 = icmp eq i32 %122, 2, !dbg !120 + br i1 %123, label %124, label %125, !dbg !123 + +124: ; preds = %120 + br label %126, !dbg !123 + +125: ; preds = %120 + call void @__assert_fail(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32 58, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #5, !dbg !120 + unreachable, !dbg !120 + +126: ; preds = %124 + %127 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2, !dbg !124 + %128 = load i32, i32* %127, align 4, !dbg !124 + %129 = icmp eq i32 %128, 3, !dbg !124 + br i1 %129, label %130, label %131, !dbg !127 + +130: ; preds = %126 + br label %132, !dbg !127 + +131: ; preds = %126 + call void @__assert_fail(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32 59, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #5, !dbg !124 + unreachable, !dbg !124 + +132: ; preds = %130 + ret i32 0, !dbg !128 +} + +; Function Attrs: nofree nosync nounwind readnone speculatable willreturn +declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 + +; Function Attrs: argmemonly nofree nounwind willreturn +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #2 + +declare dso_local i32 @memcpy_s(i8*, i64, i8*, i64) #3 + +; Function Attrs: noreturn nounwind +declare dso_local void @__assert_fail(i8*, i8*, i32, i8*) #4 + +attributes #0 = { noinline nounwind uwtable "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nofree nosync nounwind readnone speculatable willreturn } +attributes #2 = { argmemonly nofree nounwind willreturn } +attributes #3 = { "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #4 = { noreturn nounwind "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #5 = { noreturn nounwind } + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!5, !6, !7} +!llvm.ident = !{!8} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "Ubuntu clang version 12.0.0-3ubuntu1~20.04.5", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, splitDebugInlining: false, nameTableKind: None) +!1 = !DIFile(filename: "/home/ponce/git/Dat3M/benchmarks/c/miscellaneous/memcpy_s.c", directory: "/home/ponce/git/Dat3M") +!2 = !{} +!3 = !{!4} +!4 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +!5 = !{i32 7, !"Dwarf Version", i32 4} +!6 = !{i32 2, !"Debug Info Version", i32 3} +!7 = !{i32 1, !"wchar_size", i32 4} +!8 = !{!"Ubuntu clang version 12.0.0-3ubuntu1~20.04.5"} +!9 = distinct !DISubprogram(name: "main", scope: !10, file: !10, line: 13, type: !11, scopeLine: 14, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) +!10 = !DIFile(filename: "benchmarks/c/miscellaneous/memcpy_s.c", directory: "/home/ponce/git/Dat3M") +!11 = !DISubroutineType(types: !12) +!12 = !{!13} +!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!14 = !DILocalVariable(name: "a", scope: !9, file: !10, line: 15, type: !15) +!15 = !DICompositeType(tag: DW_TAG_array_type, baseType: !13, size: 128, elements: !16) +!16 = !{!17} +!17 = !DISubrange(count: 4) +!18 = !DILocation(line: 15, column: 9, scope: !9) +!19 = !DILocalVariable(name: "b", scope: !9, file: !10, line: 16, type: !20) +!20 = !DICompositeType(tag: DW_TAG_array_type, baseType: !13, size: 96, elements: !21) +!21 = !{!22} +!22 = !DISubrange(count: 3) +!23 = !DILocation(line: 16, column: 9, scope: !9) +!24 = !DILocalVariable(name: "ret", scope: !9, file: !10, line: 18, type: !13) +!25 = !DILocation(line: 18, column: 9, scope: !9) +!26 = !DILocation(line: 21, column: 41, scope: !9) +!27 = !DILocation(line: 21, column: 11, scope: !9) +!28 = !DILocation(line: 21, column: 9, scope: !9) +!29 = !DILocation(line: 22, column: 5, scope: !30) +!30 = distinct !DILexicalBlock(scope: !31, file: !10, line: 22, column: 5) +!31 = distinct !DILexicalBlock(scope: !9, file: !10, line: 22, column: 5) +!32 = !DILocation(line: 22, column: 5, scope: !31) +!33 = !DILocation(line: 25, column: 20, scope: !9) +!34 = !DILocation(line: 25, column: 11, scope: !9) +!35 = !DILocation(line: 25, column: 9, scope: !9) +!36 = !DILocation(line: 26, column: 5, scope: !37) +!37 = distinct !DILexicalBlock(scope: !38, file: !10, line: 26, column: 5) +!38 = distinct !DILexicalBlock(scope: !9, file: !10, line: 26, column: 5) +!39 = !DILocation(line: 26, column: 5, scope: !38) +!40 = !DILocation(line: 27, column: 5, scope: !41) +!41 = distinct !DILexicalBlock(scope: !42, file: !10, line: 27, column: 5) +!42 = distinct !DILexicalBlock(scope: !9, file: !10, line: 27, column: 5) +!43 = !DILocation(line: 27, column: 5, scope: !42) +!44 = !DILocation(line: 28, column: 5, scope: !45) +!45 = distinct !DILexicalBlock(scope: !46, file: !10, line: 28, column: 5) +!46 = distinct !DILexicalBlock(scope: !9, file: !10, line: 28, column: 5) +!47 = !DILocation(line: 28, column: 5, scope: !46) +!48 = !DILocation(line: 29, column: 5, scope: !49) +!49 = distinct !DILexicalBlock(scope: !50, file: !10, line: 29, column: 5) +!50 = distinct !DILexicalBlock(scope: !9, file: !10, line: 29, column: 5) +!51 = !DILocation(line: 29, column: 5, scope: !50) +!52 = !DILocation(line: 30, column: 5, scope: !9) +!53 = !DILocation(line: 30, column: 10, scope: !9) +!54 = !DILocation(line: 31, column: 5, scope: !9) +!55 = !DILocation(line: 31, column: 10, scope: !9) +!56 = !DILocation(line: 32, column: 5, scope: !9) +!57 = !DILocation(line: 32, column: 10, scope: !9) +!58 = !DILocation(line: 35, column: 20, scope: !9) +!59 = !DILocation(line: 35, column: 38, scope: !9) +!60 = !DILocation(line: 35, column: 11, scope: !9) +!61 = !DILocation(line: 35, column: 9, scope: !9) +!62 = !DILocation(line: 36, column: 5, scope: !63) +!63 = distinct !DILexicalBlock(scope: !64, file: !10, line: 36, column: 5) +!64 = distinct !DILexicalBlock(scope: !9, file: !10, line: 36, column: 5) +!65 = !DILocation(line: 36, column: 5, scope: !64) +!66 = !DILocation(line: 37, column: 5, scope: !67) +!67 = distinct !DILexicalBlock(scope: !68, file: !10, line: 37, column: 5) +!68 = distinct !DILexicalBlock(scope: !9, file: !10, line: 37, column: 5) +!69 = !DILocation(line: 37, column: 5, scope: !68) +!70 = !DILocation(line: 38, column: 5, scope: !71) +!71 = distinct !DILexicalBlock(scope: !72, file: !10, line: 38, column: 5) +!72 = distinct !DILexicalBlock(scope: !9, file: !10, line: 38, column: 5) +!73 = !DILocation(line: 38, column: 5, scope: !72) +!74 = !DILocation(line: 40, column: 5, scope: !75) +!75 = distinct !DILexicalBlock(scope: !76, file: !10, line: 40, column: 5) +!76 = distinct !DILexicalBlock(scope: !9, file: !10, line: 40, column: 5) +!77 = !DILocation(line: 40, column: 5, scope: !76) +!78 = !DILocation(line: 41, column: 5, scope: !9) +!79 = !DILocation(line: 41, column: 10, scope: !9) +!80 = !DILocation(line: 42, column: 5, scope: !9) +!81 = !DILocation(line: 42, column: 10, scope: !9) +!82 = !DILocation(line: 45, column: 20, scope: !9) +!83 = !DILocation(line: 45, column: 38, scope: !9) +!84 = !DILocation(line: 45, column: 11, scope: !9) +!85 = !DILocation(line: 45, column: 9, scope: !9) +!86 = !DILocation(line: 46, column: 5, scope: !87) +!87 = distinct !DILexicalBlock(scope: !88, file: !10, line: 46, column: 5) +!88 = distinct !DILexicalBlock(scope: !9, file: !10, line: 46, column: 5) +!89 = !DILocation(line: 46, column: 5, scope: !88) +!90 = !DILocation(line: 47, column: 5, scope: !91) +!91 = distinct !DILexicalBlock(scope: !92, file: !10, line: 47, column: 5) +!92 = distinct !DILexicalBlock(scope: !9, file: !10, line: 47, column: 5) +!93 = !DILocation(line: 47, column: 5, scope: !92) +!94 = !DILocation(line: 48, column: 5, scope: !95) +!95 = distinct !DILexicalBlock(scope: !96, file: !10, line: 48, column: 5) +!96 = distinct !DILexicalBlock(scope: !9, file: !10, line: 48, column: 5) +!97 = !DILocation(line: 48, column: 5, scope: !96) +!98 = !DILocation(line: 49, column: 5, scope: !99) +!99 = distinct !DILexicalBlock(scope: !100, file: !10, line: 49, column: 5) +!100 = distinct !DILexicalBlock(scope: !9, file: !10, line: 49, column: 5) +!101 = !DILocation(line: 49, column: 5, scope: !100) +!102 = !DILocation(line: 50, column: 5, scope: !9) +!103 = !DILocation(line: 50, column: 10, scope: !9) +!104 = !DILocation(line: 51, column: 5, scope: !9) +!105 = !DILocation(line: 51, column: 10, scope: !9) +!106 = !DILocation(line: 52, column: 5, scope: !9) +!107 = !DILocation(line: 52, column: 10, scope: !9) +!108 = !DILocation(line: 55, column: 20, scope: !9) +!109 = !DILocation(line: 55, column: 38, scope: !9) +!110 = !DILocation(line: 55, column: 11, scope: !9) +!111 = !DILocation(line: 55, column: 9, scope: !9) +!112 = !DILocation(line: 56, column: 5, scope: !113) +!113 = distinct !DILexicalBlock(scope: !114, file: !10, line: 56, column: 5) +!114 = distinct !DILexicalBlock(scope: !9, file: !10, line: 56, column: 5) +!115 = !DILocation(line: 56, column: 5, scope: !114) +!116 = !DILocation(line: 57, column: 5, scope: !117) +!117 = distinct !DILexicalBlock(scope: !118, file: !10, line: 57, column: 5) +!118 = distinct !DILexicalBlock(scope: !9, file: !10, line: 57, column: 5) +!119 = !DILocation(line: 57, column: 5, scope: !118) +!120 = !DILocation(line: 58, column: 5, scope: !121) +!121 = distinct !DILexicalBlock(scope: !122, file: !10, line: 58, column: 5) +!122 = distinct !DILexicalBlock(scope: !9, file: !10, line: 58, column: 5) +!123 = !DILocation(line: 58, column: 5, scope: !122) +!124 = !DILocation(line: 59, column: 5, scope: !125) +!125 = distinct !DILexicalBlock(scope: !126, file: !10, line: 59, column: 5) +!126 = distinct !DILexicalBlock(scope: !9, file: !10, line: 59, column: 5) +!127 = !DILocation(line: 59, column: 5, scope: !126) +!128 = !DILocation(line: 61, column: 2, scope: !9) From 28885e2bae4256cc2646cc955d93f821c67dc7a3 Mon Sep 17 00:00:00 2001 From: Thomas Haas Date: Fri, 7 Jun 2024 20:00:23 +0200 Subject: [PATCH 04/28] - Added Event.getLocalId/Event.setLocalId() (#688) - Function-based analysis and passes now rely on local ids (e.g., for loop detection) for the most part. - Fixed problems in NormalizeLoops.java --- .../program/analysis/DominatorAnalysis.java | 4 +-- .../program/analysis/LoopAnalysis.java | 2 +- .../program/event/AbstractEvent.java | 17 ++++++++-- .../dat3m/dartagnan/program/event/Event.java | 3 ++ .../program/event/lang/svcomp/EndAtomic.java | 6 ++-- .../processing/DynamicSpinLoopDetection.java | 2 +- .../program/processing/IdReassignment.java | 14 ++++++++- .../processing/LoopFormVerification.java | 2 +- .../program/processing/LoopUnrolling.java | 4 +-- .../program/processing/MemToReg.java | 6 ++-- .../program/processing/NormalizeLoops.java | 31 +++++++++---------- .../processing/RemoveDeadCondJumps.java | 2 +- .../SparseConditionalConstantPropagation.java | 2 +- .../processing/compilation/VisitorArm8.java | 2 +- .../processing/compilation/VisitorRISCV.java | 2 +- 15 files changed, 61 insertions(+), 38 deletions(-) diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/DominatorAnalysis.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/DominatorAnalysis.java index 3e62fa93a0..217e9cbb92 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/DominatorAnalysis.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/DominatorAnalysis.java @@ -18,14 +18,14 @@ public class DominatorAnalysis { public static DominatorTree computePreDominatorTree(Event from, Event to) { Preconditions.checkArgument(from.getFunction() == to.getFunction(), "Cannot compute dominator tree between events of different functions."); - final Predicate isInRange = (e -> from.getGlobalId() <= e.getGlobalId() && e.getGlobalId() <= to.getGlobalId()); + final Predicate isInRange = (e -> from.getLocalId() <= e.getLocalId() && e.getLocalId() <= to.getLocalId()); return new DominatorTree<>(from, e -> Iterables.filter(getSuccessors(e), isInRange)); } public static DominatorTree computePostDominatorTree(Event from, Event to) { Preconditions.checkArgument(from.getFunction() == to.getFunction(), "Cannot compute dominator tree between events of different functions."); - final Predicate isInRange = (e -> from.getGlobalId() <= e.getGlobalId() && e.getGlobalId() <= to.getGlobalId()); + final Predicate isInRange = (e -> from.getLocalId() <= e.getLocalId() && e.getLocalId() <= to.getLocalId()); return new DominatorTree<>(to, e -> Iterables.filter(getPredecessors(e), isInRange)); } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/LoopAnalysis.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/LoopAnalysis.java index 0bce78260e..ef3862fc55 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/LoopAnalysis.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/LoopAnalysis.java @@ -178,7 +178,7 @@ private LoopLabelInfo tryParseLoopLabel(Event eventToParse) { private ImmutableList findLoopsInFunction(Function function) { final List backJumps = function.getEvents(CondJump.class).stream() - .filter(j -> j.getLabel().getGlobalId() < j.getGlobalId()) + .filter(j -> j.getLabel().getLocalId() < j.getLocalId()) .toList(); final List loops = new ArrayList<>(); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/AbstractEvent.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/AbstractEvent.java index 6a7f0cd59d..2d2c3e4e29 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/AbstractEvent.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/AbstractEvent.java @@ -18,8 +18,9 @@ public abstract class AbstractEvent implements Event { private final MetadataMap metadataMap = new MetadataMap(); private final Set tags; private final Set currentUsers = new HashSet<>(); - // This id is dynamically changing during processing. + // These ids are dynamically changing during processing. private transient int globalId = -1; // (Global) ID within a program + private transient int localId = -1; // (Local) ID within a function private transient Function function; // The function this event belongs to private transient AbstractEvent successor; @@ -40,8 +41,12 @@ protected AbstractEvent(AbstractEvent other) { public void setGlobalId(int id) { this.globalId = id; } @Override - public Function getFunction() { return function; } + public int getLocalId() { return localId; } + @Override + public void setLocalId(int id) { this.localId = id; } + @Override + public Function getFunction() { return function; } @Override public void setFunction(Function function) { this.function = Preconditions.checkNotNull(function); @@ -263,11 +268,17 @@ public int compareTo(Event e) { return 0; } int result = Integer.compare(this.getGlobalId(), e.getGlobalId()); - if (result == 0) { + if (result == 0 && this.getGlobalId() != -1) { final String error = String.format("Events %s and %s are different but have the same global id %d", this, e, e.getGlobalId()); throw new IllegalStateException(error); } + result = (result != 0) ? result : (Integer.compare(this.getLocalId(), e.getLocalId())); + if (result == 0) { + final String error = String.format("Events %s and %s are different but have the same local id %d", + this, e, e.getLocalId()); + throw new IllegalStateException(error); + } return result; } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/Event.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/Event.java index ee302a3149..644d6c278d 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/Event.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/Event.java @@ -19,6 +19,9 @@ public interface Event extends Encoder, Comparable { int getGlobalId(); void setGlobalId(int id); + int getLocalId(); + void setLocalId(int id); + // ============================== Metadata ============================== void copyAllMetadataFrom(Event other); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/svcomp/EndAtomic.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/svcomp/EndAtomic.java index 1abfa121fc..fdf2c90254 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/svcomp/EndAtomic.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/svcomp/EndAtomic.java @@ -52,12 +52,12 @@ public void runLocalAnalysis(Program program, Context context) { private void findEnclosedEvents(BranchEquivalence eq) { enclosedEvents = new ArrayList<>(); - if (eq.areMutuallyExclusive(begin, this) || this.getGlobalId() < begin.getGlobalId()) { - logger.warn("BeginAtomic" + begin.getGlobalId() + "can't reach EndAtomic " + this.getGlobalId()); + if (eq.areMutuallyExclusive(begin, this) || this.getLocalId() < begin.getLocalId()) { + logger.warn("BeginAtomic" + begin.getLocalId() + "can't reach EndAtomic " + this.getLocalId()); } Event e = begin.getSuccessor(); - while (e.getGlobalId() < this.getGlobalId()) { + while (e.getLocalId() < this.getLocalId()) { if (!eq.areMutuallyExclusive(begin, e)) { if (!eq.isImplied(e, begin)) { logger.warn(e + " is inside atomic block but can be reached from the outside"); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/DynamicSpinLoopDetection.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/DynamicSpinLoopDetection.java index 82133c32bf..1c65201ce4 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/DynamicSpinLoopDetection.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/DynamicSpinLoopDetection.java @@ -233,7 +233,7 @@ private LoopData(LoopAnalysis.LoopInfo loopInfo) { @Override public String toString() { return String.format("(%d: %s) --to--> (%d: %s)", - getStart().getGlobalId(), getStart(), getEnd().getGlobalId(), getEnd()); + getStart().getLocalId(), getStart(), getEnd().getLocalId(), getEnd()); } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/IdReassignment.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/IdReassignment.java index 4387cabb34..56abe0815f 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/IdReassignment.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/IdReassignment.java @@ -5,7 +5,7 @@ import com.dat3m.dartagnan.program.event.Event; import com.google.common.collect.Iterables; -public class IdReassignment implements ProgramProcessor { +public class IdReassignment implements ProgramProcessor, FunctionProcessor { private IdReassignment() {} @@ -20,10 +20,22 @@ public void run(Program program) { for (Function func : Iterables.concat(program.getThreads(), program.getFunctions())) { func.setId(funcId++); Event cur = func.getEntry(); + int localId = 0; while (cur != null) { + cur.setLocalId(localId++); cur.setGlobalId(globalId++); cur = cur.getSuccessor(); } } } + + @Override + public void run(Function function) { + Event cur = function.getEntry(); + int localId = 0; + while (cur != null) { + cur.setLocalId(localId++); + cur = cur.getSuccessor(); + } + } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/LoopFormVerification.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/LoopFormVerification.java index b841932d08..392ead9122 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/LoopFormVerification.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/LoopFormVerification.java @@ -41,7 +41,7 @@ public static LoopFormVerification fromConfig(Configuration config) { @Override public void run(Program program) { final int numberOfLoops = Stream.concat(program.getThreads().stream(), program.getFunctions().stream()) - .mapToInt(f -> checkAndCountLoops(f, Event::getGlobalId)).sum(); + .mapToInt(f -> checkAndCountLoops(f, Event::getLocalId)).sum(); logger.info("Detected {} loops in the program.", numberOfLoops); } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/LoopUnrolling.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/LoopUnrolling.java index ddd01311f6..7b6bca60a9 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/LoopUnrolling.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/LoopUnrolling.java @@ -107,7 +107,7 @@ private Map computeLoopBoundsMap(Function func, int defaultBo curBoundAnnotation = boundAnnotation; } else if (event instanceof Label label) { final Optional backjump = label.getJumpSet().stream() - .filter(j -> j.getGlobalId() > label.getGlobalId()).findFirst(); + .filter(j -> j.getLocalId() > label.getLocalId()).findFirst(); final boolean isLoop = backjump.isPresent(); if (isLoop) { @@ -125,7 +125,7 @@ private Map computeLoopBoundsMap(Function func, int defaultBo private void unrollLoop(CondJump loopBackJump, int bound) { final Label loopBegin = loopBackJump.getLabel(); Preconditions.checkArgument(bound >= 1, "Positive unrolling bound expected."); - Preconditions.checkArgument(loopBegin.getGlobalId() < loopBackJump.getGlobalId(), + Preconditions.checkArgument(loopBegin.getLocalId() < loopBackJump.getLocalId(), "The jump does not belong to a loop."); int iterCounter = 0; diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/MemToReg.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/MemToReg.java index e972bfcb38..a90bf2970d 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/MemToReg.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/MemToReg.java @@ -258,8 +258,8 @@ public Label visitStore(Store store) { @Override public Label visitLabel(Label label) { - final int globalId = label.getGlobalId(); - final boolean looping = label.getJumpSet().stream().anyMatch(jump -> globalId < jump.getGlobalId()); + final int localId = label.getLocalId(); + final boolean looping = label.getJumpSet().stream().anyMatch(jump -> localId < jump.getLocalId()); final Map restoredState = looping ? jumps.get(label) : jumps.remove(label); if (restoredState != null) { if (dead) { @@ -284,7 +284,7 @@ public Label visitCondJump(CondJump jump) { // Give up on every address used in the condition. publishRegisters(jump.getGuard().getRegs()); final Label label = jump.getLabel(); - final boolean looping = label.getGlobalId() < jump.getGlobalId(); + final boolean looping = label.getLocalId() < jump.getLocalId(); final boolean isGoto = jump.isGoto(); assert !looping || jumps.containsKey(label); // Prepare the current state for continuing from the label. diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/NormalizeLoops.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/NormalizeLoops.java index 512163f39a..62e4b1ef18 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/NormalizeLoops.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/NormalizeLoops.java @@ -44,33 +44,30 @@ public void run(Function function) { int counter = 0; for (Label label : function.getEvents(Label.class)) { final List backJumps = label.getJumpSet().stream() - .filter(j -> j.getGlobalId() > label.getGlobalId()) + .filter(j -> j.getLocalId() > label.getLocalId()) .sorted() .toList(); // LoopFormVerification requires a unique and unconditional backjump - if (backJumps.size() > 0) { - - // We can skip if already satisfied - if (backJumps.size() == 1 && backJumps.get(0).isGoto()) { - return; - } + if (backJumps.isEmpty() || (backJumps.size() == 1 && backJumps.get(0).isGoto())) { + continue; + } - final CondJump last = backJumps.get(backJumps.size() - 1); + final CondJump last = backJumps.get(backJumps.size() - 1); - final Label forwardLabel = EventFactory.newLabel("__repeatLoop_#" + counter); - final CondJump gotoRepeat = EventFactory.newGoto(label); + final Label forwardLabel = EventFactory.newLabel("__repeatLoop_#" + counter); + final CondJump gotoRepeat = EventFactory.newGoto(label); - final Label breakLabel = EventFactory.newLabel("__breakLoop_#" + counter); - final CondJump gotoBreak = EventFactory.newGoto(breakLabel); + final Label breakLabel = EventFactory.newLabel("__breakLoop_#" + counter); + final CondJump gotoBreak = EventFactory.newGoto(breakLabel); - last.insertAfter(List.of(gotoBreak, forwardLabel, gotoRepeat, breakLabel)); + last.insertAfter(List.of(gotoBreak, forwardLabel, gotoRepeat, breakLabel)); - for(CondJump j : backJumps) { - j.updateReferences(Map.of(j.getLabel(), forwardLabel)); - } + for(CondJump j : backJumps) { + j.updateReferences(Map.of(j.getLabel(), forwardLabel)); } + + counter++; } - counter++; } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/RemoveDeadCondJumps.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/RemoveDeadCondJumps.java index dc3b113e24..5da9e12c4e 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/RemoveDeadCondJumps.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/RemoveDeadCondJumps.java @@ -102,7 +102,7 @@ private void eliminateDeadCondJumps(Function function) { label.getJumpSet().forEach(Event::tryDelete); } if (!cur.tryDelete()) { - logger.warn("Failed to delete event: {}: {}", cur.getGlobalId(), cur); + logger.warn("Failed to delete event: {}: {}", cur.getLocalId(), cur); } } if (cur instanceof CondJump jump && jump.isGoto()) { diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/SparseConditionalConstantPropagation.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/SparseConditionalConstantPropagation.java index be24dd334d..a0242575dc 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/SparseConditionalConstantPropagation.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/SparseConditionalConstantPropagation.java @@ -170,7 +170,7 @@ public void run(Function func) { } final Set failedToDelete = IRHelper.bulkDelete(toBeDeleted); for (Event e : failedToDelete) { - logger.warn("Failed to delete unreachable event: {}: {}", e.getGlobalId(), e); + logger.warn("Failed to delete unreachable event: {}: {}", e.getLocalId(), e); } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorArm8.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorArm8.java index b96b0e2a64..3321e9a9e3 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorArm8.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorArm8.java @@ -212,7 +212,7 @@ public List visitAtomicCmpXchg(AtomicCmpXchg e) { ExecutionStatus optionalExecStatus = null; Local optionalUpdateCasCmpResult = null; if (e.isWeak()) { - Register statusReg = e.getFunction().newRegister("status(" + e.getGlobalId() + ")", types.getBooleanType()); + Register statusReg = e.getFunction().newRegister("status(" + e.getLocalId() + ")", types.getBooleanType()); optionalExecStatus = newExecutionStatus(statusReg, storeValue); optionalUpdateCasCmpResult = newLocal(booleanResultRegister, expressions.makeNot(statusReg)); } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorRISCV.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorRISCV.java index 845f3c865d..f063584c51 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorRISCV.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorRISCV.java @@ -234,7 +234,7 @@ public List visitAtomicCmpXchg(AtomicCmpXchg e) { CondJump gotoCasEnd = newGoto(casEnd); Load loadValue = newRMWLoadExclusiveWithMo(regValue, address, Tag.RISCV.extractLoadMoFromCMo(mo)); Store storeValue = RISCV.newRMWStoreConditional(address, value, Tag.RISCV.extractStoreMoFromCMo(mo), e.isStrong()); - Register statusReg = e.getFunction().newRegister("status(" + e.getGlobalId() + ")", types.getBooleanType()); + Register statusReg = e.getFunction().newRegister("status(" + e.getLocalId() + ")", types.getBooleanType()); // We normally make the following two events optional. // Here we make them mandatory to guarantee correct dependencies. ExecutionStatus execStatus = newExecutionStatusWithDependencyTracking(statusReg, storeValue); From 929b15b578baa9a0cff858ee49c892da36866e03 Mon Sep 17 00:00:00 2001 From: Hernan Ponce de Leon Date: Fri, 7 Jun 2024 21:04:30 +0200 Subject: [PATCH 05/28] Add support for cttz (count trailing zeros) intrinsic (#689) Signed-off-by: Hernan Ponce de Leon --- benchmarks/c/miscellaneous/cttz.c | 22 +++++++++++++++++++ .../dartagnan/encoding/ExpressionEncoder.java | 19 ++++++++++++++-- .../expression/ExpressionFactory.java | 4 ++++ .../expression/integers/IntUnaryOp.java | 3 ++- .../expression/processing/ExprSimplifier.java | 1 + .../expression/utils/IntegerHelper.java | 12 ++++++++++ .../program/processing/Intrinsics.java | 21 +++++++++++++++++- 7 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 benchmarks/c/miscellaneous/cttz.c diff --git a/benchmarks/c/miscellaneous/cttz.c b/benchmarks/c/miscellaneous/cttz.c new file mode 100644 index 0000000000..7f92ae7a16 --- /dev/null +++ b/benchmarks/c/miscellaneous/cttz.c @@ -0,0 +1,22 @@ +#include +#include + +volatile int32_t x = INT32_MAX+1; +volatile int32_t y = INT32_MAX-1; +volatile int32_t z = 1; +volatile int32_t u; + +int main() +{ + // x = 1000 0000 0000 0000 0000 0000 0000 0000 + u = __builtin_ctz(x); + assert(u == 31); + // y = 1111 1111 1111 1111 1111 1111 1111 1110 + u = __builtin_ctz(y); + assert(u == 1); + // z = 0000 0000 0000 0000 0000 0000 0000 0001 + u = __builtin_ctz(z); + assert(u == 0); + + return 0; +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/ExpressionEncoder.java b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/ExpressionEncoder.java index 57e56d2cce..c60b88c542 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/ExpressionEncoder.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/ExpressionEncoder.java @@ -240,11 +240,11 @@ public Formula visitIntUnaryExpression(IntUnaryExpr iUn) { case CTLZ -> { if (inner instanceof BitvectorFormula bv) { BitvectorFormulaManager bvmgr = bitvectorFormulaManager(); - // enc = extract(bv, 63, 63) == 1 ? 0 : (extract(bv, 62, 62) == 1 ? 1 : extract ... extract(bv, 0, 0) ? 63 : 64) + // enc = extract(bv, 63, 63) == 1 ? 0 : (extract(bv, 62, 62) == 1 ? 1 : extract ... extract(bv, 0, 0) == 1 ? 63 : 64) int bvLength = bvmgr.getLength(bv); BitvectorFormula bv1 = bvmgr.makeBitvector(1, 1); BitvectorFormula enc = bvmgr.makeBitvector(bvLength, bvLength); - for(int i = bvmgr.getLength(bv) - 1; i >= 0; i--) { + for(int i = bvLength - 1; i >= 0; i--) { BitvectorFormula bvi = bvmgr.makeBitvector(bvLength, i); BitvectorFormula bvbit = bvmgr.extract(bv, bvLength - (i + 1), bvLength - (i + 1)); enc = booleanFormulaManager.ifThenElse(bvmgr.equal(bvbit, bv1), bvi, enc); @@ -252,6 +252,21 @@ public Formula visitIntUnaryExpression(IntUnaryExpr iUn) { return enc; } } + case CTTZ -> { + if (inner instanceof BitvectorFormula bv) { + BitvectorFormulaManager bvmgr = bitvectorFormulaManager(); + // enc = extract(bv, 0, 0) == 1 ? 0 : (extract(bv, 1, 1) == 1 ? 1 : extract ... extract(bv, 63, 63) == 1? 63 : 64) + int bvLength = bvmgr.getLength(bv); + BitvectorFormula bv1 = bvmgr.makeBitvector(1, 1); + BitvectorFormula enc = bvmgr.makeBitvector(bvLength, bvLength); + for(int i = bvLength - 1; i >= 0; i--) { + BitvectorFormula bvi = bvmgr.makeBitvector(bvLength, i); + BitvectorFormula bvbit = bvmgr.extract(bv, i, i); + enc = booleanFormulaManager.ifThenElse(bvmgr.equal(bvbit, bv1), bvi, enc); + } + return enc; + } + } } throw new UnsupportedOperationException( String.format("Encoding of (%s) %s %s not supported.", iUn.getType(), iUn.getKind(), inner)); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/ExpressionFactory.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/ExpressionFactory.java index e71126958a..b81a40ff62 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/ExpressionFactory.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/ExpressionFactory.java @@ -122,6 +122,10 @@ public Expression makeCTLZ(Expression operand) { return makeIntUnary(IntUnaryOp.CTLZ, operand); } + public Expression makeCTTZ(Expression operand) { + return makeIntUnary(IntUnaryOp.CTTZ, operand); + } + public Expression makeAdd(Expression leftOperand, Expression rightOperand) { return makeIntBinary(leftOperand, IntBinaryOp.ADD, rightOperand); } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/integers/IntUnaryOp.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/integers/IntUnaryOp.java index 00c767ad51..74bda4371a 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/integers/IntUnaryOp.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/integers/IntUnaryOp.java @@ -3,7 +3,7 @@ import com.dat3m.dartagnan.expression.ExpressionKind; public enum IntUnaryOp implements ExpressionKind { - CTLZ, MINUS; + CTLZ, CTTZ, MINUS; @Override public String toString() { @@ -14,6 +14,7 @@ public String toString() { public String getSymbol() { return switch (this) { case CTLZ -> "ctlz "; + case CTTZ -> "cttz "; case MINUS -> "-"; }; } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/processing/ExprSimplifier.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/processing/ExprSimplifier.java index af74fd75e6..d2ad08b8ac 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/processing/ExprSimplifier.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/processing/ExprSimplifier.java @@ -201,6 +201,7 @@ public Expression visitIntUnaryExpression(IntUnaryExpr expr) { final BigInteger newValue = switch (expr.getKind()) { case MINUS -> IntegerHelper.neg(lit.getValue(), bitWidth); case CTLZ -> IntegerHelper.ctlz(lit.getValue(), bitWidth); + case CTTZ -> IntegerHelper.cttz(lit.getValue(), bitWidth); }; return expressions.makeValue(newValue, expr.getType()); } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/utils/IntegerHelper.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/utils/IntegerHelper.java index 153bce578a..07009816e9 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/utils/IntegerHelper.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/utils/IntegerHelper.java @@ -205,4 +205,16 @@ public static BigInteger ctlz(BigInteger x, int bitWidth) { return BigInteger.valueOf(leadingZeroes); } + public static BigInteger cttz(BigInteger x, int bitWidth) { + int trailingZeroes = 0; + for (int i = 0; i < bitWidth; i++) { + if (!x.testBit(i)) { + trailingZeroes++; + } else { + break; + } + } + return BigInteger.valueOf(trailingZeroes); + } + } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java index d5efbf529d..bc2820e93a 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java @@ -190,7 +190,7 @@ public enum Info { LLVM(List.of("llvm.smax", "llvm.umax", "llvm.smin", "llvm.umin", "llvm.ssub.sat", "llvm.usub.sat", "llvm.sadd.sat", "llvm.uadd.sat", // TODO: saturated shifts "llvm.sadd.with.overflow", "llvm.ssub.with.overflow", "llvm.smul.with.overflow", - "llvm.ctlz", "llvm.ctpop"), + "llvm.ctlz", "llvm.cttz", "llvm.ctpop"), false, false, true, true, Intrinsics::handleLLVMIntrinsic), LLVM_ASSUME("llvm.assume", false, false, true, true, Intrinsics::inlineLLVMAssume), LLVM_META(List.of("llvm.stacksave", "llvm.stackrestore", "llvm.lifetime"), false, false, true, true, Intrinsics::inlineAsZero), @@ -930,6 +930,8 @@ private List handleLLVMIntrinsic(FunctionCall call) { if (name.startsWith("llvm.ctlz")) { return inlineLLVMCtlz(valueCall); + } else if (name.startsWith("llvm.cttz")) { + return inlineLLVMCtlz(valueCall); } else if (name.startsWith("llvm.ctpop")) { return inlineLLVMCtpop(valueCall); } else if (name.contains("add.sat")) { @@ -981,6 +983,23 @@ private List inlineLLVMCtlz(ValueFunctionCall call) { return List.of(assignment); } + private List inlineLLVMCttz(ValueFunctionCall call) { + //see https://llvm.org/docs/LangRef.html#llvm-cttz-intrinsic + checkArgument(call.getArguments().size() == 2, + "Expected 2 parameters for \"llvm.cttz\", got %s.", call.getArguments().size()); + final Expression input = call.getArguments().get(0); + // TODO: Handle the second parameter as well + final Register resultReg = call.getResultRegister(); + final Type type = resultReg.getType(); + checkArgument(resultReg.getType() instanceof IntegerType, + "Non-integer %s type for \"llvm.cttz\".", type); + checkArgument(input.getType().equals(type), + "Return type %s of \"llvm.cttz\" must match argument type %s.", type, input.getType()); + final Expression resultExpression = expressions.makeCTTZ(input); + final Event assignment = EventFactory.newLocal(resultReg, resultExpression); + return List.of(assignment); + } + private List inlineLLVMCtpop(ValueFunctionCall call) { //see https://llvm.org/docs/LangRef.html#llvm-ctpop-intrinsic final Expression input = call.getArguments().get(0); From 1afd20894c68a4adf8489c3d1adc6ed214bccf17 Mon Sep 17 00:00:00 2001 From: Thomas Haas Date: Wed, 12 Jun 2024 14:49:46 +0200 Subject: [PATCH 06/28] Fix addresses in witnesses (#692) * Added memory layout information to ExecutionModel. * Fixed ExecutionGraphVisualizer printing odd addresses sometimes. * Fix address string computation. * Added better out-of-bounds tagging. * Fixed RefinementSolver.analyzeInconclusiveness. --- .../verification/model/ExecutionModel.java | 22 ++++++- .../solving/RefinementSolver.java | 66 +++++++++---------- .../graphviz/ExecutionGraphVisualizer.java | 58 ++++++++++------ 3 files changed, 87 insertions(+), 59 deletions(-) diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/verification/model/ExecutionModel.java b/dartagnan/src/main/java/com/dat3m/dartagnan/verification/model/ExecutionModel.java index 23ebcb10af..c22bb47dbf 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/verification/model/ExecutionModel.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/verification/model/ExecutionModel.java @@ -10,6 +10,7 @@ import com.dat3m.dartagnan.program.event.lang.svcomp.BeginAtomic; import com.dat3m.dartagnan.program.event.lang.svcomp.EndAtomic; import com.dat3m.dartagnan.program.filter.Filter; +import com.dat3m.dartagnan.program.memory.MemoryObject; import com.dat3m.dartagnan.utils.dependable.DependencyGraph; import com.dat3m.dartagnan.verification.VerificationTask; import com.dat3m.dartagnan.wmm.Wmm; @@ -53,6 +54,7 @@ public class ExecutionModel { // The event list is sorted lexicographically by (threadID, cID) private final ArrayList eventList; private final ArrayList threadList; + private final Map memoryLayoutMap; private final Map> threadEventsMap; private final Map>> atomicBlocksMap; private final Map readWriteMap; @@ -72,6 +74,7 @@ public class ExecutionModel { // The following are a read-only views which get passed to the outside private List eventListView; private List threadListView; + private Map memoryLayoutMapView; private Map> threadEventsMapView; private Map>> atomicBlocksMapView; private Map readWriteMapView; @@ -93,6 +96,7 @@ private ExecutionModel(EncodingContext c) { eventList = new ArrayList<>(100); threadList = new ArrayList<>(getProgram().getThreads().size()); threadEventsMap = new HashMap<>(getProgram().getThreads().size() * 4/3, 0.75f); + memoryLayoutMap = new HashMap<>(); atomicBlocksMap = new HashMap<>(); readWriteMap = new HashMap<>(); writeReadsMap = new HashMap<>(); @@ -116,6 +120,7 @@ public static ExecutionModel withContext(EncodingContext context) throws Invalid private void createViews() { eventListView = Collections.unmodifiableList(eventList); threadListView = Collections.unmodifiableList(threadList); + memoryLayoutMapView = Collections.unmodifiableMap(memoryLayoutMap); threadEventsMapView = Collections.unmodifiableMap(threadEventsMap); atomicBlocksMapView = Collections.unmodifiableMap(atomicBlocksMap); readWriteMapView = Collections.unmodifiableMap(readWriteMap); @@ -166,7 +171,8 @@ public List getEventList() { public List getThreads() { return threadListView; } - + + public Map getMemoryLayoutMap() { return memoryLayoutMapView; } public Map> getThreadEventsMap() { return threadEventsMapView; } @@ -218,12 +224,13 @@ public void initialize(Model model, boolean extractCoherences) { public void initialize(Model model, Filter eventFilter, boolean extractCoherences) { // We populate here, instead of on construction, // to reuse allocated data structures (since these data structures already adapted - // their capacity in previous iterations and thus we should have less overhead in future populations) + // their capacity in previous iterations, and thus we should have less overhead in future populations) // However, for all intents and purposes, this serves as a constructor. this.model = model; this.eventFilter = eventFilter; this.extractCoherences = extractCoherences; extractEventsFromModel(); + extractMemoryLayout(); extractReadsFrom(); coherenceMap.clear(); if (extractCoherences) { @@ -484,6 +491,17 @@ private void trackDependencies(Event e) { // =================================================== + private void extractMemoryLayout() { + memoryLayoutMap.clear(); + for (MemoryObject obj : getProgram().getMemory().getObjects()) { + final boolean isAllocated = obj.isStaticallyAllocated() || isTrue(encodingContext.execution(obj.getAllocationSite())); + if (isAllocated) { + final BigInteger address = (BigInteger) model.evaluate(encodingContext.encodeFinalExpression(obj)); + memoryLayoutMap.put(obj, address); + } + } + } + private void extractReadsFrom() { final EncodingContext.EdgeEncoder rf = encodingContext.edge(encodingContext.getTask().getMemoryModel().getRelation(RF)); readWriteMap.clear(); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/verification/solving/RefinementSolver.java b/dartagnan/src/main/java/com/dat3m/dartagnan/verification/solving/RefinementSolver.java index 985129b400..bebb12fd78 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/verification/solving/RefinementSolver.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/verification/solving/RefinementSolver.java @@ -47,10 +47,10 @@ import org.sosy_lab.common.configuration.Options; import org.sosy_lab.java_smt.api.*; +import java.math.BigInteger; import java.text.DecimalFormat; import java.util.*; import java.util.function.BiPredicate; -import java.util.function.Predicate; import java.util.stream.Collectors; import static com.dat3m.dartagnan.GlobalSettings.REFINEMENT_GENERATE_GRAPHVIZ_DEBUG_FILES; @@ -241,7 +241,7 @@ private void runInternal(SolverContext ctx, ProverEnvironment prover, Verificati if (smtStatus == SMTStatus.UNKNOWN) { // Refinement got no result (should not be able to happen), so we cannot proceed further. logger.warn("Refinement procedure was inconclusive. Trying to find reason of inconclusiveness."); - analyzeInconclusiveness(task, propertyTrace, analysisContext); + analyzeInconclusiveness(task, analysisContext, solver.getExecution()); throw new RuntimeException("Terminated verification due to inconclusiveness (bug?)."); } @@ -312,7 +312,7 @@ private void runInternal(SolverContext ctx, ProverEnvironment prover, Verificati logger.info("Verification finished with result " + res); } - private void analyzeInconclusiveness(VerificationTask task, RefinementTrace propertyTrace, Context analysisContext) { + private void analyzeInconclusiveness(VerificationTask task, Context analysisContext, ExecutionModel model) { final AliasAnalysis alias = analysisContext.get(AliasAnalysis.class); if (alias == null) { return; @@ -322,44 +322,38 @@ private void analyzeInconclusiveness(VerificationTask task, RefinementTrace prop synContext = newInstance(task.getProgram()); } - final DNF lastReasons = propertyTrace.getFinalIteration().inconsistencyReasons; - for (Conjunction reason : lastReasons.getCubes()) { - for (CoreLiteral literal : reason.getLiterals()) { - if (literal instanceof RelLiteral relLit && doesViolateAliasingRules(relLit, alias)) { - final Event e1 = relLit.getSource(); - final Event e2 = relLit.getTarget(); - - final StringBuilder builder = new StringBuilder(); - builder.append("Found unexpected aliasing between:\n"); - builder.append("\t") - .append(synContext.getSourceLocationWithContext(e1, true)) - .append("\n") - .append("AND\n") - .append("\t") - .append(synContext.getSourceLocationWithContext(e2, true)) - .append("\n"); - builder.append("Possible out-of-bounds access in source code or error in alias analysis."); - - logger.warn(builder.toString()); - return; + final Map> addr2Events = new HashMap<>(); + model.getAddressReadsMap().forEach((addr, reads) -> addr2Events.computeIfAbsent(addr, key -> new HashSet<>()).addAll(reads)); + model.getAddressWritesMap().forEach((addr, writes) -> addr2Events.computeIfAbsent(addr, key -> new HashSet<>()).addAll(writes)); + model.getAddressInitMap().forEach((addr, init) -> addr2Events.computeIfAbsent(addr, key -> new HashSet<>()).add(init)); + + for (Set sameLocEvents : addr2Events.values()) { + final List events = sameLocEvents.stream().sorted().toList(); + + for (int i = 0; i < events.size() - 1; i++) { + for (int j = i + 1; j < events.size(); j++) { + final MemoryCoreEvent e1 = (MemoryCoreEvent) events.get(i).getEvent(); + final MemoryCoreEvent e2 = (MemoryCoreEvent) events.get(j).getEvent(); + if (!alias.mayAlias(e1, e2)) { + final StringBuilder builder = new StringBuilder(); + builder.append("Found unexpected aliasing between:\n"); + builder.append("\t") + .append(synContext.getSourceLocationWithContext(e1, true)) + .append("\n") + .append("AND\n") + .append("\t") + .append(synContext.getSourceLocationWithContext(e2, true)) + .append("\n"); + builder.append("Possible out-of-bounds access in source code or error in alias analysis."); + + logger.warn(builder.toString()); + return; + } } } } } - private boolean doesViolateAliasingRules(RelLiteral lit, AliasAnalysis alias) { - final Predicate isMemRel = r -> r.getDefinition() instanceof ReadFrom - || r.getDefinition() instanceof Coherence; - - if (lit.isPositive() && isMemRel.test(lit.getRelation())) { - final MemoryCoreEvent e1 = (MemoryCoreEvent) lit.getSource(); - final MemoryCoreEvent e2 = (MemoryCoreEvent) lit.getTarget(); - return !alias.mayAlias(e1, e2); - } else { - return false; - } - } - // ================================================================================================================ // Refinement core algorithm diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/witness/graphviz/ExecutionGraphVisualizer.java b/dartagnan/src/main/java/com/dat3m/dartagnan/witness/graphviz/ExecutionGraphVisualizer.java index 0bd5707727..372ca3e900 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/witness/graphviz/ExecutionGraphVisualizer.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/witness/graphviz/ExecutionGraphVisualizer.java @@ -1,12 +1,10 @@ package com.dat3m.dartagnan.witness.graphviz; -import com.dat3m.dartagnan.expression.Expression; -import com.dat3m.dartagnan.program.Register; import com.dat3m.dartagnan.program.Thread; import com.dat3m.dartagnan.program.analysis.SyntacticContextAnalysis; import com.dat3m.dartagnan.program.event.Tag; -import com.dat3m.dartagnan.program.event.core.MemoryCoreEvent; import com.dat3m.dartagnan.program.event.metadata.MemoryOrder; +import com.dat3m.dartagnan.program.memory.MemoryObject; import com.dat3m.dartagnan.verification.model.EventData; import com.dat3m.dartagnan.verification.model.ExecutionModel; import org.apache.logging.log4j.LogManager; @@ -17,9 +15,7 @@ import java.io.IOException; import java.io.Writer; import java.math.BigInteger; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.function.BiPredicate; import static com.dat3m.dartagnan.program.analysis.SyntacticContextAnalysis.*; @@ -38,7 +34,7 @@ public class ExecutionGraphVisualizer { private BiPredicate rfFilter = (x, y) -> true; private BiPredicate frFilter = (x, y) -> true; private BiPredicate coFilter = (x, y) -> true; - private final Map addresses = new HashMap<>(); + private final LinkedHashMap objToAddrMap = new LinkedHashMap<>(); public ExecutionGraphVisualizer() { this.graphviz = new Graphviz(); @@ -66,15 +62,7 @@ public ExecutionGraphVisualizer setCoherenceFilter(BiPredicate memLayout = model.getMemoryLayoutMap(); + final List objs = new ArrayList<>(memLayout.keySet()); + objs.sort(Comparator.comparing(memLayout::get)); + + for (MemoryObject obj : objs) { + objToAddrMap.put(obj, memLayout.get(obj)); + } + } + private boolean ignore(EventData e) { return false; // We ignore no events for now. } @@ -188,18 +186,36 @@ private ExecutionGraphVisualizer addThreadPo(Thread thread, ExecutionModel model return this; } + private String getAddressString(BigInteger address) { + MemoryObject obj = null; + BigInteger objAddress = null; + for (Map.Entry entry : objToAddrMap.entrySet()) { + final BigInteger nextObjAddr = entry.getValue(); + if (nextObjAddr.compareTo(address) > 0) { + break; + } + obj = entry.getKey(); + objAddress = nextObjAddr; + } + + if (obj == null) { + return address + " [OOB]"; + } else if (address.equals(objAddress)) { + return obj.toString(); + } else { + final boolean isOOB = address.compareTo(objAddress.add(BigInteger.valueOf(obj.size()))) >= 0; + return String.format("%s + %s%s", obj, address.subtract(objAddress), isOOB ? " [OOB]" : ""); + } + } private String eventToNode(EventData e) { if (e.isInit()) { - return String.format("\"I(%s, %d)\"", addresses.get(e.getAccessedAddress()), e.getValue()); + return String.format("\"I(%s, %d)\"", getAddressString(e.getAccessedAddress()), e.getValue()); } // We have MemEvent + Fence String tag = e.getEvent().toString(); if (e.isMemoryEvent()) { - Object address = addresses.get(e.getAccessedAddress()); - if (address == null) { - address = e.getAccessedAddress(); - } + String address = getAddressString(e.getAccessedAddress()); BigInteger value = e.getValue(); MemoryOrder mo = e.getEvent().getMetadata(MemoryOrder.class); String moString = mo == null ? "" : ", " + mo.value(); From 6c8baa3bb53c23cce97947d5f2d3ebb6ebbe4835 Mon Sep 17 00:00:00 2001 From: Thomas Haas Date: Wed, 12 Jun 2024 19:58:15 +0200 Subject: [PATCH 07/28] Fix size and offset computations of types (#691) --- benchmarks/c/miscellaneous/offsetof.c | 28 ++++++ .../dartagnan/encoding/EncodingContext.java | 2 +- .../expression/type/TypeFactory.java | 36 ++----- .../dartagnan/expression/type/TypeLayout.java | 59 ++++++++++++ .../dartagnan/expression/type/TypeOffset.java | 43 +++++++++ .../parsers/program/visitors/VisitorLlvm.java | 13 ++- .../program/processing/GEPToAddition.java | 15 +-- .../dat3m/dartagnan/c/MiscellaneousTest.java | 3 +- .../test/resources/miscellaneous/offsetof.ll | 95 +++++++++++++++++++ 9 files changed, 247 insertions(+), 47 deletions(-) create mode 100644 benchmarks/c/miscellaneous/offsetof.c create mode 100644 dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeLayout.java create mode 100644 dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeOffset.java create mode 100644 dartagnan/src/test/resources/miscellaneous/offsetof.ll diff --git a/benchmarks/c/miscellaneous/offsetof.c b/benchmarks/c/miscellaneous/offsetof.c new file mode 100644 index 0000000000..14c4875cec --- /dev/null +++ b/benchmarks/c/miscellaneous/offsetof.c @@ -0,0 +1,28 @@ +#include +#include + +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)((char *)__mptr - offsetof(type,member));}) + +typedef struct { + int x; // 4 byte padding + struct { + long a; + char b; // 7 byte padding + }; + int z; // 4 byte padding +} myStruct_t; // Total size: 32 bytes, because all 4 members are 8-byte aligned + +myStruct_t myStruct; + +int main() +{ + // These assertions are trivialized by the compiler even without any opt passes + __VERIFIER_assert(sizeof(myStruct_t) == 32); + __VERIFIER_assert(offsetof(myStruct_t, z) == 24); + + // This is not trivialized without optimizations (some standard opt passes can trivialize this though) + myStruct_t *container = container_of(&myStruct.z, myStruct_t, z); + __VERIFIER_assert(container == &myStruct); +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/EncodingContext.java b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/EncodingContext.java index 9e1b747e66..4f85b90d81 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/EncodingContext.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/EncodingContext.java @@ -219,7 +219,7 @@ public Formula lastValue(MemoryObject base, int offset) { //TODO match this with the actual type stored at the memory address // (we do not know and guess the arch type right now) TypeFactory types = TypeFactory.getInstance(); - int archSize = types.getMemorySizeInBytes(types.getArchType()) * 8; + final int archSize = types.getMemorySizeInBits(types.getArchType()); return formulaManager.getBitvectorFormulaManager().makeVariable(archSize, name); } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeFactory.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeFactory.java index aa7c3a4561..37a476cb72 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeFactory.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeFactory.java @@ -2,9 +2,7 @@ import com.dat3m.dartagnan.expression.Type; import com.dat3m.dartagnan.utils.Normalizer; -import com.google.common.math.IntMath; -import java.math.RoundingMode; import java.util.List; import static com.google.common.base.Preconditions.checkArgument; @@ -86,30 +84,14 @@ public IntegerType getByteType() { } public int getMemorySizeInBytes(Type type) { - final int sizeInBytes; - if (type instanceof ArrayType arrayType) { - sizeInBytes = arrayType.getNumElements() * getMemorySizeInBytes(arrayType.getElementType()); - } else if (type instanceof AggregateType aggregateType) { - int aggregateSize = 0; - for (Type fieldType : aggregateType.getDirectFields()) { - int size = getMemorySizeInBytes(fieldType); - //FIXME: We assume for now that a small type's (<= 8 byte) alignment coincides with its size. - // For all larger types, we assume 8 byte alignment - int alignment = Math.min(size, 8); - if (size != 0) { - int padding = (-aggregateSize) % alignment; - padding = padding < 0 ? padding + alignment : padding; - aggregateSize += size + padding; - } - } - sizeInBytes = aggregateSize; - } else if (type instanceof IntegerType integerType) { - sizeInBytes = IntMath.divide(integerType.getBitWidth(), 8, RoundingMode.CEILING); - } else if (type instanceof FloatType floatType) { - sizeInBytes = IntMath.divide(floatType.getBitWidth(), 8, RoundingMode.CEILING); - } else { - throw new UnsupportedOperationException("Cannot compute the size of " + type); - } - return sizeInBytes; + return TypeLayout.of(type).totalSizeInBytes(); + } + + public int getMemorySizeInBits(Type type) { + return getMemorySizeInBytes(type) * 8; + } + + public int getOffsetInBytes(Type type, int index) { + return TypeOffset.of(type, index).offset(); } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeLayout.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeLayout.java new file mode 100644 index 0000000000..7b9d47e498 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeLayout.java @@ -0,0 +1,59 @@ +package com.dat3m.dartagnan.expression.type; + +import com.dat3m.dartagnan.expression.Type; +import com.google.common.math.IntMath; + +import java.math.RoundingMode; + +public record TypeLayout(int unpaddedSize, int alignment) { + + public int totalSizeInBytes() { return paddedSize(unpaddedSize, alignment); } + + @Override + public String toString() { + return String.format("[totalSize = %s bytes, unpaddedSize = %s bytes, alignment = %s bytes]", + totalSizeInBytes(), unpaddedSize(), alignment()); + } + + public static TypeLayout of(Type type) { + final int unpaddedSize; + final int alignment; + + // For primitives, we assume that size and alignment requirement coincide + if (type instanceof IntegerType integerType) { + unpaddedSize = IntMath.divide(integerType.getBitWidth(), 8, RoundingMode.CEILING); + alignment = unpaddedSize; + } else if (type instanceof FloatType floatType) { + unpaddedSize = IntMath.divide(floatType.getBitWidth(), 8, RoundingMode.CEILING); + alignment = unpaddedSize; + } else if (type instanceof ArrayType arrayType) { + final TypeLayout elemTypeLayout = of(arrayType.getElementType()); + unpaddedSize = elemTypeLayout.totalSizeInBytes() * arrayType.getNumElements(); + alignment = elemTypeLayout.alignment(); + } else if (type instanceof AggregateType aggregateType) { + return of(aggregateType.getDirectFields()); + } else { + throw new UnsupportedOperationException("Cannot compute memory layout of type " + type); + } + + return new TypeLayout(unpaddedSize, alignment); + } + + public static TypeLayout of(Iterable aggregate) { + int aggregateSize = 0; + int maxAlignment = 1; + for (Type fieldType : aggregate) { + final TypeLayout layout = of(fieldType); + aggregateSize = paddedSize(aggregateSize, layout.alignment()) + layout.totalSizeInBytes(); + maxAlignment = Math.max(maxAlignment, layout.alignment()); + } + return new TypeLayout(aggregateSize, maxAlignment); + } + + public static int paddedSize(int size, int alignment) { + final int mod = size % alignment; + final int padding = mod == 0 ? 0 : (alignment - mod); + return size + padding; + } + +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeOffset.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeOffset.java new file mode 100644 index 0000000000..9ad4dc7878 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeOffset.java @@ -0,0 +1,43 @@ +package com.dat3m.dartagnan.expression.type; + +import com.dat3m.dartagnan.expression.Type; +import com.google.common.base.Preconditions; + +import java.util.List; + +import static com.dat3m.dartagnan.expression.type.TypeLayout.paddedSize; + +public record TypeOffset(Type type, int offset) { + + public static TypeOffset of(Type type, int index) { + if (index == 0) { + return new TypeOffset(type, 0); + } + + if (type instanceof ArrayType arrayType) { + final Type elemType = arrayType.getElementType(); + return new TypeOffset(elemType, TypeLayout.of(elemType).totalSizeInBytes() * index); + } else if (type instanceof AggregateType aggregateType) { + final List fields = aggregateType.getDirectFields(); + Preconditions.checkArgument(index < fields.size()); + final TypeLayout prefixLayout = TypeLayout.of(fields.subList(0, index)); + final TypeLayout fieldLayout = TypeLayout.of(fields.get(index)); + final int offset = paddedSize(prefixLayout.unpaddedSize(), fieldLayout.alignment()); + return new TypeOffset(fields.get(index), offset); + } else { + final String error = String.format("Cannot compute offset of index %d into type %s.", index, type); + throw new UnsupportedOperationException(error); + } + } + + public static TypeOffset of(Type type, Iterable indices) { + int totalOffset = 0; + for (int i : indices) { + final TypeOffset inner = of(type, i); + type = inner.type(); + totalOffset += inner.offset(); + } + + return new TypeOffset(type, totalOffset); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLlvm.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLlvm.java index 5a5692963d..5e1170623c 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLlvm.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLlvm.java @@ -272,18 +272,17 @@ private void setInitialMemoryFromConstant(MemoryObject memObj, int offset, Expre assert constant instanceof ConstructExpr; final ConstructExpr constArray = (ConstructExpr) constant; final List arrayElements = constArray.getOperands(); - final int stepSize = types.getMemorySizeInBytes(arrayType.getElementType()); for (int i = 0; i < arrayElements.size(); i++) { - setInitialMemoryFromConstant(memObj, offset + i * stepSize, arrayElements.get(i)); + final int innerOffset = types.getOffsetInBytes(arrayType, i); + setInitialMemoryFromConstant(memObj, offset + innerOffset, arrayElements.get(i)); } - } else if (constant.getType() instanceof AggregateType) { + } else if (constant.getType() instanceof AggregateType aggregateType) { assert constant instanceof ConstructExpr; final ConstructExpr constStruct = (ConstructExpr) constant; final List structElements = constStruct.getOperands(); - int currentOffset = offset; - for (Expression structElement : structElements) { - setInitialMemoryFromConstant(memObj, currentOffset, structElement); - currentOffset += types.getMemorySizeInBytes(structElement.getType()); + for (int i = 0; i < structElements.size(); i++) { + int innerOffset = types.getOffsetInBytes(aggregateType, i); + setInitialMemoryFromConstant(memObj, offset + innerOffset, structElements.get(i)); } } else if (constant.getType() instanceof IntegerType) { memObj.setInitialValue(offset, constant); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/GEPToAddition.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/GEPToAddition.java index 3ceb211f33..16510d6641 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/GEPToAddition.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/GEPToAddition.java @@ -7,10 +7,7 @@ import com.dat3m.dartagnan.expression.integers.IntLiteral; import com.dat3m.dartagnan.expression.misc.GEPExpr; import com.dat3m.dartagnan.expression.processing.ExprTransformer; -import com.dat3m.dartagnan.expression.type.AggregateType; -import com.dat3m.dartagnan.expression.type.ArrayType; -import com.dat3m.dartagnan.expression.type.IntegerType; -import com.dat3m.dartagnan.expression.type.TypeFactory; +import com.dat3m.dartagnan.expression.type.*; import com.dat3m.dartagnan.program.Function; import com.dat3m.dartagnan.program.Program; import com.dat3m.dartagnan.program.event.RegReader; @@ -75,13 +72,9 @@ public Expression visitGEPExpression(GEPExpr getElementPointer) { throw new MalformedProgramException( String.format("Non-constant field index %s for aggregate of type %s.", offset, type)); } - final int value = constant.getValueAsInt(); - type = aggregateType.getDirectFields().get(value); - int o = 0; - for (final Type elementType : aggregateType.getDirectFields().subList(0, value)) { - o += types.getMemorySizeInBytes(elementType); - } - result = expressions.makeAdd(result, expressions.makeValue(o, archType)); + final TypeOffset typeOffset = TypeOffset.of(aggregateType, constant.getValueAsInt()); + type = typeOffset.type(); + result = expressions.makeAdd(result, expressions.makeValue(typeOffset.offset(), archType)); } return result; } diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/c/MiscellaneousTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/c/MiscellaneousTest.java index a87146f08e..04159010ea 100644 --- a/dartagnan/src/test/java/com/dat3m/dartagnan/c/MiscellaneousTest.java +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/c/MiscellaneousTest.java @@ -86,7 +86,8 @@ public static Iterable data() throws IOException { {"verifierAssert", ARM8, FAIL, 1}, {"uninitRead", IMM, FAIL, 1}, {"multipleBackJumps", IMM, UNKNOWN, 1}, - {"memcpy_s", IMM, PASS, 1} + {"memcpy_s", IMM, PASS, 1}, + {"offsetof", IMM, PASS, 1} }); } diff --git a/dartagnan/src/test/resources/miscellaneous/offsetof.ll b/dartagnan/src/test/resources/miscellaneous/offsetof.ll new file mode 100644 index 0000000000..41c33ce08e --- /dev/null +++ b/dartagnan/src/test/resources/miscellaneous/offsetof.ll @@ -0,0 +1,95 @@ +; ModuleID = '/Users/thomashaas/IdeaProjects/Dat3M/benchmarks/c/miscellaneous/offsetof.c' +source_filename = "/Users/thomashaas/IdeaProjects/Dat3M/benchmarks/c/miscellaneous/offsetof.c" +target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" +target triple = "arm64-apple-macosx13.0.0" + +%struct.myStruct_t = type { i32, %struct.anon, i32 } +%struct.anon = type { i64, i8 } + +@myStruct = dso_local global %struct.myStruct_t zeroinitializer, align 8, !dbg !0 + +; Function Attrs: noinline nounwind ssp uwtable +define dso_local i32 @main() #0 !dbg !32 { + %1 = alloca %struct.myStruct_t*, align 8 + %2 = alloca i32*, align 8 + %3 = alloca %struct.myStruct_t*, align 8 + call void @__VERIFIER_assert(i32 1), !dbg !35 + call void @__VERIFIER_assert(i32 1), !dbg !36 + call void @llvm.dbg.declare(metadata %struct.myStruct_t** %1, metadata !37, metadata !DIExpression()), !dbg !38 + call void @llvm.dbg.declare(metadata i32** %2, metadata !39, metadata !DIExpression()), !dbg !43 + store i32* getelementptr inbounds (%struct.myStruct_t, %struct.myStruct_t* @myStruct, i32 0, i32 2), i32** %2, align 8, !dbg !43 + %4 = load i32*, i32** %2, align 8, !dbg !43 + %5 = bitcast i32* %4 to i8*, !dbg !43 + %6 = getelementptr inbounds i8, i8* %5, i64 -24, !dbg !43 + %7 = bitcast i8* %6 to %struct.myStruct_t*, !dbg !43 + store %struct.myStruct_t* %7, %struct.myStruct_t** %3, align 8, !dbg !43 + %8 = load %struct.myStruct_t*, %struct.myStruct_t** %3, align 8, !dbg !43 + store %struct.myStruct_t* %8, %struct.myStruct_t** %1, align 8, !dbg !38 + %9 = load %struct.myStruct_t*, %struct.myStruct_t** %1, align 8, !dbg !44 + %10 = icmp eq %struct.myStruct_t* %9, @myStruct, !dbg !45 + %11 = zext i1 %10 to i32, !dbg !45 + call void @__VERIFIER_assert(i32 %11), !dbg !46 + ret i32 0, !dbg !47 +} + +declare void @__VERIFIER_assert(i32) #1 + +; Function Attrs: nofree nosync nounwind readnone speculatable willreturn +declare void @llvm.dbg.declare(metadata, metadata, metadata) #2 + +attributes #0 = { noinline nounwind ssp uwtable "disable-tail-calls"="false" "frame-pointer"="non-leaf" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-a12" "target-features"="+aes,+crc,+crypto,+fp-armv8,+fullfp16,+lse,+neon,+ras,+rcpc,+rdm,+sha2,+v8.3a,+zcm,+zcz" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { "disable-tail-calls"="false" "frame-pointer"="non-leaf" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-a12" "target-features"="+aes,+crc,+crypto,+fp-armv8,+fullfp16,+lse,+neon,+ras,+rcpc,+rdm,+sha2,+v8.3a,+zcm,+zcz" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #2 = { nofree nosync nounwind readnone speculatable willreturn } + +!llvm.dbg.cu = !{!2} +!llvm.module.flags = !{!23, !24, !25, !26, !27, !28, !29, !30} +!llvm.ident = !{!31} + +!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) +!1 = distinct !DIGlobalVariable(name: "myStruct", scope: !2, file: !8, line: 17, type: !7, isLocal: false, isDefinition: true) +!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "Homebrew clang version 12.0.1", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !5, globals: !22, nameTableKind: None, sysroot: "/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk", sdk: "MacOSX13.sdk") +!3 = !DIFile(filename: "/Users/thomashaas/IdeaProjects/Dat3M/benchmarks/c/miscellaneous/offsetof.c", directory: "/Users/thomashaas/IdeaProjects/Dat3M") +!4 = !{} +!5 = !{!6, !21} +!6 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64) +!7 = !DIDerivedType(tag: DW_TAG_typedef, name: "myStruct_t", file: !8, line: 15, baseType: !9) +!8 = !DIFile(filename: "benchmarks/c/miscellaneous/offsetof.c", directory: "/Users/thomashaas/IdeaProjects/Dat3M") +!9 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !8, line: 8, size: 256, elements: !10) +!10 = !{!11, !13, !20} +!11 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !9, file: !8, line: 9, baseType: !12, size: 32) +!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!13 = !DIDerivedType(tag: DW_TAG_member, scope: !9, file: !8, line: 10, baseType: !14, size: 128, offset: 64) +!14 = distinct !DICompositeType(tag: DW_TAG_structure_type, scope: !9, file: !8, line: 10, size: 128, elements: !15) +!15 = !{!16, !18} +!16 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !14, file: !8, line: 11, baseType: !17, size: 64) +!17 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed) +!18 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !14, file: !8, line: 12, baseType: !19, size: 8, offset: 64) +!19 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) +!20 = !DIDerivedType(tag: DW_TAG_member, name: "z", scope: !9, file: !8, line: 14, baseType: !12, size: 32, offset: 192) +!21 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !19, size: 64) +!22 = !{!0} +!23 = !{i32 7, !"Dwarf Version", i32 4} +!24 = !{i32 2, !"Debug Info Version", i32 3} +!25 = !{i32 1, !"wchar_size", i32 4} +!26 = !{i32 1, !"branch-target-enforcement", i32 0} +!27 = !{i32 1, !"sign-return-address", i32 0} +!28 = !{i32 1, !"sign-return-address-all", i32 0} +!29 = !{i32 1, !"sign-return-address-with-bkey", i32 0} +!30 = !{i32 7, !"PIC Level", i32 2} +!31 = !{!"Homebrew clang version 12.0.1"} +!32 = distinct !DISubprogram(name: "main", scope: !8, file: !8, line: 19, type: !33, scopeLine: 20, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4) +!33 = !DISubroutineType(types: !34) +!34 = !{!12} +!35 = !DILocation(line: 22, column: 5, scope: !32) +!36 = !DILocation(line: 23, column: 5, scope: !32) +!37 = !DILocalVariable(name: "container", scope: !32, file: !8, line: 26, type: !6) +!38 = !DILocation(line: 26, column: 17, scope: !32) +!39 = !DILocalVariable(name: "__mptr", scope: !40, file: !8, line: 26, type: !41) +!40 = distinct !DILexicalBlock(scope: !32, file: !8, line: 26, column: 29) +!41 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !42, size: 64) +!42 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !12) +!43 = !DILocation(line: 26, column: 29, scope: !40) +!44 = !DILocation(line: 27, column: 23, scope: !32) +!45 = !DILocation(line: 27, column: 33, scope: !32) +!46 = !DILocation(line: 27, column: 5, scope: !32) +!47 = !DILocation(line: 28, column: 1, scope: !32) From 94f90c70230af6b8fc3a8e1663114bb152d5a717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Maseli?= Date: Thu, 13 Jun 2024 10:25:52 +0200 Subject: [PATCH 08/28] Fix inclusion updates in IBPA (#694) --- .../alias/InclusionBasedPointerAnalysis.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/alias/InclusionBasedPointerAnalysis.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/alias/InclusionBasedPointerAnalysis.java index fb16f3e3b5..996c23a160 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/alias/InclusionBasedPointerAnalysis.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/alias/InclusionBasedPointerAnalysis.java @@ -473,7 +473,11 @@ private Variable newVariable(String name) { // Inserts a single inclusion relationship into the graph. // Any cycle closed by this edge will eventually be detected and resolved. - private void addInclude(Variable variable, IncludeEdge edge) { + private void addInclude(Variable variable, IncludeEdge includeEdge) { + // accelerate for self-loops. + // this is necessary besides lazy cycle detection, because it handles cycles of length 1. + // LCD uses the edge that triggered the detection, which is not always the self-loop. + final IncludeEdge edge = tryAccelerate(variable, includeEdge); if (!addInto(variable.includes, edge, true)) { return; } @@ -488,6 +492,13 @@ private void addInclude(Variable variable, IncludeEdge edge) { edges.add(edge); } + private IncludeEdge tryAccelerate(Variable variable, IncludeEdge edge) { + if (edge.source != variable) { + return edge; + } + return new IncludeEdge(edge.source, new Modifier(0, compose(edge.modifier.alignment, edge.modifier.offset))); + } + // Tries to detect cycles when a new edge is to be added. // Called when a pointer propagates from variable to successor, due to an inclusion edge. private List detectCycles(Variable variable, IncludeEdge edge) { @@ -586,7 +597,7 @@ private boolean addInto(List list, IncludeEdge element, boolean isG //NOTE The Stream API is too costly here for (final IncludeEdge o : list) { if (element.source.equals(o.source) && includes(o.modifier, element.modifier)) { - if(isGraphModification) { + if (isGraphModification) { addIntoGraphFails++; } else { addIntoCyclesFails++; @@ -594,7 +605,7 @@ private boolean addInto(List list, IncludeEdge element, boolean isG return false; } } - if(isGraphModification) { + if (isGraphModification) { addIntoGraphSucceesses++; } else { addIntoCyclesSuccesses++; @@ -691,7 +702,7 @@ private boolean includes(Modifier left, Modifier right) { return false; } } - return offset % alignment == 0; + return offset % alignment == 0 && offset >= 0; } // Case of multiple dynamic indexes with pairwise indivisible alignments. final int gcd = IntMath.gcd(reduceGCD(right.alignment), Math.abs(offset)); From 8b8389a23b4539f52137ec41393be166d7119d46 Mon Sep 17 00:00:00 2001 From: Thomas Haas Date: Thu, 13 Jun 2024 12:43:55 +0200 Subject: [PATCH 09/28] Easier handling of nondet choices (#693) --- .../dartagnan/program/event/EventFactory.java | 8 +++ .../event/lang/svcomp/NonDetChoice.java | 46 ++++++++++++ .../program/processing/Intrinsics.java | 70 ++++++++----------- .../program/processing/ProcessingManager.java | 1 + .../processing/ResolveNonDetChoices.java | 46 ++++++++++++ .../processing/compilation/VisitorLKMM.java | 21 ++---- 6 files changed, 137 insertions(+), 55 deletions(-) create mode 100644 dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/svcomp/NonDetChoice.java create mode 100644 dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ResolveNonDetChoices.java diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/EventFactory.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/EventFactory.java index 1313a0d0a8..6ecd0954dc 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/EventFactory.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/EventFactory.java @@ -444,6 +444,14 @@ public static SpinEnd newSpinEnd() { public static LoopBound newLoopBound(Expression bound) { return new LoopBound(bound); } + + public static NonDetChoice newNonDetChoice(Register register) { + return new NonDetChoice(register, false); + } + + public static NonDetChoice newSignedNonDetChoice(Register register, boolean isSigned) { + return new NonDetChoice(register, isSigned); + } } // ============================================================================================= diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/svcomp/NonDetChoice.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/svcomp/NonDetChoice.java new file mode 100644 index 0000000000..28ec629363 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/svcomp/NonDetChoice.java @@ -0,0 +1,46 @@ +package com.dat3m.dartagnan.program.event.lang.svcomp; + +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.AbstractEvent; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.event.RegWriter; +import com.google.common.base.Preconditions; + +public class NonDetChoice extends AbstractEvent implements RegWriter { + + protected Register register; + protected boolean isSigned; + + public NonDetChoice(Register register, boolean isSigned) { + this.register = Preconditions.checkNotNull(register); + this.isSigned = isSigned; + } + + protected NonDetChoice(NonDetChoice other) { + super(other); + this.register = other.register; + this.isSigned = other.isSigned; + } + + public boolean isSigned() { return isSigned; } + + @Override + protected String defaultString() { + return String.format("%s <- *", register); + } + + @Override + public Event getCopy() { + return new NonDetChoice(this); + } + + @Override + public Register getResultRegister() { + return register; + } + + @Override + public void setResultRegister(Register reg) { + this.register = reg; + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java index bc2820e93a..5eba53639f 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java @@ -6,7 +6,6 @@ import com.dat3m.dartagnan.expression.Type; import com.dat3m.dartagnan.expression.integers.IntBinaryOp; import com.dat3m.dartagnan.expression.integers.IntLiteral; -import com.dat3m.dartagnan.expression.type.FunctionType; import com.dat3m.dartagnan.expression.type.IntegerType; import com.dat3m.dartagnan.expression.type.TypeFactory; import com.dat3m.dartagnan.program.Function; @@ -22,7 +21,6 @@ import com.dat3m.dartagnan.program.event.functions.FunctionCall; import com.dat3m.dartagnan.program.event.functions.ValueFunctionCall; import com.dat3m.dartagnan.program.event.lang.svcomp.BeginAtomic; -import com.dat3m.dartagnan.program.misc.NonDetValue; import com.google.common.collect.ImmutableList; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -185,7 +183,7 @@ public enum Info { "__VERIFIER_nondet_short", "__VERIFIER_nondet_ushort", "__VERIFIER_nondet_unsigned_short", "__VERIFIER_nondet_long", "__VERIFIER_nondet_ulong", "__VERIFIER_nondet_char", "__VERIFIER_nondet_uchar"), - false, false, true, false, Intrinsics::inlineNonDet), + false, false, true, true, Intrinsics::inlineNonDet), // --------------------------- LLVM --------------------------- LLVM(List.of("llvm.smax", "llvm.umax", "llvm.smin", "llvm.umin", "llvm.ssub.sat", "llvm.usub.sat", "llvm.sadd.sat", "llvm.uadd.sat", // TODO: saturated shifts @@ -288,8 +286,6 @@ private interface Replacer { } private void markIntrinsics(Program program) { - declareNondetBool(program); - final var missingSymbols = new TreeSet(); for (Function func : program.getFunctions()) { if (!func.hasBody()) { @@ -306,15 +302,6 @@ private void markIntrinsics(Program program) { } } - private void declareNondetBool(Program program) { - // used by VisitorLKMM - if (program.getFunctionByName("__VERIFIER_nondet_bool").isEmpty()) { - final FunctionType type = types.getFunctionType(types.getBooleanType(), List.of()); - //TODO this id will not be unique - program.addFunction(new Function("__VERIFIER_nondet_bool", type, List.of(), 0, null)); - } - } - private void replace(FunctionCall call, Replacer replacer) { if (replacer == null) { throw new MalformedProgramException( @@ -1278,38 +1265,41 @@ private void inlineLate(Function function) { private List inlineNonDet(FunctionCall call) { assert call.isDirectCall() && call instanceof ValueFunctionCall; - final Program program = call.getFunction().getProgram(); - Register register = ((ValueFunctionCall) call).getResultRegister(); - String name = call.getCalledFunction().getName(); + final Register result = getResultRegister(call); + final String name = call.getCalledFunction().getName(); final String separator = "nondet_"; - int index = name.indexOf(separator); + final int index = name.indexOf(separator); assert index > -1; - String suffix = name.substring(index + separator.length()); + final String suffix = name.substring(index + separator.length()); - // Nondeterministic booleans + final Type nonDetType; + final boolean signed; if (suffix.equals("bool")) { - final Expression value = program.newConstant(types.getBooleanType()); - final Expression cast = expressions.makeCast(value, register.getType()); - return List.of(EventFactory.newLocal(register, cast)); - } - - // Nondeterministic integers - boolean signed = switch (suffix) { - case "int", "short", "long", "char" -> true; - default -> false; - }; + // Nondeterministic booleans + signed = false; + nonDetType = types.getBooleanType(); + } else { + // Nondeterministic integers + final int bits = switch (suffix) { + case "long", "ulong" -> 64; + case "int", "uint", "unsigned_int" -> 32; + case "short", "ushort", "unsigned_short" -> 16; + case "char", "uchar" -> 8; + default -> throw new UnsupportedOperationException(String.format("%s is not supported", call)); + }; - final int bits = switch (suffix) { - case "long", "ulong" -> 64; - case "int", "uint", "unsigned_int" -> 32; - case "short", "ushort", "unsigned_short" -> 16; - case "char", "uchar" -> 8; - default -> throw new UnsupportedOperationException(String.format("%s is not supported", call)); - }; + signed = switch (suffix) { + case "int", "short", "long", "char" -> true; + default -> false; + }; + nonDetType = types.getIntegerType(bits); + } - final NonDetValue value = (NonDetValue) call.getFunction().getProgram().newConstant(types.getIntegerType(bits)); - value.setIsSigned(signed); - return List.of(EventFactory.newLocal(register, expressions.makeCast(value, register.getType(), signed))); + final Register nonDetReg = call.getFunction().getOrNewRegister("__r_nondet_" + suffix, nonDetType); + return List.of( + EventFactory.Svcomp.newSignedNonDetChoice(nonDetReg, signed), + EventFactory.newLocal(result, expressions.makeCast(nonDetReg, result.getType(), signed)) + ); } //FIXME: The following support for memcpy, memcmp, and memset is unsound diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ProcessingManager.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ProcessingManager.java index ad4549b1e0..ae5794ba5d 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ProcessingManager.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ProcessingManager.java @@ -121,6 +121,7 @@ private ProcessingManager(Configuration config) throws InvalidConfigurationExcep ), Target.FUNCTIONS, true ), ThreadCreation.fromConfig(config), + ResolveNonDetChoices.newInstance(), reduceSymmetry ? SymmetryReduction.fromConfig(config) : null, intrinsics.lateInliningPass(), ProgramProcessor.fromFunctionProcessor( diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ResolveNonDetChoices.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ResolveNonDetChoices.java new file mode 100644 index 0000000000..550a975791 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ResolveNonDetChoices.java @@ -0,0 +1,46 @@ +package com.dat3m.dartagnan.program.processing; + +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.Type; +import com.dat3m.dartagnan.expression.processing.ExpressionInspector; +import com.dat3m.dartagnan.program.Function; +import com.dat3m.dartagnan.program.Program; +import com.dat3m.dartagnan.program.event.EventFactory; +import com.dat3m.dartagnan.program.event.core.Local; +import com.dat3m.dartagnan.program.event.lang.svcomp.NonDetChoice; +import com.dat3m.dartagnan.program.misc.NonDetValue; + +public class ResolveNonDetChoices implements ProgramProcessor { + + private ResolveNonDetChoices() { } + + public static ResolveNonDetChoices newInstance() { + return new ResolveNonDetChoices(); + } + + @Override + public void run(Program program) { + program.getThreads().forEach(this::resolveNonDetChoices); + } + + private void resolveNonDetChoices(Function func) { + final Program prog = func.getProgram(); + for (NonDetChoice choice : func.getEvents(NonDetChoice.class)) { + final Type valueType = choice.getResultRegister().getType(); + final Expression constant = prog.newConstant(valueType); + + final ExpressionInspector signednessMarker = new ExpressionInspector() { + @Override + public Expression visitNonDetValue(NonDetValue nonDet) { + nonDet.setIsSigned(choice.isSigned()); + return nonDet; + } + }; + constant.accept(signednessMarker); + + final Local assignment = EventFactory.newLocal(choice.getResultRegister(), constant); + assignment.copyAllMetadataFrom(choice); + choice.replaceBy(assignment); + } + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorLKMM.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorLKMM.java index c2a7c5ca80..262007dbeb 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorLKMM.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorLKMM.java @@ -1,10 +1,8 @@ package com.dat3m.dartagnan.program.processing.compilation; -import com.dat3m.dartagnan.exception.MalformedProgramException; import com.dat3m.dartagnan.expression.Expression; import com.dat3m.dartagnan.expression.ExpressionFactory; import com.dat3m.dartagnan.expression.type.IntegerType; -import com.dat3m.dartagnan.program.Function; import com.dat3m.dartagnan.program.Register; import com.dat3m.dartagnan.program.event.Event; import com.dat3m.dartagnan.program.event.EventFactory; @@ -30,15 +28,14 @@ public List visitLKMMAddUnless(LKMMAddUnless e) { Expression cmp = e.getCmp(); Expression address = e.getAddress(); Expression unexpected = expressions.makeNEQ(dummy, cmp); - Function nondetBoolFunction = getNondetBoolFunction(e); - Register havocRegister = e.getFunction().newRegister(nondetBoolFunction.getFunctionType().getReturnType()); + Register havocRegister = e.getFunction().getOrNewRegister("__guess", types.getBooleanType()); Label success = newLabel("RMW_success"); Label end = newLabel("RMW_end"); Load rmwLoad; return eventSequence( - newValueFunctionCall(havocRegister,nondetBoolFunction,List.of()), - newJump(expressions.makeBooleanCast(havocRegister), success), + EventFactory.Svcomp.newNonDetChoice(havocRegister), + newJump(havocRegister, success), newCoreLoad(dummy, address, Tag.Linux.MO_ONCE), newAssume(expressions.makeEQ(dummy, cmp)), newGoto(end), @@ -59,8 +56,7 @@ public List visitLKMMCmpXchg(LKMMCmpXchg e) { Expression cmp = e.getExpectedValue(); Expression address = e.getAddress(); String mo = e.getMo(); - Function nondetBoolFunction = getNondetBoolFunction(e); - Register havocRegister = e.getFunction().newRegister(nondetBoolFunction.getFunctionType().getReturnType()); + Register havocRegister = e.getFunction().getOrNewRegister("__guess", types.getBooleanType()); Label success = newLabel("CAS_success"); Label end = newLabel("CAS_end"); @@ -69,8 +65,8 @@ public List visitLKMMCmpXchg(LKMMCmpXchg e) { loadFail.addTags(Tag.RMW); Load loadSuccess; return eventSequence( - newValueFunctionCall(havocRegister,nondetBoolFunction,List.of()), - newJump(expressions.makeBooleanCast(havocRegister), success), + EventFactory.Svcomp.newNonDetChoice(havocRegister), + newJump(havocRegister, success), // Cas failure branch loadFail, newAssume(expressions.makeNEQ(dummy, cmp)), @@ -261,9 +257,4 @@ private static RMWStore newLockWrite(Load lockRead, Expression lockAddr) { return lockWrite; } - private static Function getNondetBoolFunction(Event e) { - return e.getFunction().getProgram().getFunctionByName("__VERIFIER_nondet_bool") - .orElseThrow(() -> new MalformedProgramException("Undeclared function \"__VERIFIER_nondet_bool\"")); - } - } \ No newline at end of file From 2688e01515fc6def195166a22d2a8c97a67edb37 Mon Sep 17 00:00:00 2001 From: Hernan Ponce de Leon Date: Thu, 13 Jun 2024 17:32:21 +0200 Subject: [PATCH 10/28] Fix cttz bug (#696) * Fix copy paste error * Add unit tests --------- Signed-off-by: Hernan Ponce de Leon Co-authored-by: Hernan Ponce de Leon --- .../program/processing/Intrinsics.java | 2 +- .../dat3m/dartagnan/c/MiscellaneousTest.java | 6 +- .../src/test/resources/miscellaneous/ctlz.ll | 130 ++++++++++++++++++ .../src/test/resources/miscellaneous/cttz.ll | 130 ++++++++++++++++++ 4 files changed, 265 insertions(+), 3 deletions(-) create mode 100644 dartagnan/src/test/resources/miscellaneous/ctlz.ll create mode 100644 dartagnan/src/test/resources/miscellaneous/cttz.ll diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java index 5eba53639f..e83adf9e63 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java @@ -918,7 +918,7 @@ private List handleLLVMIntrinsic(FunctionCall call) { if (name.startsWith("llvm.ctlz")) { return inlineLLVMCtlz(valueCall); } else if (name.startsWith("llvm.cttz")) { - return inlineLLVMCtlz(valueCall); + return inlineLLVMCttz(valueCall); } else if (name.startsWith("llvm.ctpop")) { return inlineLLVMCtpop(valueCall); } else if (name.contains("add.sat")) { diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/c/MiscellaneousTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/c/MiscellaneousTest.java index 04159010ea..2b8a304440 100644 --- a/dartagnan/src/test/java/com/dat3m/dartagnan/c/MiscellaneousTest.java +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/c/MiscellaneousTest.java @@ -49,7 +49,7 @@ protected long getTimeout() { protected Provider getConfigurationProvider() { return Provider.fromSupplier(() -> { ConfigurationBuilder builder = Configuration.builder(); - if (!name.equals("pthread")) { + if (!name.equals("pthread") && !name.equals("ctlz") && !name.equals("cttz")) { builder.setOption(OptionNames.USE_INTEGERS, "true"); } if (name.equals("recursion")) { @@ -87,7 +87,9 @@ public static Iterable data() throws IOException { {"uninitRead", IMM, FAIL, 1}, {"multipleBackJumps", IMM, UNKNOWN, 1}, {"memcpy_s", IMM, PASS, 1}, - {"offsetof", IMM, PASS, 1} + {"offsetof", IMM, PASS, 1}, + {"ctlz", IMM, PASS, 1}, + {"cttz", IMM, PASS, 1} }); } diff --git a/dartagnan/src/test/resources/miscellaneous/ctlz.ll b/dartagnan/src/test/resources/miscellaneous/ctlz.ll new file mode 100644 index 0000000000..b69439a647 --- /dev/null +++ b/dartagnan/src/test/resources/miscellaneous/ctlz.ll @@ -0,0 +1,130 @@ +; ModuleID = '/home/ponce/git/Dat3M/output/ctlz.ll' +source_filename = "/home/ponce/git/Dat3M/benchmarks/c/miscellaneous/ctlz.c" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-pc-linux-gnu" + +@x = dso_local global i32 1, align 4, !dbg !0 +@y = dso_local global i32 2147483647, align 4, !dbg !6 +@z = dso_local global i32 -2147483648, align 4, !dbg !15 +@u = dso_local global i32 0, align 4, !dbg !17 +@.str = private unnamed_addr constant [8 x i8] c"u == 31\00", align 1 +@.str.1 = private unnamed_addr constant [56 x i8] c"/home/ponce/git/Dat3M/benchmarks/c/miscellaneous/ctlz.c\00", align 1 +@__PRETTY_FUNCTION__.main = private unnamed_addr constant [11 x i8] c"int main()\00", align 1 +@.str.2 = private unnamed_addr constant [7 x i8] c"u == 1\00", align 1 +@.str.3 = private unnamed_addr constant [7 x i8] c"u == 0\00", align 1 + +; Function Attrs: noinline nounwind uwtable +define dso_local i32 @main() #0 !dbg !23 { + %1 = alloca i32, align 4 + store i32 0, i32* %1, align 4 + %2 = load volatile i32, i32* @x, align 4, !dbg !26 + %3 = call i32 @llvm.ctlz.i32(i32 %2, i1 true), !dbg !27 + store volatile i32 %3, i32* @u, align 4, !dbg !28 + %4 = load volatile i32, i32* @u, align 4, !dbg !29 + %5 = icmp eq i32 %4, 31, !dbg !29 + br i1 %5, label %6, label %7, !dbg !32 + +6: ; preds = %0 + br label %8, !dbg !32 + +7: ; preds = %0 + call void @__assert_fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i32 13, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #3, !dbg !29 + unreachable, !dbg !29 + +8: ; preds = %6 + %9 = load volatile i32, i32* @y, align 4, !dbg !33 + %10 = call i32 @llvm.ctlz.i32(i32 %9, i1 true), !dbg !34 + store volatile i32 %10, i32* @u, align 4, !dbg !35 + %11 = load volatile i32, i32* @u, align 4, !dbg !36 + %12 = icmp eq i32 %11, 1, !dbg !36 + br i1 %12, label %13, label %14, !dbg !39 + +13: ; preds = %8 + br label %15, !dbg !39 + +14: ; preds = %8 + call void @__assert_fail(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i32 16, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #3, !dbg !36 + unreachable, !dbg !36 + +15: ; preds = %13 + %16 = load volatile i32, i32* @z, align 4, !dbg !40 + %17 = call i32 @llvm.ctlz.i32(i32 %16, i1 true), !dbg !41 + store volatile i32 %17, i32* @u, align 4, !dbg !42 + %18 = load volatile i32, i32* @u, align 4, !dbg !43 + %19 = icmp eq i32 %18, 0, !dbg !43 + br i1 %19, label %20, label %21, !dbg !46 + +20: ; preds = %15 + br label %22, !dbg !46 + +21: ; preds = %15 + call void @__assert_fail(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i32 19, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #3, !dbg !43 + unreachable, !dbg !43 + +22: ; preds = %20 + ret i32 0, !dbg !47 +} + +; Function Attrs: nofree nosync nounwind readnone speculatable willreturn +declare i32 @llvm.ctlz.i32(i32, i1 immarg) #1 + +; Function Attrs: noreturn nounwind +declare dso_local void @__assert_fail(i8*, i8*, i32, i8*) #2 + +attributes #0 = { noinline nounwind uwtable "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nofree nosync nounwind readnone speculatable willreturn } +attributes #2 = { noreturn nounwind "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #3 = { noreturn nounwind } + +!llvm.dbg.cu = !{!2} +!llvm.module.flags = !{!19, !20, !21} +!llvm.ident = !{!22} + +!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) +!1 = distinct !DIGlobalVariable(name: "x", scope: !2, file: !8, line: 4, type: !9, isLocal: false, isDefinition: true) +!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "Ubuntu clang version 12.0.0-3ubuntu1~20.04.5", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, splitDebugInlining: false, nameTableKind: None) +!3 = !DIFile(filename: "/home/ponce/git/Dat3M/benchmarks/c/miscellaneous/ctlz.c", directory: "/home/ponce/git/Dat3M") +!4 = !{} +!5 = !{!0, !6, !15, !17} +!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression()) +!7 = distinct !DIGlobalVariable(name: "y", scope: !2, file: !8, line: 5, type: !9, isLocal: false, isDefinition: true) +!8 = !DIFile(filename: "benchmarks/c/miscellaneous/ctlz.c", directory: "/home/ponce/git/Dat3M") +!9 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !10) +!10 = !DIDerivedType(tag: DW_TAG_typedef, name: "int32_t", file: !11, line: 26, baseType: !12) +!11 = !DIFile(filename: "/usr/include/x86_64-linux-gnu/bits/stdint-intn.h", directory: "") +!12 = !DIDerivedType(tag: DW_TAG_typedef, name: "__int32_t", file: !13, line: 41, baseType: !14) +!13 = !DIFile(filename: "/usr/include/x86_64-linux-gnu/bits/types.h", directory: "") +!14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!15 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression()) +!16 = distinct !DIGlobalVariable(name: "z", scope: !2, file: !8, line: 6, type: !9, isLocal: false, isDefinition: true) +!17 = !DIGlobalVariableExpression(var: !18, expr: !DIExpression()) +!18 = distinct !DIGlobalVariable(name: "u", scope: !2, file: !8, line: 7, type: !9, isLocal: false, isDefinition: true) +!19 = !{i32 7, !"Dwarf Version", i32 4} +!20 = !{i32 2, !"Debug Info Version", i32 3} +!21 = !{i32 1, !"wchar_size", i32 4} +!22 = !{!"Ubuntu clang version 12.0.0-3ubuntu1~20.04.5"} +!23 = distinct !DISubprogram(name: "main", scope: !8, file: !8, line: 9, type: !24, scopeLine: 10, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4) +!24 = !DISubroutineType(types: !25) +!25 = !{!14} +!26 = !DILocation(line: 12, column: 23, scope: !23) +!27 = !DILocation(line: 12, column: 9, scope: !23) +!28 = !DILocation(line: 12, column: 7, scope: !23) +!29 = !DILocation(line: 13, column: 2, scope: !30) +!30 = distinct !DILexicalBlock(scope: !31, file: !8, line: 13, column: 2) +!31 = distinct !DILexicalBlock(scope: !23, file: !8, line: 13, column: 2) +!32 = !DILocation(line: 13, column: 2, scope: !31) +!33 = !DILocation(line: 15, column: 23, scope: !23) +!34 = !DILocation(line: 15, column: 9, scope: !23) +!35 = !DILocation(line: 15, column: 7, scope: !23) +!36 = !DILocation(line: 16, column: 2, scope: !37) +!37 = distinct !DILexicalBlock(scope: !38, file: !8, line: 16, column: 2) +!38 = distinct !DILexicalBlock(scope: !23, file: !8, line: 16, column: 2) +!39 = !DILocation(line: 16, column: 2, scope: !38) +!40 = !DILocation(line: 18, column: 23, scope: !23) +!41 = !DILocation(line: 18, column: 9, scope: !23) +!42 = !DILocation(line: 18, column: 7, scope: !23) +!43 = !DILocation(line: 19, column: 2, scope: !44) +!44 = distinct !DILexicalBlock(scope: !45, file: !8, line: 19, column: 2) +!45 = distinct !DILexicalBlock(scope: !23, file: !8, line: 19, column: 2) +!46 = !DILocation(line: 19, column: 2, scope: !45) +!47 = !DILocation(line: 21, column: 2, scope: !23) diff --git a/dartagnan/src/test/resources/miscellaneous/cttz.ll b/dartagnan/src/test/resources/miscellaneous/cttz.ll new file mode 100644 index 0000000000..06ff2a2701 --- /dev/null +++ b/dartagnan/src/test/resources/miscellaneous/cttz.ll @@ -0,0 +1,130 @@ +; ModuleID = '/home/ponce/git/Dat3M/output/cttz.ll' +source_filename = "/home/ponce/git/Dat3M/benchmarks/c/miscellaneous/cttz.c" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-pc-linux-gnu" + +@x = dso_local global i32 -2147483648, align 4, !dbg !0 +@y = dso_local global i32 2147483646, align 4, !dbg !6 +@z = dso_local global i32 1, align 4, !dbg !15 +@u = dso_local global i32 0, align 4, !dbg !17 +@.str = private unnamed_addr constant [8 x i8] c"u == 31\00", align 1 +@.str.1 = private unnamed_addr constant [56 x i8] c"/home/ponce/git/Dat3M/benchmarks/c/miscellaneous/cttz.c\00", align 1 +@__PRETTY_FUNCTION__.main = private unnamed_addr constant [11 x i8] c"int main()\00", align 1 +@.str.2 = private unnamed_addr constant [7 x i8] c"u == 1\00", align 1 +@.str.3 = private unnamed_addr constant [7 x i8] c"u == 0\00", align 1 + +; Function Attrs: noinline nounwind uwtable +define dso_local i32 @main() #0 !dbg !23 { + %1 = alloca i32, align 4 + store i32 0, i32* %1, align 4 + %2 = load volatile i32, i32* @x, align 4, !dbg !26 + %3 = call i32 @llvm.cttz.i32(i32 %2, i1 true), !dbg !27 + store volatile i32 %3, i32* @u, align 4, !dbg !28 + %4 = load volatile i32, i32* @u, align 4, !dbg !29 + %5 = icmp eq i32 %4, 31, !dbg !29 + br i1 %5, label %6, label %7, !dbg !32 + +6: ; preds = %0 + br label %8, !dbg !32 + +7: ; preds = %0 + call void @__assert_fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i32 13, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #3, !dbg !29 + unreachable, !dbg !29 + +8: ; preds = %6 + %9 = load volatile i32, i32* @y, align 4, !dbg !33 + %10 = call i32 @llvm.cttz.i32(i32 %9, i1 true), !dbg !34 + store volatile i32 %10, i32* @u, align 4, !dbg !35 + %11 = load volatile i32, i32* @u, align 4, !dbg !36 + %12 = icmp eq i32 %11, 1, !dbg !36 + br i1 %12, label %13, label %14, !dbg !39 + +13: ; preds = %8 + br label %15, !dbg !39 + +14: ; preds = %8 + call void @__assert_fail(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i32 16, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #3, !dbg !36 + unreachable, !dbg !36 + +15: ; preds = %13 + %16 = load volatile i32, i32* @z, align 4, !dbg !40 + %17 = call i32 @llvm.cttz.i32(i32 %16, i1 true), !dbg !41 + store volatile i32 %17, i32* @u, align 4, !dbg !42 + %18 = load volatile i32, i32* @u, align 4, !dbg !43 + %19 = icmp eq i32 %18, 0, !dbg !43 + br i1 %19, label %20, label %21, !dbg !46 + +20: ; preds = %15 + br label %22, !dbg !46 + +21: ; preds = %15 + call void @__assert_fail(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i32 19, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #3, !dbg !43 + unreachable, !dbg !43 + +22: ; preds = %20 + ret i32 0, !dbg !47 +} + +; Function Attrs: nofree nosync nounwind readnone speculatable willreturn +declare i32 @llvm.cttz.i32(i32, i1 immarg) #1 + +; Function Attrs: noreturn nounwind +declare dso_local void @__assert_fail(i8*, i8*, i32, i8*) #2 + +attributes #0 = { noinline nounwind uwtable "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nofree nosync nounwind readnone speculatable willreturn } +attributes #2 = { noreturn nounwind "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #3 = { noreturn nounwind } + +!llvm.dbg.cu = !{!2} +!llvm.module.flags = !{!19, !20, !21} +!llvm.ident = !{!22} + +!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) +!1 = distinct !DIGlobalVariable(name: "x", scope: !2, file: !8, line: 4, type: !9, isLocal: false, isDefinition: true) +!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "Ubuntu clang version 12.0.0-3ubuntu1~20.04.5", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, splitDebugInlining: false, nameTableKind: None) +!3 = !DIFile(filename: "/home/ponce/git/Dat3M/benchmarks/c/miscellaneous/cttz.c", directory: "/home/ponce/git/Dat3M") +!4 = !{} +!5 = !{!0, !6, !15, !17} +!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression()) +!7 = distinct !DIGlobalVariable(name: "y", scope: !2, file: !8, line: 5, type: !9, isLocal: false, isDefinition: true) +!8 = !DIFile(filename: "benchmarks/c/miscellaneous/cttz.c", directory: "/home/ponce/git/Dat3M") +!9 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !10) +!10 = !DIDerivedType(tag: DW_TAG_typedef, name: "int32_t", file: !11, line: 26, baseType: !12) +!11 = !DIFile(filename: "/usr/include/x86_64-linux-gnu/bits/stdint-intn.h", directory: "") +!12 = !DIDerivedType(tag: DW_TAG_typedef, name: "__int32_t", file: !13, line: 41, baseType: !14) +!13 = !DIFile(filename: "/usr/include/x86_64-linux-gnu/bits/types.h", directory: "") +!14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!15 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression()) +!16 = distinct !DIGlobalVariable(name: "z", scope: !2, file: !8, line: 6, type: !9, isLocal: false, isDefinition: true) +!17 = !DIGlobalVariableExpression(var: !18, expr: !DIExpression()) +!18 = distinct !DIGlobalVariable(name: "u", scope: !2, file: !8, line: 7, type: !9, isLocal: false, isDefinition: true) +!19 = !{i32 7, !"Dwarf Version", i32 4} +!20 = !{i32 2, !"Debug Info Version", i32 3} +!21 = !{i32 1, !"wchar_size", i32 4} +!22 = !{!"Ubuntu clang version 12.0.0-3ubuntu1~20.04.5"} +!23 = distinct !DISubprogram(name: "main", scope: !8, file: !8, line: 9, type: !24, scopeLine: 10, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4) +!24 = !DISubroutineType(types: !25) +!25 = !{!14} +!26 = !DILocation(line: 12, column: 23, scope: !23) +!27 = !DILocation(line: 12, column: 9, scope: !23) +!28 = !DILocation(line: 12, column: 7, scope: !23) +!29 = !DILocation(line: 13, column: 2, scope: !30) +!30 = distinct !DILexicalBlock(scope: !31, file: !8, line: 13, column: 2) +!31 = distinct !DILexicalBlock(scope: !23, file: !8, line: 13, column: 2) +!32 = !DILocation(line: 13, column: 2, scope: !31) +!33 = !DILocation(line: 15, column: 23, scope: !23) +!34 = !DILocation(line: 15, column: 9, scope: !23) +!35 = !DILocation(line: 15, column: 7, scope: !23) +!36 = !DILocation(line: 16, column: 2, scope: !37) +!37 = distinct !DILexicalBlock(scope: !38, file: !8, line: 16, column: 2) +!38 = distinct !DILexicalBlock(scope: !23, file: !8, line: 16, column: 2) +!39 = !DILocation(line: 16, column: 2, scope: !38) +!40 = !DILocation(line: 18, column: 23, scope: !23) +!41 = !DILocation(line: 18, column: 9, scope: !23) +!42 = !DILocation(line: 18, column: 7, scope: !23) +!43 = !DILocation(line: 19, column: 2, scope: !44) +!44 = distinct !DILexicalBlock(scope: !45, file: !8, line: 19, column: 2) +!45 = distinct !DILexicalBlock(scope: !23, file: !8, line: 19, column: 2) +!46 = !DILocation(line: 19, column: 2, scope: !45) +!47 = !DILocation(line: 21, column: 2, scope: !23) From 075f03f12331edc15055af18fc7cfe8e1c348bf9 Mon Sep 17 00:00:00 2001 From: Thomas Haas Date: Fri, 14 Jun 2024 12:57:34 +0200 Subject: [PATCH 11/28] Better mem2reg (#697) * Added RemoveDeadNullChecks pass * Added TypeFactory.decomposeIntoPrimitives Improved MemToReg to also work on complex allocations. * Avoid Mem2Reg on allocations that are used in RMWs. * Added loop check to avoid unsoundness --- .../expression/type/TypeFactory.java | 38 ++++ .../program/processing/MemToReg.java | 52 ++--- .../program/processing/ProcessingManager.java | 5 +- .../processing/RemoveDeadNullChecks.java | 184 ++++++++++++++++++ 4 files changed, 247 insertions(+), 32 deletions(-) create mode 100644 dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/RemoveDeadNullChecks.java diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeFactory.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeFactory.java index 37a476cb72..f696baf845 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeFactory.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeFactory.java @@ -3,7 +3,9 @@ import com.dat3m.dartagnan.expression.Type; import com.dat3m.dartagnan.utils.Normalizer; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; @@ -94,4 +96,40 @@ public int getMemorySizeInBits(Type type) { public int getOffsetInBytes(Type type, int index) { return TypeOffset.of(type, index).offset(); } + + public Map decomposeIntoPrimitives(Type type) { + final Map decomposition = new LinkedHashMap<>(); + if (type instanceof ArrayType arrayType) { + final Map innerDecomposition = decomposeIntoPrimitives(arrayType.getElementType()); + if (!arrayType.hasKnownNumElements() || innerDecomposition == null) { + return null; + } + + final int size = getMemorySizeInBytes(arrayType.getElementType()); + for (int i = 0; i < arrayType.getNumElements(); i++) { + final int offset = i * size; + for (Map.Entry entry : innerDecomposition.entrySet()) { + decomposition.put(entry.getKey() + offset, entry.getValue()); + } + } + } else if (type instanceof AggregateType aggregateType) { + final List fields = aggregateType.getDirectFields(); + for (int i = 0; i < fields.size(); i++) { + final int offset = getOffsetInBytes(aggregateType, i); + final Map innerDecomposition = decomposeIntoPrimitives(fields.get(i)); + if (innerDecomposition == null) { + return null; + } + + for (Map.Entry entry : innerDecomposition.entrySet()) { + decomposition.put(entry.getKey() + offset, entry.getValue()); + } + } + } else { + // Primitive type + decomposition.put(0, type); + } + + return decomposition; + } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/MemToReg.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/MemToReg.java index a90bf2970d..083493c8a3 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/MemToReg.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/MemToReg.java @@ -6,12 +6,12 @@ import com.dat3m.dartagnan.expression.integers.IntBinaryExpr; import com.dat3m.dartagnan.expression.integers.IntBinaryOp; import com.dat3m.dartagnan.expression.integers.IntLiteral; -import com.dat3m.dartagnan.expression.type.BooleanType; -import com.dat3m.dartagnan.expression.type.IntegerType; +import com.dat3m.dartagnan.expression.type.TypeFactory; import com.dat3m.dartagnan.program.Function; import com.dat3m.dartagnan.program.Register; import com.dat3m.dartagnan.program.event.*; import com.dat3m.dartagnan.program.event.core.*; +import com.google.common.collect.Maps; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.sosy_lab.common.configuration.Configuration; @@ -73,36 +73,37 @@ private Matcher analyze(Function function) { private void promoteAll(Function function, Matcher matcher) { final ExpressionFactory expressions = ExpressionFactory.getInstance(); // Replace every unmarked address. - final var replacingRegisters = new HashMap>(); + final HashMap> replacingRegisters = new HashMap<>(); for (final Alloc allocation : function.getEvents(Alloc.class)) { if (matcher.reachabilityGraph.containsKey(allocation)) { - final List registerTypes = getPrimitiveReplacementTypes(allocation); + final Map registerTypes = getPrimitiveReplacementTypes(allocation); if (registerTypes != null) { - replacingRegisters.put(allocation, registerTypes.stream().map(function::newRegister).toList()); + replacingRegisters.put(allocation, new HashMap<>(Maps.transformValues(registerTypes, function::newRegister))); boolean deleted = allocation.tryDelete(); assert deleted : "Allocation cannot be removed, probably because it has remaining users."; } } } + int loadCount = 0, storeCount = 0; // Replace all loads and stores to replaceable storage. for (final Map.Entry entry : matcher.accesses.entrySet()) { final MemoryEvent event = entry.getKey(); final AddressOffset access = entry.getValue(); - final List registers = access == null ? null : replacingRegisters.get(access.base); - if (registers == null || access.offset < 0 || access.offset >= registers.size()) { + final Map registers = access == null ? null : replacingRegisters.get(access.base); + if (registers == null || !registers.containsKey((int)access.offset)) { continue; } + + final Register memreg = registers.get((int)access.offset); if (event instanceof Load load) { final Register reg = load.getResultRegister(); assert load.getUsers().isEmpty(); - load.replaceBy(EventFactory.newLocal(reg, expressions.makeCast(registers.get((int)access.offset), reg.getType()))); + load.replaceBy(EventFactory.newLocal(reg, expressions.makeCast(memreg, reg.getType()))); loadCount++; - } - if (event instanceof Store store) { - final Register reg = registers.get((int)access.offset); + } else if (event instanceof Store store) { assert store.getUsers().isEmpty(); - store.replaceBy(EventFactory.newLocal(reg, expressions.makeCast(store.getMemValue(), reg.getType()))); + store.replaceBy(EventFactory.newLocal(memreg, expressions.makeCast(store.getMemValue(), memreg.getType()))); storeCount++; } } @@ -118,26 +119,13 @@ private void promoteAll(Function function, Matcher matcher) { } } - private List getPrimitiveReplacementTypes(Alloc allocation) { + private Map getPrimitiveReplacementTypes(Alloc allocation) { if (!(allocation.getArraySize() instanceof IntLiteral sizeExpression)) { return null; } + final TypeFactory typeFactory = TypeFactory.getInstance(); final int size = sizeExpression.getValueAsInt(); - if (size != 1) { - //TODO arrays - return null; - } - final List replacementTypes = new ArrayList<>(); - final Type type = allocation.getAllocationType(); - //TODO PointerType - if (type instanceof IntegerType || type instanceof BooleanType) { - replacementTypes.add(type); - } else { - //TODO aggregate types - return null; - } - //TODO check for mixed-size accesses - return replacementTypes; + return typeFactory.decomposeIntoPrimitives(typeFactory.getArrayType(allocation.getAllocationType(), size)); } // Invariant: base != null @@ -216,8 +204,9 @@ public Label visitLoad(Load load) { assert addressExpression == null || addressExpression.register != null; final AddressOffset addressBase = addressExpression == null ? null : state.get(addressExpression.register); final var address = addressBase == null ? null : addressBase.increase(addressExpression.offset); + final boolean isDeletable = load.getUsers().isEmpty(); // If too complex, treat like global address. - if (addressExpression == null) { + if (addressExpression == null || !isDeletable) { publishRegisters(load.getAddress().getRegs()); } final var value = address == null ? null : state.get(address); @@ -239,12 +228,13 @@ public Label visitStore(Store store) { final RegisterOffset valueExpression = matchGEP(store.getMemValue()); assert valueExpression == null || valueExpression.register != null; final AddressOffset value = valueExpression == null ? null : state.get(valueExpression.register); + final boolean isDeletable = store.getUsers().isEmpty(); // On complex address expression, give up on any address that could contribute here. - if (addressExpression == null) { + if (addressExpression == null || !isDeletable) { publishRegisters(store.getAddress().getRegs()); } // On ambiguous address, give up on any address that could be stored here. - if (address == null || valueExpression == null) { + if (address == null || valueExpression == null || !isDeletable) { publishRegisters(store.getMemValue().getRegs()); } update(accesses, store, address); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ProcessingManager.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ProcessingManager.java index ae5794ba5d..5ade9d9656 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ProcessingManager.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ProcessingManager.java @@ -125,7 +125,10 @@ private ProcessingManager(Configuration config) throws InvalidConfigurationExcep reduceSymmetry ? SymmetryReduction.fromConfig(config) : null, intrinsics.lateInliningPass(), ProgramProcessor.fromFunctionProcessor( - MemToReg.fromConfig(config), Target.THREADS, true + FunctionProcessor.chain( + RemoveDeadNullChecks.newInstance(), + MemToReg.fromConfig(config) + ), Target.THREADS, true ), ProgramProcessor.fromFunctionProcessor( FunctionProcessor.chain( diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/RemoveDeadNullChecks.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/RemoveDeadNullChecks.java new file mode 100644 index 0000000000..451527c495 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/RemoveDeadNullChecks.java @@ -0,0 +1,184 @@ +package com.dat3m.dartagnan.program.processing; + +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.ExpressionVisitor; +import com.dat3m.dartagnan.expression.integers.*; +import com.dat3m.dartagnan.expression.misc.ITEExpr; +import com.dat3m.dartagnan.expression.processing.ExprTransformer; +import com.dat3m.dartagnan.program.Function; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.analysis.LoopAnalysis; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.event.EventVisitor; +import com.dat3m.dartagnan.program.event.RegReader; +import com.dat3m.dartagnan.program.event.RegWriter; +import com.dat3m.dartagnan.program.event.core.Alloc; +import com.dat3m.dartagnan.program.event.core.Local; +import com.dat3m.dartagnan.program.memory.MemoryObject; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.math.BigInteger; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.dat3m.dartagnan.expression.integers.IntBinaryOp.*; +import static com.dat3m.dartagnan.expression.integers.IntCmpOp.*; + +/* + This pass tries to remove unnecessary NULL checks in a very simple manner: + it tries to figure out the signedness of expressions and if they are always positive, then they cannot be NULL. + + The signedness is determined as follows: + - Registers written to by Allocs as well as MemoryObject expressions are always positive (allocations always succeed!) + - Positive constants are positive (duh). + - Some operations (like addition) preserve positiveness. + + TODO: The pass is very naive: it globally assigns a signedness to registers rather than per program point. + TODO 2: This pass only runs correctly on unrolled code and will skip functions with loops. + */ +public class RemoveDeadNullChecks implements FunctionProcessor { + + private final static Logger logger = LogManager.getLogger(RemoveDeadNullChecks.class) +; + private RemoveDeadNullChecks() { } + + public static RemoveDeadNullChecks newInstance() { return new RemoveDeadNullChecks(); } + + private enum Sign { + UNKNOWN, + NON_NEG, + POS; + + static Sign meet(Sign a, Sign b) { + if (a == UNKNOWN || b == UNKNOWN) { + return UNKNOWN; + } else if (a == NON_NEG || b == NON_NEG) { + return NON_NEG; + } + return POS; + } + } + + @Override + public void run(Function function) { + final List loops = LoopAnalysis.onFunction(function).getLoopsOfFunction(function); + if (loops.stream().anyMatch(loop -> !loop.isUnrolled())) { + logger.warn("Skipping null check deletion on function with loops: {}", function); + return; + } + + // Collects signs of registers. + final SignChecker signChecker = new SignChecker(); + function.getEvents().forEach(e -> e.accept(signChecker)); + + // Simplify null checks on always-positive (and hence non-null) expressions. + final NullCheckReplacer replacer = new NullCheckReplacer(signChecker); + function.getEvents(RegReader.class).forEach(reader -> reader.transformExpressions(replacer)); + + } + + private static class NullCheckReplacer extends ExprTransformer { + + private final SignChecker signChecker; + + private NullCheckReplacer(SignChecker signChecker) { + this.signChecker = signChecker; + } + + @Override + public Expression visitIntCmpExpression(IntCmpExpr cmp) { + if (cmp.getRight() instanceof IntLiteral lit && lit.isZero() && cmp.getLeft().accept(signChecker) == Sign.POS) { + // Simplify "expr cop 0" if is known to be positive. + final IntCmpOp op = cmp.getKind(); + final boolean valueOnNonNull = (op == NEQ || op == GT || op == GTE || op == UGT || op == UGTE); + return ExpressionFactory.getInstance().makeValue(valueOnNonNull); + } + return cmp; + } + } + + private static class SignChecker implements ExpressionVisitor, EventVisitor { + + private final Map signMap = new HashMap<>(); + + @Override + public Void visitEvent(Event e) { + if (e instanceof RegWriter writer) { + signMap.put(writer.getResultRegister(), Sign.UNKNOWN); + } + return null; + } + + @Override + public Void visitLocal(Local e) { + final Sign sign = e.getExpr().accept(this); + signMap.compute(e.getResultRegister(), (key, s) -> s == null ? sign : Sign.meet(s, sign)); + return null; + } + + @Override + public Void visitAlloc(Alloc e) { + final Sign sign = Sign.POS; + signMap.compute(e.getResultRegister(), (key, s) -> s == null ? sign : Sign.meet(s, sign)); + return null; + } + + + // ============================== Expressions ============================== + + @Override + public Sign visitExpression(Expression expr) { + return Sign.UNKNOWN; + } + + @Override + public Sign visitRegister(Register reg) { + return signMap.getOrDefault(reg, Sign.UNKNOWN); + } + + @Override + public Sign visitMemoryObject(MemoryObject memObj) { + return Sign.POS; + } + + @Override + public Sign visitFunction(Function function) { + return Sign.POS; + } + + @Override + public Sign visitIntLiteral(IntLiteral lit) { + final int cmpRes = lit.getValue().compareTo(BigInteger.ZERO); + return cmpRes > 0 ? Sign.POS : cmpRes == 0 ? Sign.NON_NEG : Sign.UNKNOWN; + } + + @Override + public Sign visitIntBinaryExpression(IntBinaryExpr expr) { + final Sign leftSign = expr.getLeft().accept(this); + final Sign rightSign = expr.getRight().accept(this); + if (leftSign == Sign.UNKNOWN || rightSign == Sign.UNKNOWN) { + return Sign.UNKNOWN; + } + + // --- Both subexpressions are (at least) non-negative --- + final IntBinaryOp op = expr.getKind(); + if ((leftSign == Sign.POS || rightSign == Sign.POS) && op == ADD) { + return Sign.POS; + } else if (op == MUL || op == UREM || op == UDIV) { + return Sign.NON_NEG; + } + // TODO: We can add more cases for precision, but the above already works quite well + return Sign.UNKNOWN; + } + + @Override + public Sign visitITEExpression(ITEExpr expr) { + return Sign.meet(expr.getTrueCase().accept(this), expr.getFalseCase().accept(this)); + } + + } + +} From 3291aa030a44cb3af04da765427bf596c308a840 Mon Sep 17 00:00:00 2001 From: Hernan Ponce de Leon Date: Mon, 17 Jun 2024 11:11:03 +0200 Subject: [PATCH 12/28] Model locks as spinloops to avoid wrong liveness bugs (#695) Signed-off-by: Hernan Ponce de Leon Co-authored-by: Hernan Ponce de Leon --- benchmarks/locks/deadlock.c | 22 ++ benchmarks/locks/pthread_mutex.c | 28 ++ .../program/processing/Intrinsics.java | 48 ++- .../program/processing/ProcessingManager.java | 2 +- .../processing/compilation/VisitorArm8.java | 2 + .../processing/compilation/VisitorBase.java | 37 +-- .../processing/compilation/VisitorLKMM.java | 20 +- .../processing/compilation/VisitorPower.java | 2 + .../processing/compilation/VisitorRISCV.java | 2 + .../processing/compilation/VisitorTso.java | 2 + .../com/dat3m/dartagnan/c/C11LocksTest.java | 1 + .../com/dat3m/dartagnan/c/LivenessTest.java | 4 + .../src/test/resources/locks/deadlock.ll | 123 ++++++++ .../src/test/resources/locks/pthread_mutex.ll | 285 ++++++++---------- 14 files changed, 378 insertions(+), 200 deletions(-) create mode 100644 benchmarks/locks/deadlock.c create mode 100644 benchmarks/locks/pthread_mutex.c create mode 100644 dartagnan/src/test/resources/locks/deadlock.ll diff --git a/benchmarks/locks/deadlock.c b/benchmarks/locks/deadlock.c new file mode 100644 index 0000000000..e9f4abc204 --- /dev/null +++ b/benchmarks/locks/deadlock.c @@ -0,0 +1,22 @@ +#include +#include + +pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; + +void *thread(void *unused) +{ + pthread_mutex_lock(&mutex); + return NULL; +} + +int main() +{ + pthread_t t1, t2; + + pthread_mutex_init(&mutex, 0); + + pthread_create(&t1, NULL, thread, NULL); + pthread_create(&t2, NULL, thread, NULL); + + return 0; +} diff --git a/benchmarks/locks/pthread_mutex.c b/benchmarks/locks/pthread_mutex.c new file mode 100644 index 0000000000..c122ec319a --- /dev/null +++ b/benchmarks/locks/pthread_mutex.c @@ -0,0 +1,28 @@ +#include +#include + +pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; +int x; + +void *thread(void *unused) +{ + pthread_mutex_lock(&mutex); + x++; + pthread_mutex_unlock(&mutex); + return NULL; +} + +int main() +{ + pthread_t t1, t2; + + pthread_create(&t1, NULL, thread, NULL); + pthread_create(&t2, NULL, thread, NULL); + + pthread_join(t1, NULL); + pthread_join(t2, NULL); + + assert(x == 2); + + return 0; +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java index e83adf9e63..db2871e546 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java @@ -483,6 +483,7 @@ private List inlinePthreadCondWait(FunctionCall call) { final Register errorRegister = getResultRegisterAndCheckArguments(2, call); //final Expression condAddress = call.getArguments().get(0); final Expression lockAddress = call.getArguments().get(1); + // TODO: implement this without lock/unlock events and get rid of them return List.of( // Allow other threads to access the condition variable. EventFactory.Pthread.newUnlock(lockAddress.toString(), lockAddress), @@ -590,12 +591,14 @@ private List inlinePthreadSetSpecific(FunctionCall call) { private List inlinePthreadMutexInit(FunctionCall call) { //see https://linux.die.net/man/3/pthread_mutex_init + //TODO use attributes final Register errorRegister = getResultRegisterAndCheckArguments(2, call); final Expression lockAddress = call.getArguments().get(0); - final Expression attributes = call.getArguments().get(1); - final String lockName = lockAddress.toString(); + // FIXME: We currently use bv32 in InitLock, Lock and Unlock. + final IntegerType type = types.getIntegerType(32); + final Expression unlocked = expressions.makeZero(type); return List.of( - EventFactory.Pthread.newInitLock(lockName, lockAddress, attributes), + EventFactory.Llvm.newStore(lockAddress, unlocked, Tag.C11.MO_RELEASE), assignSuccess(errorRegister) ); } @@ -612,11 +615,25 @@ private List inlinePthreadMutexDestroy(FunctionCall call) { private List inlinePthreadMutexLock(FunctionCall call) { //see https://linux.die.net/man/3/pthread_mutex_lock final Register errorRegister = getResultRegisterAndCheckArguments(1, call); + checkArgument(errorRegister.getType() instanceof IntegerType, "Wrong return type for \"%s\"", call); + // FIXME: We currently use bv32 in InitLock, Lock and Unlock. + final IntegerType type = types.getIntegerType(32); + final Register oldValueRegister = call.getFunction().newRegister(type); + final Register successRegister = call.getFunction().newRegister(types.getBooleanType()); final Expression lockAddress = call.getArguments().get(0); - final String lockName = lockAddress.toString(); + final Expression locked = expressions.makeOne(type); + final Expression unlocked = expressions.makeZero(type); + final Expression fail = expressions.makeNot(successRegister); + final Label spinLoopHead = EventFactory.newLabel("__spinloop_head"); + final Label spinLoopEnd = EventFactory.newLabel("__spinloop_end"); + // We implement this as a caslocks return List.of( - EventFactory.Pthread.newLock(lockName, lockAddress), - assignSuccess(errorRegister) + spinLoopHead, + EventFactory.Llvm.newCompareExchange(oldValueRegister, successRegister, lockAddress, unlocked, locked, Tag.C11.MO_ACQUIRE, true), + EventFactory.newJump(successRegister, spinLoopEnd), + EventFactory.newGoto(spinLoopHead), + spinLoopEnd, + EventFactory.newLocal(errorRegister, expressions.makeCast(fail, errorRegister.getType())) ); } @@ -624,12 +641,13 @@ private List inlinePthreadMutexTryLock(FunctionCall call) { //see https://linux.die.net/man/3/pthread_mutex_trylock final Register errorRegister = getResultRegisterAndCheckArguments(1, call); checkArgument(errorRegister.getType() instanceof IntegerType, "Wrong return type for \"%s\"", call); - // We currently use archType in InitLock, Lock and Unlock. - final Register oldValueRegister = call.getFunction().newRegister(types.getArchType()); + // FIXME: We currently use bv32 in InitLock, Lock and Unlock. + final IntegerType type = types.getIntegerType(32); + final Register oldValueRegister = call.getFunction().newRegister(type); final Register successRegister = call.getFunction().newRegister(types.getBooleanType()); final Expression lockAddress = call.getArguments().get(0); - final Expression locked = expressions.makeOne(types.getArchType()); - final Expression unlocked = expressions.makeZero(types.getArchType()); + final Expression locked = expressions.makeOne(type); + final Expression unlocked = expressions.makeZero(type); final Expression fail = expressions.makeNot(successRegister); return List.of( EventFactory.Llvm.newCompareExchange(oldValueRegister, successRegister, lockAddress, unlocked, locked, Tag.C11.MO_ACQUIRE), @@ -640,10 +658,16 @@ private List inlinePthreadMutexTryLock(FunctionCall call) { private List inlinePthreadMutexUnlock(FunctionCall call) { //see https://linux.die.net/man/3/pthread_mutex_unlock final Register errorRegister = getResultRegisterAndCheckArguments(1, call); + // FIXME: We currently use bv32 in InitLock, Lock and Unlock. + final IntegerType type = types.getIntegerType(32); + final Register oldValueRegister = call.getFunction().newRegister(type); final Expression lockAddress = call.getArguments().get(0); - final String lockName = lockAddress.toString(); + final Expression locked = expressions.makeOne(type); + final Expression unlocked = expressions.makeZero(type); return List.of( - EventFactory.Pthread.newUnlock(lockName, lockAddress), + EventFactory.Llvm.newLoad(oldValueRegister, lockAddress, Tag.C11.MO_RELAXED), + EventFactory.newAssert(expressions.makeEQ(oldValueRegister, locked), "Unlocking an already unlocked mutex"), + EventFactory.Llvm.newStore(lockAddress, unlocked, Tag.C11.MO_RELEASE), assignSuccess(errorRegister) ); } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ProcessingManager.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ProcessingManager.java index 5ade9d9656..b9b6d1fd8d 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ProcessingManager.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ProcessingManager.java @@ -104,8 +104,8 @@ private ProcessingManager(Configuration config) throws InvalidConfigurationExcep RegisterDecomposition.newInstance(), RemoveDeadFunctions.newInstance(), printAfterSimplification ? DebugPrint.withHeader("After simplification", Printer.Mode.ALL) : null, - LoopFormVerification.fromConfig(config), Compilation.fromConfig(config), // We keep compilation global for now + LoopFormVerification.fromConfig(config), printAfterCompilation ? DebugPrint.withHeader("After compilation", Printer.Mode.ALL) : null, ProgramProcessor.fromFunctionProcessor(MemToReg.fromConfig(config), Target.FUNCTIONS, true), ProgramProcessor.fromFunctionProcessor(sccp, Target.FUNCTIONS, false), diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorArm8.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorArm8.java index 3321e9a9e3..e10937a3b7 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorArm8.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorArm8.java @@ -64,6 +64,8 @@ public List visitLock(Lock e) { // We implement locks as spinlocks which are guaranteed to succeed, i.e. we can use // assumes. With this we miss a ctrl dependency, but this does not matter // because the load is an acquire one. + // TODO: Lock events are only used for implementing condvar intrinsic. + // If we have an alternative implementation for that, we can get rid of these events. return eventSequence( newRMWLoadExclusiveWithMo(dummy, e.getAddress(), ARMv8.MO_ACQ), newAssume(expressions.makeEQ(dummy, zero)), diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorBase.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorBase.java index f1020d8055..6283492ecb 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorBase.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorBase.java @@ -6,14 +6,11 @@ import com.dat3m.dartagnan.expression.type.TypeFactory; import com.dat3m.dartagnan.program.Function; import com.dat3m.dartagnan.program.Register; -import com.dat3m.dartagnan.program.Thread; import com.dat3m.dartagnan.program.event.Event; import com.dat3m.dartagnan.program.event.EventVisitor; import com.dat3m.dartagnan.program.event.arch.StoreExclusive; import com.dat3m.dartagnan.program.event.arch.tso.TSOXchg; -import com.dat3m.dartagnan.program.event.core.Label; import com.dat3m.dartagnan.program.event.core.Load; -import com.dat3m.dartagnan.program.event.core.RMWStore; import com.dat3m.dartagnan.program.event.lang.linux.*; import com.dat3m.dartagnan.program.event.lang.llvm.LlvmLoad; import com.dat3m.dartagnan.program.event.lang.llvm.LlvmStore; @@ -35,14 +32,6 @@ class VisitorBase implements EventVisitor> { protected VisitorBase() { } - protected Event newTerminator(Expression guard) { - if (funcToBeCompiled instanceof Thread thread) { - return newJump(guard, (Label)thread.getExit()); - } else { - return newAbortIf(guard); - } - } - @Override public List visitEvent(Event e) { return Collections.singletonList(e); @@ -57,34 +46,36 @@ public List visitInitLock(InitLock e) { @Override public List visitLock(Lock e) { - IntegerType type = (IntegerType) e.getAccessType(); // TODO: Boolean should be sufficient - Register dummy = e.getFunction().newRegister(type); + IntegerType type = (IntegerType)e.getAccessType(); Expression zero = expressions.makeZero(type); Expression one = expressions.makeOne(type); + Register dummy = e.getFunction().newRegister(type); + Expression address = e.getAddress(); String mo = e.getMo(); - Load rmwLoad = newRMWLoadWithMo(dummy, e.getAddress(), mo); + Load rmwLoad = newRMWLoadWithMo(dummy, address, mo); + + // We implement locks as spinlocks which are guaranteed to succeed, i.e. we can use + // assumes. With this we miss a ctrl dependency, but this does not matter + // because the load is SC. + // TODO: Lock events are only used for implementing condvar intrinsic. + // If we have an alternative implementation for that, we can get rid of these events. return eventSequence( rmwLoad, - newTerminator(expressions.makeNEQ(dummy, zero)), - newRMWStoreWithMo(rmwLoad, e.getAddress(), one, mo) + newAssume(expressions.makeEQ(dummy, zero)), + newRMWStoreWithMo(rmwLoad, address, one, mo) ); } @Override public List visitUnlock(Unlock e) { - IntegerType type = (IntegerType) e.getAccessType(); // TODO: Boolean should be sufficient - Register dummy = e.getFunction().newRegister(type); + IntegerType type = (IntegerType)e.getAccessType(); Expression zero = expressions.makeZero(type); - Expression one = expressions.makeOne(type); Expression address = e.getAddress(); String mo = e.getMo(); - Load rmwLoad = newRMWLoadWithMo(dummy, address, mo); return eventSequence( - rmwLoad, - newTerminator(expressions.makeNEQ(dummy, one)), - newRMWStoreWithMo(rmwLoad, address, zero, mo) + newStoreWithMo(address, zero, mo) ); } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorLKMM.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorLKMM.java index 262007dbeb..b448471580 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorLKMM.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorLKMM.java @@ -2,11 +2,14 @@ import com.dat3m.dartagnan.expression.Expression; import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.Type; import com.dat3m.dartagnan.expression.type.IntegerType; import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.Program.SourceLanguage; import com.dat3m.dartagnan.program.event.Event; import com.dat3m.dartagnan.program.event.EventFactory; import com.dat3m.dartagnan.program.event.Tag; +import com.dat3m.dartagnan.program.event.core.CondJump; import com.dat3m.dartagnan.program.event.core.Label; import com.dat3m.dartagnan.program.event.core.Load; import com.dat3m.dartagnan.program.event.core.RMWStore; @@ -202,17 +205,24 @@ public List visitLKMMXchg(LKMMXchg e) { @Override public List visitLKMMLock(LKMMLock e) { - Register dummy = e.getFunction().newRegister(e.getAccessType()); - Expression nonzeroDummy = expressions.makeBooleanCast(dummy); + boolean litmusFormat = e.getFunction().getProgram().getFormat().equals(LITMUS); + IntegerType type = (IntegerType) e.getAccessType(); // TODO: Boolean should be sufficient + Register dummy = e.getFunction().newRegister(type); + Expression zeroDummy = expressions.makeNot(expressions.makeBooleanCast(dummy)); Load lockRead = newLockRead(dummy, e.getLock()); + Label spinLoopHead = litmusFormat ? null : newLabel("__spinloop_head"); + Label spinLoopEnd = litmusFormat ? null : newLabel("__spinloop_end"); + CondJump gotoHead = litmusFormat ? null : newGoto(spinLoopHead); // In litmus tests, spin locks are guaranteed to succeed, i.e. its read part gets value 0 - Event checkLockValue = e.getFunction().getProgram().getFormat().equals(LITMUS) ? - newAssume(expressions.makeNot(nonzeroDummy)) : - newTerminator(nonzeroDummy); + Event checkLockValue = litmusFormat ? newAssume(zeroDummy) : newJump(zeroDummy, spinLoopEnd); + return eventSequence( + spinLoopHead, lockRead, checkLockValue, + gotoHead, + spinLoopEnd, newLockWrite(lockRead, e.getLock()) ); } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorPower.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorPower.java index c6a11c88ea..7203312258 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorPower.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorPower.java @@ -58,6 +58,8 @@ public List visitLock(Lock e) { Label label = newLabel("FakeDep"); // We implement locks as spinlocks which are guaranteed to succeed, i.e. we can // use assumes. The fake control dependency + isync guarantee acquire semantics. + // TODO: Lock events are only used for implementing condvar intrinsic. + // If we have an alternative implementation for that, we can get rid of these events. return eventSequence( newRMWLoadExclusive(dummy, e.getAddress()), newAssume(expressions.makeNot(expressions.makeBooleanCast(dummy))), diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorRISCV.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorRISCV.java index f063584c51..93214c3d94 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorRISCV.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorRISCV.java @@ -68,6 +68,8 @@ public List visitLock(Lock e) { // We implement locks as spinlocks which are guaranteed to succeed, i.e. we can use // assumes. With this we miss a ctrl dependency, but this does not matter // because of the fence. + // TODO: Lock events are only used for implementing condvar intrinsic. + // If we have an alternative implementation for that, we can get rid of these events. return eventSequence( newRMWLoadExclusive(dummy, e.getAddress()), newAssume(expressions.makeEQ(dummy, zero)), diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorTso.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorTso.java index fe11c98690..71f354024f 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorTso.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorTso.java @@ -55,6 +55,8 @@ public List visitLock(Lock e) { Register dummy = e.getFunction().newRegister(type); // We implement locks as spinlocks which are guaranteed to succeed, i.e. we can // use assumes. Nothing else is needed to guarantee acquire semantics in TSO. + // TODO: Lock events are only used for implementing condvar intrinsic. + // If we have an alternative implementation for that, we can get rid of these events. Load load = newRMWLoad(dummy, e.getAddress()); return eventSequence( load, diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/c/C11LocksTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/c/C11LocksTest.java index f8978577f2..b9d50c1e27 100644 --- a/dartagnan/src/test/java/com/dat3m/dartagnan/c/C11LocksTest.java +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/c/C11LocksTest.java @@ -72,6 +72,7 @@ public static Iterable data() throws IOException { {"clh_mutex-acq2rx", C11, FAIL}, {"ticket_awnsb_mutex", C11, PASS}, {"ticket_awnsb_mutex-acq2rx", C11, FAIL}, + {"pthread_mutex", C11, PASS}, }); } diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/c/LivenessTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/c/LivenessTest.java index 3884a67961..db0f76a0d9 100644 --- a/dartagnan/src/test/java/com/dat3m/dartagnan/c/LivenessTest.java +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/c/LivenessTest.java @@ -133,6 +133,10 @@ public static Iterable data() throws IOException { {"lkmm/qspinlock-liveness", ARM8, PASS}, {"lkmm/qspinlock-liveness", POWER, PASS}, {"lkmm/qspinlock-liveness", RISCV, PASS}, + {"locks/deadlock", TSO, FAIL}, + {"locks/deadlock", ARM8, FAIL}, + {"locks/deadlock", POWER, FAIL}, + {"locks/deadlock", RISCV, FAIL}, }); } diff --git a/dartagnan/src/test/resources/locks/deadlock.ll b/dartagnan/src/test/resources/locks/deadlock.ll new file mode 100644 index 0000000000..4968217cb1 --- /dev/null +++ b/dartagnan/src/test/resources/locks/deadlock.ll @@ -0,0 +1,123 @@ +; ModuleID = '/home/ponce/git/Dat3M/output/deadlock.ll' +source_filename = "/home/ponce/git/Dat3M/benchmarks/locks/deadlock.c" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-pc-linux-gnu" + +%union.pthread_mutex_t = type { %struct.__pthread_mutex_s } +%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list } +%struct.__pthread_internal_list = type { %struct.__pthread_internal_list*, %struct.__pthread_internal_list* } +%union.pthread_mutexattr_t = type { i32 } +%union.pthread_attr_t = type { i64, [48 x i8] } + +@mutex = dso_local global %union.pthread_mutex_t zeroinitializer, align 8, !dbg !0 + +; Function Attrs: noinline nounwind uwtable +define dso_local i8* @thread(i8* %0) #0 !dbg !46 { + %2 = alloca i8*, align 8 + store i8* %0, i8** %2, align 8 + call void @llvm.dbg.declare(metadata i8** %2, metadata !49, metadata !DIExpression()), !dbg !50 + %3 = call i32 @pthread_mutex_lock(%union.pthread_mutex_t* @mutex) #3, !dbg !51 + ret i8* null, !dbg !52 +} + +; Function Attrs: nofree nosync nounwind readnone speculatable willreturn +declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 + +; Function Attrs: nounwind +declare dso_local i32 @pthread_mutex_lock(%union.pthread_mutex_t*) #2 + +; Function Attrs: noinline nounwind uwtable +define dso_local i32 @main() #0 !dbg !53 { + %1 = alloca i32, align 4 + %2 = alloca i64, align 8 + %3 = alloca i64, align 8 + store i32 0, i32* %1, align 4 + call void @llvm.dbg.declare(metadata i64* %2, metadata !56, metadata !DIExpression()), !dbg !59 + call void @llvm.dbg.declare(metadata i64* %3, metadata !60, metadata !DIExpression()), !dbg !61 + %4 = call i32 @pthread_mutex_init(%union.pthread_mutex_t* @mutex, %union.pthread_mutexattr_t* null) #3, !dbg !62 + %5 = call i32 @pthread_create(i64* %2, %union.pthread_attr_t* null, i8* (i8*)* @thread, i8* null) #3, !dbg !63 + %6 = call i32 @pthread_create(i64* %3, %union.pthread_attr_t* null, i8* (i8*)* @thread, i8* null) #3, !dbg !64 + ret i32 0, !dbg !65 +} + +; Function Attrs: nounwind +declare dso_local i32 @pthread_mutex_init(%union.pthread_mutex_t*, %union.pthread_mutexattr_t*) #2 + +; Function Attrs: nounwind +declare dso_local i32 @pthread_create(i64*, %union.pthread_attr_t*, i8* (i8*)*, i8*) #2 + +attributes #0 = { noinline nounwind uwtable "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nofree nosync nounwind readnone speculatable willreturn } +attributes #2 = { nounwind "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #3 = { nounwind } + +!llvm.dbg.cu = !{!2} +!llvm.module.flags = !{!42, !43, !44} +!llvm.ident = !{!45} + +!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) +!1 = distinct !DIGlobalVariable(name: "mutex", scope: !2, file: !8, line: 4, type: !9, isLocal: false, isDefinition: true) +!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "Ubuntu clang version 12.0.0-3ubuntu1~20.04.5", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !5, globals: !7, splitDebugInlining: false, nameTableKind: None) +!3 = !DIFile(filename: "/home/ponce/git/Dat3M/benchmarks/locks/deadlock.c", directory: "/home/ponce/git/Dat3M") +!4 = !{} +!5 = !{!6} +!6 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +!7 = !{!0} +!8 = !DIFile(filename: "benchmarks/locks/deadlock.c", directory: "/home/ponce/git/Dat3M") +!9 = !DIDerivedType(tag: DW_TAG_typedef, name: "pthread_mutex_t", file: !10, line: 72, baseType: !11) +!10 = !DIFile(filename: "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h", directory: "") +!11 = distinct !DICompositeType(tag: DW_TAG_union_type, file: !10, line: 67, size: 320, elements: !12) +!12 = !{!13, !35, !40} +!13 = !DIDerivedType(tag: DW_TAG_member, name: "__data", scope: !11, file: !10, line: 69, baseType: !14, size: 320) +!14 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "__pthread_mutex_s", file: !15, line: 22, size: 320, elements: !16) +!15 = !DIFile(filename: "/usr/include/x86_64-linux-gnu/bits/struct_mutex.h", directory: "") +!16 = !{!17, !19, !21, !22, !23, !24, !26, !27} +!17 = !DIDerivedType(tag: DW_TAG_member, name: "__lock", scope: !14, file: !15, line: 24, baseType: !18, size: 32) +!18 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!19 = !DIDerivedType(tag: DW_TAG_member, name: "__count", scope: !14, file: !15, line: 25, baseType: !20, size: 32, offset: 32) +!20 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned) +!21 = !DIDerivedType(tag: DW_TAG_member, name: "__owner", scope: !14, file: !15, line: 26, baseType: !18, size: 32, offset: 64) +!22 = !DIDerivedType(tag: DW_TAG_member, name: "__nusers", scope: !14, file: !15, line: 28, baseType: !20, size: 32, offset: 96) +!23 = !DIDerivedType(tag: DW_TAG_member, name: "__kind", scope: !14, file: !15, line: 32, baseType: !18, size: 32, offset: 128) +!24 = !DIDerivedType(tag: DW_TAG_member, name: "__spins", scope: !14, file: !15, line: 34, baseType: !25, size: 16, offset: 160) +!25 = !DIBasicType(name: "short", size: 16, encoding: DW_ATE_signed) +!26 = !DIDerivedType(tag: DW_TAG_member, name: "__elision", scope: !14, file: !15, line: 35, baseType: !25, size: 16, offset: 176) +!27 = !DIDerivedType(tag: DW_TAG_member, name: "__list", scope: !14, file: !15, line: 36, baseType: !28, size: 128, offset: 192) +!28 = !DIDerivedType(tag: DW_TAG_typedef, name: "__pthread_list_t", file: !29, line: 53, baseType: !30) +!29 = !DIFile(filename: "/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h", directory: "") +!30 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "__pthread_internal_list", file: !29, line: 49, size: 128, elements: !31) +!31 = !{!32, !34} +!32 = !DIDerivedType(tag: DW_TAG_member, name: "__prev", scope: !30, file: !29, line: 51, baseType: !33, size: 64) +!33 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !30, size: 64) +!34 = !DIDerivedType(tag: DW_TAG_member, name: "__next", scope: !30, file: !29, line: 52, baseType: !33, size: 64, offset: 64) +!35 = !DIDerivedType(tag: DW_TAG_member, name: "__size", scope: !11, file: !10, line: 70, baseType: !36, size: 320) +!36 = !DICompositeType(tag: DW_TAG_array_type, baseType: !37, size: 320, elements: !38) +!37 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) +!38 = !{!39} +!39 = !DISubrange(count: 40) +!40 = !DIDerivedType(tag: DW_TAG_member, name: "__align", scope: !11, file: !10, line: 71, baseType: !41, size: 64) +!41 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed) +!42 = !{i32 7, !"Dwarf Version", i32 4} +!43 = !{i32 2, !"Debug Info Version", i32 3} +!44 = !{i32 1, !"wchar_size", i32 4} +!45 = !{!"Ubuntu clang version 12.0.0-3ubuntu1~20.04.5"} +!46 = distinct !DISubprogram(name: "thread", scope: !8, file: !8, line: 6, type: !47, scopeLine: 7, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4) +!47 = !DISubroutineType(types: !48) +!48 = !{!6, !6} +!49 = !DILocalVariable(name: "unused", arg: 1, scope: !46, file: !8, line: 6, type: !6) +!50 = !DILocation(line: 6, column: 20, scope: !46) +!51 = !DILocation(line: 8, column: 5, scope: !46) +!52 = !DILocation(line: 9, column: 5, scope: !46) +!53 = distinct !DISubprogram(name: "main", scope: !8, file: !8, line: 12, type: !54, scopeLine: 13, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4) +!54 = !DISubroutineType(types: !55) +!55 = !{!18} +!56 = !DILocalVariable(name: "t1", scope: !53, file: !8, line: 14, type: !57) +!57 = !DIDerivedType(tag: DW_TAG_typedef, name: "pthread_t", file: !10, line: 27, baseType: !58) +!58 = !DIBasicType(name: "long unsigned int", size: 64, encoding: DW_ATE_unsigned) +!59 = !DILocation(line: 14, column: 15, scope: !53) +!60 = !DILocalVariable(name: "t2", scope: !53, file: !8, line: 14, type: !57) +!61 = !DILocation(line: 14, column: 19, scope: !53) +!62 = !DILocation(line: 16, column: 5, scope: !53) +!63 = !DILocation(line: 18, column: 5, scope: !53) +!64 = !DILocation(line: 19, column: 5, scope: !53) +!65 = !DILocation(line: 21, column: 5, scope: !53) diff --git a/dartagnan/src/test/resources/locks/pthread_mutex.ll b/dartagnan/src/test/resources/locks/pthread_mutex.ll index dcd2e854db..eca5bad704 100644 --- a/dartagnan/src/test/resources/locks/pthread_mutex.ll +++ b/dartagnan/src/test/resources/locks/pthread_mutex.ll @@ -6,192 +6,159 @@ target triple = "x86_64-pc-linux-gnu" %union.pthread_mutex_t = type { %struct.__pthread_mutex_s } %struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list } %struct.__pthread_internal_list = type { %struct.__pthread_internal_list*, %struct.__pthread_internal_list* } -%union.pthread_mutexattr_t = type { i32 } %union.pthread_attr_t = type { i64, [48 x i8] } -@m = dso_local global %union.pthread_mutex_t zeroinitializer, align 8, !dbg !0 -@sum = dso_local global i32 0, align 4, !dbg !7 -@.str = private unnamed_addr constant [16 x i8] c"sum == NTHREADS\00", align 1 +@mutex = dso_local global %union.pthread_mutex_t zeroinitializer, align 8, !dbg !0 +@x = dso_local global i32 0, align 4, !dbg !8 +@.str = private unnamed_addr constant [7 x i8] c"x == 2\00", align 1 @.str.1 = private unnamed_addr constant [55 x i8] c"/home/ponce/git/Dat3M/benchmarks/locks/pthread_mutex.c\00", align 1 @__PRETTY_FUNCTION__.main = private unnamed_addr constant [11 x i8] c"int main()\00", align 1 ; Function Attrs: noinline nounwind uwtable -define dso_local i8* @run(i8* noundef %0) #0 !dbg !51 { - call void @llvm.dbg.value(metadata i8* %0, metadata !55, metadata !DIExpression()), !dbg !56 - %2 = call i32 @pthread_mutex_lock(%union.pthread_mutex_t* noundef @m) #5, !dbg !57 - %3 = load i32, i32* @sum, align 4, !dbg !58 - %4 = add nsw i32 %3, 1, !dbg !58 - store i32 %4, i32* @sum, align 4, !dbg !58 - %5 = call i32 @pthread_mutex_unlock(%union.pthread_mutex_t* noundef @m) #5, !dbg !59 - ret i8* null, !dbg !60 +define dso_local i8* @thread(i8* %0) #0 !dbg !48 { + %2 = alloca i8*, align 8 + store i8* %0, i8** %2, align 8 + call void @llvm.dbg.declare(metadata i8** %2, metadata !51, metadata !DIExpression()), !dbg !52 + %3 = call i32 @pthread_mutex_lock(%union.pthread_mutex_t* @mutex) #5, !dbg !53 + %4 = load i32, i32* @x, align 4, !dbg !54 + %5 = add nsw i32 %4, 1, !dbg !54 + store i32 %5, i32* @x, align 4, !dbg !54 + %6 = call i32 @pthread_mutex_unlock(%union.pthread_mutex_t* @mutex) #5, !dbg !55 + ret i8* null, !dbg !56 } ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 ; Function Attrs: nounwind -declare i32 @pthread_mutex_lock(%union.pthread_mutex_t* noundef) #2 +declare dso_local i32 @pthread_mutex_lock(%union.pthread_mutex_t*) #2 ; Function Attrs: nounwind -declare i32 @pthread_mutex_unlock(%union.pthread_mutex_t* noundef) #2 +declare dso_local i32 @pthread_mutex_unlock(%union.pthread_mutex_t*) #2 ; Function Attrs: noinline nounwind uwtable -define dso_local i32 @main() #0 !dbg !61 { - %1 = alloca [3 x i64], align 16 - call void @llvm.dbg.declare(metadata [3 x i64]* %1, metadata !64, metadata !DIExpression()), !dbg !70 - %2 = call i32 @pthread_mutex_init(%union.pthread_mutex_t* noundef @m, %union.pthread_mutexattr_t* noundef null) #5, !dbg !71 - call void @llvm.dbg.value(metadata i32 0, metadata !72, metadata !DIExpression()), !dbg !74 - call void @llvm.dbg.value(metadata i64 0, metadata !72, metadata !DIExpression()), !dbg !74 - %3 = getelementptr inbounds [3 x i64], [3 x i64]* %1, i64 0, i64 0, !dbg !75 - %4 = call i32 @pthread_create(i64* noundef %3, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @run, i8* noundef null) #5, !dbg !77 - call void @llvm.dbg.value(metadata i64 1, metadata !72, metadata !DIExpression()), !dbg !74 - call void @llvm.dbg.value(metadata i64 1, metadata !72, metadata !DIExpression()), !dbg !74 - %5 = getelementptr inbounds [3 x i64], [3 x i64]* %1, i64 0, i64 1, !dbg !75 - %6 = call i32 @pthread_create(i64* noundef %5, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @run, i8* noundef inttoptr (i64 1 to i8*)) #5, !dbg !77 - call void @llvm.dbg.value(metadata i64 2, metadata !72, metadata !DIExpression()), !dbg !74 - call void @llvm.dbg.value(metadata i64 2, metadata !72, metadata !DIExpression()), !dbg !74 - %7 = getelementptr inbounds [3 x i64], [3 x i64]* %1, i64 0, i64 2, !dbg !75 - %8 = call i32 @pthread_create(i64* noundef %7, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @run, i8* noundef inttoptr (i64 2 to i8*)) #5, !dbg !77 - call void @llvm.dbg.value(metadata i64 3, metadata !72, metadata !DIExpression()), !dbg !74 - call void @llvm.dbg.value(metadata i64 3, metadata !72, metadata !DIExpression()), !dbg !74 - call void @llvm.dbg.value(metadata i32 0, metadata !78, metadata !DIExpression()), !dbg !80 - call void @llvm.dbg.value(metadata i64 0, metadata !78, metadata !DIExpression()), !dbg !80 - %9 = load i64, i64* %3, align 8, !dbg !81 - %10 = call i32 @pthread_join(i64 noundef %9, i8** noundef null), !dbg !83 - call void @llvm.dbg.value(metadata i64 1, metadata !78, metadata !DIExpression()), !dbg !80 - call void @llvm.dbg.value(metadata i64 1, metadata !78, metadata !DIExpression()), !dbg !80 - %11 = load i64, i64* %5, align 8, !dbg !81 - %12 = call i32 @pthread_join(i64 noundef %11, i8** noundef null), !dbg !83 - call void @llvm.dbg.value(metadata i64 2, metadata !78, metadata !DIExpression()), !dbg !80 - call void @llvm.dbg.value(metadata i64 2, metadata !78, metadata !DIExpression()), !dbg !80 - %13 = load i64, i64* %7, align 8, !dbg !81 - %14 = call i32 @pthread_join(i64 noundef %13, i8** noundef null), !dbg !83 - call void @llvm.dbg.value(metadata i64 3, metadata !78, metadata !DIExpression()), !dbg !80 - call void @llvm.dbg.value(metadata i64 3, metadata !78, metadata !DIExpression()), !dbg !80 - %15 = load i32, i32* @sum, align 4, !dbg !84 - %16 = icmp eq i32 %15, 3, !dbg !84 - br i1 %16, label %18, label %17, !dbg !87 - -17: ; preds = %0 - call void @__assert_fail(i8* noundef getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* noundef getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i32 noundef 33, i8* noundef getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #6, !dbg !84 - unreachable, !dbg !84 - -18: ; preds = %0 - ret i32 0, !dbg !88 +define dso_local i32 @main() #0 !dbg !57 { + %1 = alloca i32, align 4 + %2 = alloca i64, align 8 + %3 = alloca i64, align 8 + store i32 0, i32* %1, align 4 + call void @llvm.dbg.declare(metadata i64* %2, metadata !60, metadata !DIExpression()), !dbg !63 + call void @llvm.dbg.declare(metadata i64* %3, metadata !64, metadata !DIExpression()), !dbg !65 + %4 = call i32 @pthread_create(i64* %2, %union.pthread_attr_t* null, i8* (i8*)* @thread, i8* null) #5, !dbg !66 + %5 = call i32 @pthread_create(i64* %3, %union.pthread_attr_t* null, i8* (i8*)* @thread, i8* null) #5, !dbg !67 + %6 = load i64, i64* %2, align 8, !dbg !68 + %7 = call i32 @pthread_join(i64 %6, i8** null), !dbg !69 + %8 = load i64, i64* %3, align 8, !dbg !70 + %9 = call i32 @pthread_join(i64 %8, i8** null), !dbg !71 + %10 = load i32, i32* @x, align 4, !dbg !72 + %11 = icmp eq i32 %10, 2, !dbg !72 + br i1 %11, label %12, label %13, !dbg !75 + +12: ; preds = %0 + br label %14, !dbg !75 + +13: ; preds = %0 + call void @__assert_fail(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i32 25, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #6, !dbg !72 + unreachable, !dbg !72 + +14: ; preds = %12 + ret i32 0, !dbg !76 } ; Function Attrs: nounwind -declare i32 @pthread_mutex_init(%union.pthread_mutex_t* noundef, %union.pthread_mutexattr_t* noundef) #2 +declare dso_local i32 @pthread_create(i64*, %union.pthread_attr_t*, i8* (i8*)*, i8*) #2 -; Function Attrs: nounwind -declare i32 @pthread_create(i64* noundef, %union.pthread_attr_t* noundef, i8* (i8*)* noundef, i8* noundef) #2 - -declare i32 @pthread_join(i64 noundef, i8** noundef) #3 +declare dso_local i32 @pthread_join(i64, i8**) #3 ; Function Attrs: noreturn nounwind -declare void @__assert_fail(i8* noundef, i8* noundef, i32 noundef, i8* noundef) #4 - -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.value(metadata, metadata, metadata) #1 +declare dso_local void @__assert_fail(i8*, i8*, i32, i8*) #4 -attributes #0 = { noinline nounwind uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +attributes #0 = { noinline nounwind uwtable "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" } attributes #1 = { nofree nosync nounwind readnone speculatable willreturn } -attributes #2 = { nounwind "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -attributes #3 = { "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -attributes #4 = { noreturn nounwind "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +attributes #2 = { nounwind "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #3 = { "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #4 = { noreturn nounwind "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" } attributes #5 = { nounwind } attributes #6 = { noreturn nounwind } !llvm.dbg.cu = !{!2} -!llvm.module.flags = !{!43, !44, !45, !46, !47, !48, !49} -!llvm.ident = !{!50} +!llvm.module.flags = !{!44, !45, !46} +!llvm.ident = !{!47} !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) -!1 = distinct !DIGlobalVariable(name: "m", scope: !2, file: !9, line: 7, type: !11, isLocal: false, isDefinition: true) -!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "Ubuntu clang version 14.0.6", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, retainedTypes: !4, globals: !6, splitDebugInlining: false, nameTableKind: None) -!3 = !DIFile(filename: "/home/ponce/git/Dat3M/benchmarks/locks/pthread_mutex.c", directory: "/home/ponce/git/Dat3M", checksumkind: CSK_MD5, checksum: "70888e8e826c3ef3a7105532af531b10") -!4 = !{!5} -!5 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) -!6 = !{!7, !0} -!7 = !DIGlobalVariableExpression(var: !8, expr: !DIExpression()) -!8 = distinct !DIGlobalVariable(name: "sum", scope: !2, file: !9, line: 6, type: !10, isLocal: false, isDefinition: true) -!9 = !DIFile(filename: "benchmarks/locks/pthread_mutex.c", directory: "/home/ponce/git/Dat3M", checksumkind: CSK_MD5, checksum: "70888e8e826c3ef3a7105532af531b10") -!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) -!11 = !DIDerivedType(tag: DW_TAG_typedef, name: "pthread_mutex_t", file: !12, line: 72, baseType: !13) -!12 = !DIFile(filename: "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h", directory: "", checksumkind: CSK_MD5, checksum: "2d764266ce95ab26d4a4767c2ec78176") -!13 = distinct !DICompositeType(tag: DW_TAG_union_type, file: !12, line: 67, size: 320, elements: !14) -!14 = !{!15, !36, !41} -!15 = !DIDerivedType(tag: DW_TAG_member, name: "__data", scope: !13, file: !12, line: 69, baseType: !16, size: 320) -!16 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "__pthread_mutex_s", file: !17, line: 22, size: 320, elements: !18) -!17 = !DIFile(filename: "/usr/include/x86_64-linux-gnu/bits/struct_mutex.h", directory: "", checksumkind: CSK_MD5, checksum: "3a896f588055d599ccb9e3fe6eaee3e3") -!18 = !{!19, !20, !22, !23, !24, !25, !27, !28} -!19 = !DIDerivedType(tag: DW_TAG_member, name: "__lock", scope: !16, file: !17, line: 24, baseType: !10, size: 32) -!20 = !DIDerivedType(tag: DW_TAG_member, name: "__count", scope: !16, file: !17, line: 25, baseType: !21, size: 32, offset: 32) -!21 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned) -!22 = !DIDerivedType(tag: DW_TAG_member, name: "__owner", scope: !16, file: !17, line: 26, baseType: !10, size: 32, offset: 64) -!23 = !DIDerivedType(tag: DW_TAG_member, name: "__nusers", scope: !16, file: !17, line: 28, baseType: !21, size: 32, offset: 96) -!24 = !DIDerivedType(tag: DW_TAG_member, name: "__kind", scope: !16, file: !17, line: 32, baseType: !10, size: 32, offset: 128) -!25 = !DIDerivedType(tag: DW_TAG_member, name: "__spins", scope: !16, file: !17, line: 34, baseType: !26, size: 16, offset: 160) -!26 = !DIBasicType(name: "short", size: 16, encoding: DW_ATE_signed) -!27 = !DIDerivedType(tag: DW_TAG_member, name: "__elision", scope: !16, file: !17, line: 35, baseType: !26, size: 16, offset: 176) -!28 = !DIDerivedType(tag: DW_TAG_member, name: "__list", scope: !16, file: !17, line: 36, baseType: !29, size: 128, offset: 192) -!29 = !DIDerivedType(tag: DW_TAG_typedef, name: "__pthread_list_t", file: !30, line: 53, baseType: !31) -!30 = !DIFile(filename: "/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h", directory: "", checksumkind: CSK_MD5, checksum: "4b8899127613e00869e96fcefd314d61") -!31 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "__pthread_internal_list", file: !30, line: 49, size: 128, elements: !32) -!32 = !{!33, !35} -!33 = !DIDerivedType(tag: DW_TAG_member, name: "__prev", scope: !31, file: !30, line: 51, baseType: !34, size: 64) -!34 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !31, size: 64) -!35 = !DIDerivedType(tag: DW_TAG_member, name: "__next", scope: !31, file: !30, line: 52, baseType: !34, size: 64, offset: 64) -!36 = !DIDerivedType(tag: DW_TAG_member, name: "__size", scope: !13, file: !12, line: 70, baseType: !37, size: 320) -!37 = !DICompositeType(tag: DW_TAG_array_type, baseType: !38, size: 320, elements: !39) -!38 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) -!39 = !{!40} -!40 = !DISubrange(count: 40) -!41 = !DIDerivedType(tag: DW_TAG_member, name: "__align", scope: !13, file: !12, line: 71, baseType: !42, size: 64) -!42 = !DIBasicType(name: "long", size: 64, encoding: DW_ATE_signed) -!43 = !{i32 7, !"Dwarf Version", i32 5} -!44 = !{i32 2, !"Debug Info Version", i32 3} -!45 = !{i32 1, !"wchar_size", i32 4} -!46 = !{i32 7, !"PIC Level", i32 2} -!47 = !{i32 7, !"PIE Level", i32 2} -!48 = !{i32 7, !"uwtable", i32 1} -!49 = !{i32 7, !"frame-pointer", i32 2} -!50 = !{!"Ubuntu clang version 14.0.6"} -!51 = distinct !DISubprogram(name: "run", scope: !9, file: !9, line: 13, type: !52, scopeLine: 14, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !54) -!52 = !DISubroutineType(types: !53) -!53 = !{!5, !5} -!54 = !{} -!55 = !DILocalVariable(name: "unused", arg: 1, scope: !51, file: !9, line: 13, type: !5) -!56 = !DILocation(line: 0, scope: !51) -!57 = !DILocation(line: 15, column: 5, scope: !51) -!58 = !DILocation(line: 16, column: 8, scope: !51) -!59 = !DILocation(line: 17, column: 5, scope: !51) -!60 = !DILocation(line: 18, column: 5, scope: !51) -!61 = distinct !DISubprogram(name: "main", scope: !9, file: !9, line: 21, type: !62, scopeLine: 22, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !54) -!62 = !DISubroutineType(types: !63) -!63 = !{!10} -!64 = !DILocalVariable(name: "t", scope: !61, file: !9, line: 23, type: !65) -!65 = !DICompositeType(tag: DW_TAG_array_type, baseType: !66, size: 192, elements: !68) -!66 = !DIDerivedType(tag: DW_TAG_typedef, name: "pthread_t", file: !12, line: 27, baseType: !67) -!67 = !DIBasicType(name: "unsigned long", size: 64, encoding: DW_ATE_unsigned) -!68 = !{!69} -!69 = !DISubrange(count: 3) -!70 = !DILocation(line: 23, column: 15, scope: !61) -!71 = !DILocation(line: 25, column: 5, scope: !61) -!72 = !DILocalVariable(name: "i", scope: !73, file: !9, line: 27, type: !10) -!73 = distinct !DILexicalBlock(scope: !61, file: !9, line: 27, column: 5) -!74 = !DILocation(line: 0, scope: !73) -!75 = !DILocation(line: 28, column: 25, scope: !76) -!76 = distinct !DILexicalBlock(scope: !73, file: !9, line: 27, column: 5) -!77 = !DILocation(line: 28, column: 9, scope: !76) -!78 = !DILocalVariable(name: "i", scope: !79, file: !9, line: 30, type: !10) -!79 = distinct !DILexicalBlock(scope: !61, file: !9, line: 30, column: 5) -!80 = !DILocation(line: 0, scope: !79) -!81 = !DILocation(line: 31, column: 22, scope: !82) -!82 = distinct !DILexicalBlock(scope: !79, file: !9, line: 30, column: 5) -!83 = !DILocation(line: 31, column: 9, scope: !82) -!84 = !DILocation(line: 33, column: 5, scope: !85) -!85 = distinct !DILexicalBlock(scope: !86, file: !9, line: 33, column: 5) -!86 = distinct !DILexicalBlock(scope: !61, file: !9, line: 33, column: 5) -!87 = !DILocation(line: 33, column: 5, scope: !86) -!88 = !DILocation(line: 35, column: 5, scope: !61) +!1 = distinct !DIGlobalVariable(name: "mutex", scope: !2, file: !10, line: 4, type: !12, isLocal: false, isDefinition: true) +!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "Ubuntu clang version 12.0.0-3ubuntu1~20.04.5", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !5, globals: !7, splitDebugInlining: false, nameTableKind: None) +!3 = !DIFile(filename: "/home/ponce/git/Dat3M/benchmarks/locks/pthread_mutex.c", directory: "/home/ponce/git/Dat3M") +!4 = !{} +!5 = !{!6} +!6 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +!7 = !{!0, !8} +!8 = !DIGlobalVariableExpression(var: !9, expr: !DIExpression()) +!9 = distinct !DIGlobalVariable(name: "x", scope: !2, file: !10, line: 5, type: !11, isLocal: false, isDefinition: true) +!10 = !DIFile(filename: "benchmarks/locks/pthread_mutex.c", directory: "/home/ponce/git/Dat3M") +!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!12 = !DIDerivedType(tag: DW_TAG_typedef, name: "pthread_mutex_t", file: !13, line: 72, baseType: !14) +!13 = !DIFile(filename: "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h", directory: "") +!14 = distinct !DICompositeType(tag: DW_TAG_union_type, file: !13, line: 67, size: 320, elements: !15) +!15 = !{!16, !37, !42} +!16 = !DIDerivedType(tag: DW_TAG_member, name: "__data", scope: !14, file: !13, line: 69, baseType: !17, size: 320) +!17 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "__pthread_mutex_s", file: !18, line: 22, size: 320, elements: !19) +!18 = !DIFile(filename: "/usr/include/x86_64-linux-gnu/bits/struct_mutex.h", directory: "") +!19 = !{!20, !21, !23, !24, !25, !26, !28, !29} +!20 = !DIDerivedType(tag: DW_TAG_member, name: "__lock", scope: !17, file: !18, line: 24, baseType: !11, size: 32) +!21 = !DIDerivedType(tag: DW_TAG_member, name: "__count", scope: !17, file: !18, line: 25, baseType: !22, size: 32, offset: 32) +!22 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned) +!23 = !DIDerivedType(tag: DW_TAG_member, name: "__owner", scope: !17, file: !18, line: 26, baseType: !11, size: 32, offset: 64) +!24 = !DIDerivedType(tag: DW_TAG_member, name: "__nusers", scope: !17, file: !18, line: 28, baseType: !22, size: 32, offset: 96) +!25 = !DIDerivedType(tag: DW_TAG_member, name: "__kind", scope: !17, file: !18, line: 32, baseType: !11, size: 32, offset: 128) +!26 = !DIDerivedType(tag: DW_TAG_member, name: "__spins", scope: !17, file: !18, line: 34, baseType: !27, size: 16, offset: 160) +!27 = !DIBasicType(name: "short", size: 16, encoding: DW_ATE_signed) +!28 = !DIDerivedType(tag: DW_TAG_member, name: "__elision", scope: !17, file: !18, line: 35, baseType: !27, size: 16, offset: 176) +!29 = !DIDerivedType(tag: DW_TAG_member, name: "__list", scope: !17, file: !18, line: 36, baseType: !30, size: 128, offset: 192) +!30 = !DIDerivedType(tag: DW_TAG_typedef, name: "__pthread_list_t", file: !31, line: 53, baseType: !32) +!31 = !DIFile(filename: "/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h", directory: "") +!32 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "__pthread_internal_list", file: !31, line: 49, size: 128, elements: !33) +!33 = !{!34, !36} +!34 = !DIDerivedType(tag: DW_TAG_member, name: "__prev", scope: !32, file: !31, line: 51, baseType: !35, size: 64) +!35 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !32, size: 64) +!36 = !DIDerivedType(tag: DW_TAG_member, name: "__next", scope: !32, file: !31, line: 52, baseType: !35, size: 64, offset: 64) +!37 = !DIDerivedType(tag: DW_TAG_member, name: "__size", scope: !14, file: !13, line: 70, baseType: !38, size: 320) +!38 = !DICompositeType(tag: DW_TAG_array_type, baseType: !39, size: 320, elements: !40) +!39 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) +!40 = !{!41} +!41 = !DISubrange(count: 40) +!42 = !DIDerivedType(tag: DW_TAG_member, name: "__align", scope: !14, file: !13, line: 71, baseType: !43, size: 64) +!43 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed) +!44 = !{i32 7, !"Dwarf Version", i32 4} +!45 = !{i32 2, !"Debug Info Version", i32 3} +!46 = !{i32 1, !"wchar_size", i32 4} +!47 = !{!"Ubuntu clang version 12.0.0-3ubuntu1~20.04.5"} +!48 = distinct !DISubprogram(name: "thread", scope: !10, file: !10, line: 7, type: !49, scopeLine: 8, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4) +!49 = !DISubroutineType(types: !50) +!50 = !{!6, !6} +!51 = !DILocalVariable(name: "unused", arg: 1, scope: !48, file: !10, line: 7, type: !6) +!52 = !DILocation(line: 7, column: 20, scope: !48) +!53 = !DILocation(line: 9, column: 5, scope: !48) +!54 = !DILocation(line: 10, column: 6, scope: !48) +!55 = !DILocation(line: 11, column: 5, scope: !48) +!56 = !DILocation(line: 12, column: 5, scope: !48) +!57 = distinct !DISubprogram(name: "main", scope: !10, file: !10, line: 15, type: !58, scopeLine: 16, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4) +!58 = !DISubroutineType(types: !59) +!59 = !{!11} +!60 = !DILocalVariable(name: "t1", scope: !57, file: !10, line: 17, type: !61) +!61 = !DIDerivedType(tag: DW_TAG_typedef, name: "pthread_t", file: !13, line: 27, baseType: !62) +!62 = !DIBasicType(name: "long unsigned int", size: 64, encoding: DW_ATE_unsigned) +!63 = !DILocation(line: 17, column: 15, scope: !57) +!64 = !DILocalVariable(name: "t2", scope: !57, file: !10, line: 17, type: !61) +!65 = !DILocation(line: 17, column: 19, scope: !57) +!66 = !DILocation(line: 19, column: 5, scope: !57) +!67 = !DILocation(line: 20, column: 5, scope: !57) +!68 = !DILocation(line: 22, column: 18, scope: !57) +!69 = !DILocation(line: 22, column: 5, scope: !57) +!70 = !DILocation(line: 23, column: 18, scope: !57) +!71 = !DILocation(line: 23, column: 5, scope: !57) +!72 = !DILocation(line: 25, column: 5, scope: !73) +!73 = distinct !DILexicalBlock(scope: !74, file: !10, line: 25, column: 5) +!74 = distinct !DILexicalBlock(scope: !57, file: !10, line: 25, column: 5) +!75 = !DILocation(line: 25, column: 5, scope: !74) +!76 = !DILocation(line: 27, column: 5, scope: !57) From 489f60837694ef6eba2dd6de92e15ef99b7a90ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Maseli?= Date: Wed, 19 Jun 2024 13:08:56 +0200 Subject: [PATCH 13/28] Assertion expressions (#690) --- .../java/com/dat3m/dartagnan/Dartagnan.java | 23 +++- .../dartagnan/configuration/Property.java | 2 +- .../dartagnan/encoding/EncodingContext.java | 4 + .../dartagnan/encoding/ProgramEncoder.java | 2 +- .../dartagnan/encoding/PropertyEncoder.java | 39 +++--- .../expression/ExpressionPrinter.java | 113 ++++++++++++++++++ .../expression/base/BinaryExpressionBase.java | 5 - .../expression/base/CastExpressionBase.java | 20 +--- .../expression/base/ExpressionBase.java | 6 + .../expression/base/UnaryExpressionBase.java | 5 - .../expression/floats/FloatSizeCast.java | 6 - .../expression/floats/IntToFloatCast.java | 6 - .../expression/integers/FloatToIntCast.java | 6 - .../expression/integers/IntSizeCast.java | 6 - .../expression/misc/ConstructExpr.java | 6 - .../expression/misc/ExtractExpr.java | 5 - .../dartagnan/expression/misc/GEPExpr.java | 6 - .../dartagnan/expression/misc/ITEExpr.java | 5 - .../program/utils/AssertionHelper.java | 30 ----- .../parsers/program/utils/ProgramBuilder.java | 7 +- .../visitors/VisitorLitmusAArch64.java | 15 +-- .../visitors/VisitorLitmusAssertions.java | 84 ++++++++----- .../program/visitors/VisitorLitmusC.java | 15 +-- .../program/visitors/VisitorLitmusPPC.java | 15 +-- .../program/visitors/VisitorLitmusPTX.java | 15 +-- .../program/visitors/VisitorLitmusRISCV.java | 16 +-- .../program/visitors/VisitorLitmusVulkan.java | 15 +-- .../program/visitors/VisitorLitmusX86.java | 15 +-- .../com/dat3m/dartagnan/program/Program.java | 26 ++-- .../program/specification/AbstractAssert.java | 37 ------ .../program/specification/AssertBasic.java | 54 --------- .../specification/AssertCompositeAnd.java | 37 ------ .../specification/AssertCompositeOr.java | 37 ------ .../program/specification/AssertInline.java | 36 ------ .../program/specification/AssertNot.java | 37 ------ .../program/specification/AssertTrue.java | 26 ---- .../verification/solving/ModelChecker.java | 26 ---- 37 files changed, 253 insertions(+), 555 deletions(-) create mode 100644 dartagnan/src/main/java/com/dat3m/dartagnan/expression/ExpressionPrinter.java delete mode 100644 dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/utils/AssertionHelper.java delete mode 100644 dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AbstractAssert.java delete mode 100644 dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertBasic.java delete mode 100644 dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertCompositeAnd.java delete mode 100644 dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertCompositeOr.java delete mode 100644 dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertInline.java delete mode 100644 dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertNot.java delete mode 100644 dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertTrue.java diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/Dartagnan.java b/dartagnan/src/main/java/com/dat3m/dartagnan/Dartagnan.java index 91cf646429..ed965c7348 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/Dartagnan.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/Dartagnan.java @@ -3,6 +3,7 @@ import com.dat3m.dartagnan.configuration.OptionNames; import com.dat3m.dartagnan.configuration.Property; import com.dat3m.dartagnan.encoding.EncodingContext; +import com.dat3m.dartagnan.expression.ExpressionPrinter; import com.dat3m.dartagnan.parsers.cat.ParserCat; import com.dat3m.dartagnan.parsers.program.ProgramParser; import com.dat3m.dartagnan.parsers.witness.ParserWitness; @@ -335,7 +336,7 @@ public static String generateResultSummary(VerificationTask task, ProverEnvironm } else { // Litmus-specific output format that matches with Herd7 (as good as it can) if (p.getFilterSpecification() != null) { - summary.append("Filter ").append(p.getFilterSpecification().toStringWithType()).append("\n"); + summary.append("Filter ").append(p.getFilterSpecification()).append("\n"); } // NOTE: We cannot produce an output that matches herd7 when checking for both program spec and cat properties. @@ -349,12 +350,12 @@ public static String generateResultSummary(VerificationTask task, ProverEnvironm // We have a positive witness or no violations, then the program must be ok. // NOTE: We also treat the UNKNOWN case as positive, assuming that // looping litmus tests are unusual. - summary.append("Condition ").append(p.getSpecification().toStringWithType()).append("\n"); + printSpecification(summary, p); summary.append("Ok").append("\n"); } else if (hasViolations) { if (props.contains(PROGRAM_SPEC) && FALSE.equals(model.evaluate(PROGRAM_SPEC.getSMTVariable(encCtx)))) { // Program spec violated - summary.append("Condition ").append(p.getSpecification().toStringWithType()).append("\n"); + printSpecification(summary, p); summary.append("No").append("\n"); } else { final List violatedCATSpecs = task.getMemoryModel().getAxioms().stream() @@ -376,7 +377,7 @@ public static String generateResultSummary(VerificationTask task, ProverEnvironm summary.append(result).append("\n"); } else if (task.getProperty().contains(PROGRAM_SPEC)) { // ... which can be good or bad (no witness = bad, not violation = good) - summary.append("Condition ").append(p.getSpecification().toStringWithType()).append("\n"); + printSpecification(summary, p); summary.append(result == PASS ? "Ok" : "No").append("\n"); } } @@ -397,4 +398,18 @@ private static void printWarningIfThreadStartFailed(Program p, EncodingContext e } } } + + private static void printSpecification(StringBuilder sb, Program program) { + sb.append("Condition ").append(program.getSpecificationType().toString().toLowerCase()).append(" "); + boolean init = false; + if (program.getSpecification() != null) { + sb.append(new ExpressionPrinter(true).visit(program.getSpecification())); + init = true; + } + for (Assert assertion : program.getThreadEvents(Assert.class)) { + sb.append(init ? " && " : "").append(assertion.getExpression()).append("%").append(assertion.getGlobalId()); + init = true; + } + sb.append("\n"); + } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/configuration/Property.java b/dartagnan/src/main/java/com/dat3m/dartagnan/configuration/Property.java index 20ab663da5..f51bf52273 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/configuration/Property.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/configuration/Property.java @@ -46,7 +46,7 @@ public String asStringOption() { } public Type getType(VerificationTask context) { - if (this == PROGRAM_SPEC && !context.getProgram().getSpecification().isSafetySpec()) { + if (this == PROGRAM_SPEC && context.getProgram().hasReachabilitySpecification()) { return Type.REACHABILITY; } else { return Type.SAFETY; diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/EncodingContext.java b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/EncodingContext.java index 4f85b90d81..8f26fc0ad3 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/EncodingContext.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/EncodingContext.java @@ -128,6 +128,10 @@ public Formula encodeFinalExpression(Expression expression) { return new ExpressionEncoder(this, null).encode(expression); } + public BooleanFormula encodeFinalExpressionAsBoolean(Expression expression) { + return new ExpressionEncoder(this, null).encodeAsBoolean(expression); + } + public BooleanFormula encodeExpressionAsBooleanAt(Expression expression, Event event) { return new ExpressionEncoder(this, event).encodeAsBoolean(expression); } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/ProgramEncoder.java b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/ProgramEncoder.java index 5bd4b88e7d..2fffb5de73 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/ProgramEncoder.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/ProgramEncoder.java @@ -248,7 +248,7 @@ public BooleanFormula encodeDependencies() { public BooleanFormula encodeFilter() { return context.getTask().getProgram().getFilterSpecification() != null ? - context.getTask().getProgram().getFilterSpecification().encode(context) : + context.encodeFinalExpressionAsBoolean(context.getTask().getProgram().getFilterSpecification()) : context.getBooleanFormulaManager().makeTrue(); } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/PropertyEncoder.java b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/PropertyEncoder.java index e987b446f0..cafe77f6d3 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/PropertyEncoder.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/PropertyEncoder.java @@ -12,7 +12,6 @@ import com.dat3m.dartagnan.program.event.Tag; import com.dat3m.dartagnan.program.event.core.*; import com.dat3m.dartagnan.program.event.metadata.MemoryOrder; -import com.dat3m.dartagnan.program.specification.AbstractAssert; import com.dat3m.dartagnan.wmm.Relation; import com.dat3m.dartagnan.wmm.RelationNameRepository; import com.dat3m.dartagnan.wmm.Wmm; @@ -154,7 +153,7 @@ private BooleanFormula encodePropertyWitnesses(EnumSet properties) { // Litmus (program spec). We cannot check this together with safety specs, so we make sure // that we do not mix them up. Preconditions.checkArgument(properties.contains(PROGRAM_SPEC)); - Preconditions.checkArgument(!program.getSpecification().isSafetySpec()); + Preconditions.checkArgument(program.hasReachabilitySpecification()); final BooleanFormulaManager bmgr = context.getBooleanFormulaManager(); final TrackableFormula progSpec = encodeProgramSpecification(); @@ -250,28 +249,26 @@ private BooleanFormula lastCoVar(Event write) { private TrackableFormula encodeProgramSpecification() { logger.info("Encoding program specification"); - final AbstractAssert spec = program.getSpecification(); final BooleanFormulaManager bmgr = context.getBooleanFormulaManager(); // We can only perform existential queries to the SMT-engine, so for // safety specs we need to query for a violation (= negation of the spec) - final BooleanFormula encoding; - final BooleanFormula trackingLiteral; - switch (spec.getType()) { - case AbstractAssert.ASSERT_TYPE_FORALL: - encoding = bmgr.not(spec.encode(context)); - trackingLiteral = bmgr.not(PROGRAM_SPEC.getSMTVariable(context)); - break; - case AbstractAssert.ASSERT_TYPE_NOT_EXISTS: - encoding = spec.encode(context); - trackingLiteral = bmgr.not(PROGRAM_SPEC.getSMTVariable(context)); - break; - case AbstractAssert.ASSERT_TYPE_EXISTS: - encoding = spec.encode(context); - trackingLiteral = PROGRAM_SPEC.getSMTVariable(context); - break; - default: - throw new IllegalStateException("Unrecognized program specification: " + spec.toStringWithType()); - } + BooleanFormula encoding = switch (program.getSpecificationType()) { + case EXISTS, NOT_EXISTS -> context.encodeFinalExpressionAsBoolean(program.getSpecification()); + case FORALL -> bmgr.not(context.encodeFinalExpressionAsBoolean(program.getSpecification())); + case ASSERT -> { + // User-placed assertions inside C code. + List assertionsHold = new ArrayList<>(); + for (Assert assertion : program.getThreadEvents(Assert.class)) { + assertionsHold.add(bmgr.implication(context.execution(assertion), + context.encodeExpressionAsBooleanAt(assertion.getExpression(), assertion))); + } + yield bmgr.not(bmgr.and(assertionsHold)); + } + }; + BooleanFormula trackingLiteral = switch (program.getSpecificationType()) { + case FORALL, NOT_EXISTS, ASSERT -> bmgr.not(PROGRAM_SPEC.getSMTVariable(context)); + case EXISTS -> PROGRAM_SPEC.getSMTVariable(context); + }; return new TrackableFormula(trackingLiteral, encoding); } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/ExpressionPrinter.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/ExpressionPrinter.java new file mode 100644 index 0000000000..2d393c8553 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/ExpressionPrinter.java @@ -0,0 +1,113 @@ +package com.dat3m.dartagnan.expression; + +import com.dat3m.dartagnan.expression.booleans.BoolBinaryOp; +import com.dat3m.dartagnan.expression.booleans.BoolUnaryOp; +import com.dat3m.dartagnan.expression.floats.FloatSizeCast; +import com.dat3m.dartagnan.expression.floats.IntToFloatCast; +import com.dat3m.dartagnan.expression.integers.FloatToIntCast; +import com.dat3m.dartagnan.expression.integers.IntBinaryOp; +import com.dat3m.dartagnan.expression.integers.IntSizeCast; +import com.dat3m.dartagnan.expression.integers.IntUnaryOp; +import com.dat3m.dartagnan.expression.misc.ConstructExpr; +import com.dat3m.dartagnan.expression.misc.ExtractExpr; +import com.dat3m.dartagnan.expression.misc.GEPExpr; +import com.dat3m.dartagnan.expression.misc.ITEExpr; +import com.dat3m.dartagnan.program.Register; + +import java.util.Set; +import java.util.stream.Collectors; + + +public final class ExpressionPrinter implements ExpressionVisitor { + + private final boolean printRegistersWithFunctionId; + + private ExpressionKind kind; + + private static final Set ASSOCIATIVE_OPERATIONS = Set.of(BoolBinaryOp.AND, BoolBinaryOp.OR, + IntBinaryOp.AND, IntBinaryOp.OR, IntBinaryOp.XOR, + IntBinaryOp.ADD, IntBinaryOp.MUL); + + private static final Set SIMPLE_UNARY_OPERATIONS = Set.of(BoolUnaryOp.NOT, IntUnaryOp.MINUS); + + // If not printing in program / global scope, then printing in function / local scope. + public ExpressionPrinter(boolean globalScope) { + this.printRegistersWithFunctionId = globalScope; + } + + public String visit(Expression expr) { + final ExpressionKind parentKind = kind; + kind = expr.getKind(); + final String inner = expr.accept(this); + final boolean noParentheses = parentKind == null || // Omit at top level. + SIMPLE_UNARY_OPERATIONS.contains(kind) || // Omit at e.g. negations. + ASSOCIATIVE_OPERATIONS.contains(kind) && parentKind == kind || // Omit at e.g. A+B+C. + expr.getOperands().isEmpty(); // Omit at registers, non-det values and literals. + kind = parentKind; + return noParentheses ? inner : "(" + inner + ")"; + } + + @Override + public String visitExpression(Expression expr) { + return expr.toString(); + } + + @Override + public String visitBinaryExpression(BinaryExpression expr) { + return visit(expr.getLeft()) + " " + expr.getKind() + " " + visit(expr.getRight()); + } + + @Override + public String visitUnaryExpression(UnaryExpression expr) { + return expr.getKind() + visit(expr.getOperand()); + } + + @Override + public String visitIntSizeCastExpression(IntSizeCast expr) { + final String opName = expr.isTruncation() ? "trunc" : (expr.preservesSign() ? "sext" : "zext"); + return String.format("%s %s to %s", opName, visit(expr.getOperand()), expr.getTargetType()); + } + + @Override + public String visitFloatToIntCastExpression(FloatToIntCast expr) { + final String opName = expr.isSigned() ? "fptosi" : "fptoui"; + return String.format("%s %s to %s", opName, visit(expr.getOperand()), expr.getTargetType()); + } + + @Override + public String visitFloatSizeCastExpression(FloatSizeCast expr) { + final String opName = expr.isTruncation() ? "trunc" : "ext"; + return String.format("%s %s to %s", visit(expr.getOperand()), opName, expr.getTargetType()); + } + + @Override + public String visitIntToFloatCastExpression(IntToFloatCast expr) { + final String opName = expr.isSigned() ? "sitofp" : "uitofp"; + return String.format("%s %s to %s", opName, visit(expr.getOperand()), expr.getTargetType()); + } + + @Override + public String visitExtractExpression(ExtractExpr extract) { + return visit(extract.getOperand()) + "[" + extract.getFieldIndex() + "]"; + } + + @Override + public String visitConstructExpression(ConstructExpr expr) { + return expr.getOperands().stream().map(this::visit).collect(Collectors.joining(", ", "{ ", " }")); + } + + @Override + public String visitGEPExpression(GEPExpr expr) { + return expr.getOperands().stream().map(this::visit).collect(Collectors.joining(", ", "GEP(", ")")); + } + + @Override + public String visitITEExpression(ITEExpr expr) { + return visit(expr.getCondition()) + " ? " + visit(expr.getTrueCase()) + " : " + visit(expr.getFalseCase()); + } + + @Override + public String visitRegister(Register reg) { + return printRegistersWithFunctionId ? reg.getFunction().getId() + ":" + reg.getName() : reg.toString(); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/base/BinaryExpressionBase.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/base/BinaryExpressionBase.java index 05af9c954b..9cea5f3c50 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/base/BinaryExpressionBase.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/base/BinaryExpressionBase.java @@ -33,11 +33,6 @@ protected BinaryExpressionBase(TType type, TKind kind, Expression left, Expressi @Override public TKind getKind() { return kind; } - @Override - public String toString() { - return "(" + left + " " + kind + " " + right + ")"; - } - @Override public int hashCode() { return Objects.hash(type, kind, left, right); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/base/CastExpressionBase.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/base/CastExpressionBase.java index a238badcaf..d3d3a5ec3d 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/base/CastExpressionBase.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/base/CastExpressionBase.java @@ -10,21 +10,18 @@ import java.util.Objects; @NoInterface -public abstract class CastExpressionBase implements CastExpression { +public abstract class CastExpressionBase extends ExpressionBase + implements CastExpression { - protected final TTargetType targetType; protected final Expression operand; protected CastExpressionBase(TTargetType targetType, Expression operand) { - this.targetType = targetType; + super(targetType); this.operand = operand; } @Override - public TTargetType getTargetType() { return targetType; } - - @Override - public TTargetType getType() { return getTargetType(); } + public TTargetType getTargetType() { return getType(); } @Override @SuppressWarnings("unchecked") public TSourceType getSourceType() { @@ -40,14 +37,9 @@ public TSourceType getSourceType() { @Override public ExpressionKind.Other getKind() { return ExpressionKind.Other.CAST; } - @Override - public String toString() { - return String.format("cast %s to %s", operand, targetType); - } - @Override public int hashCode() { - return Objects.hash(targetType, operand); + return Objects.hash(type, operand); } @Override @@ -59,7 +51,7 @@ public boolean equals(Object obj) { } final CastExpression expr = (CastExpression) obj; - return this.targetType.equals(expr.getTargetType()) + return this.type.equals(expr.getTargetType()) && this.operand.equals(expr.getOperand()); } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/base/ExpressionBase.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/base/ExpressionBase.java index 439bfeb41d..8aefacd143 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/base/ExpressionBase.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/base/ExpressionBase.java @@ -1,6 +1,7 @@ package com.dat3m.dartagnan.expression.base; import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionPrinter; import com.dat3m.dartagnan.expression.Type; import com.dat3m.dartagnan.program.event.common.NoInterface; @@ -18,6 +19,11 @@ protected ExpressionBase(TType type) { @Override public TType getType() { return this.type; } + @Override + public String toString() { + return new ExpressionPrinter(false).visit(this); + } + @Override public int hashCode() { return Objects.hash(type, getKind(), getOperands()); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/base/UnaryExpressionBase.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/base/UnaryExpressionBase.java index 7554f332ec..8ac227a19e 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/base/UnaryExpressionBase.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/base/UnaryExpressionBase.java @@ -30,11 +30,6 @@ protected UnaryExpressionBase(TType type, TKind kind, Expression operand) { @Override public TKind getKind() { return kind; } - @Override - public String toString() { - return "(" + kind + operand + ")"; - } - @Override public int hashCode() { return Objects.hash(type, kind, operand); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/floats/FloatSizeCast.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/floats/FloatSizeCast.java index 568fa82c34..bee4ab373a 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/floats/FloatSizeCast.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/floats/FloatSizeCast.java @@ -29,12 +29,6 @@ private static boolean isExtension(FloatType sourceType, FloatType targetType) { return sourceType.getBitWidth() < targetType.getBitWidth(); } - @Override - public String toString() { - final String opName = isTruncation() ? "trunc" : "ext"; - return String.format("%s %s to %s", operand, opName, targetType); - } - @Override public T accept(ExpressionVisitor visitor) { return visitor.visitFloatSizeCastExpression(this); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/floats/IntToFloatCast.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/floats/IntToFloatCast.java index aa1c83f28d..4632b2f960 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/floats/IntToFloatCast.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/floats/IntToFloatCast.java @@ -19,12 +19,6 @@ public IntToFloatCast(FloatType targetType, Expression operand, boolean isSigned public boolean isSigned() { return isSigned; } - @Override - public String toString() { - final String opName = isSigned ? "sitofp" : "uitofp"; - return String.format("%s %s to %s", opName, operand, targetType); - } - @Override public T accept(ExpressionVisitor visitor) { return visitor.visitIntToFloatCastExpression(this); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/integers/FloatToIntCast.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/integers/FloatToIntCast.java index 3ba6591574..e4f75d55b9 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/integers/FloatToIntCast.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/integers/FloatToIntCast.java @@ -19,12 +19,6 @@ public FloatToIntCast(IntegerType targetType, Expression operand, boolean isSign public boolean isSigned() { return isSigned; } - @Override - public String toString() { - final String opName = isSigned ? "fptosi" : "fptoui"; - return String.format("%s %s to %s", opName, operand, targetType); - } - @Override public T accept(ExpressionVisitor visitor) { return visitor.visitFloatToIntCastExpression(this); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/integers/IntSizeCast.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/integers/IntSizeCast.java index 142cd7c677..0141d4e1d0 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/integers/IntSizeCast.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/integers/IntSizeCast.java @@ -36,12 +36,6 @@ private static boolean isExtension(IntegerType sourceType, IntegerType targetTyp return sourceType.getBitWidth() < targetType.getBitWidth(); } - @Override - public String toString() { - final String opName = isTruncation() ? "trunc" : (preserveSign ? "sext" : "zext"); - return String.format("%s %s to %s", opName, operand, targetType); - } - @Override public T accept(ExpressionVisitor visitor) { return visitor.visitIntSizeCastExpression(this); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/misc/ConstructExpr.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/misc/ConstructExpr.java index 0271247013..0ebdd6f799 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/misc/ConstructExpr.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/misc/ConstructExpr.java @@ -9,7 +9,6 @@ import com.dat3m.dartagnan.expression.type.ArrayType; import java.util.List; -import java.util.stream.Collectors; import static com.google.common.base.Preconditions.checkArgument; @@ -32,9 +31,4 @@ public ConstructExpr(Type type, List arguments) { public T accept(ExpressionVisitor visitor) { return visitor.visitConstructExpression(this); } - - @Override - public String toString() { - return operands.stream().map(Expression::toString).collect(Collectors.joining(", ", "{ ", " }")); - } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/misc/ExtractExpr.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/misc/ExtractExpr.java index 935e2cadc6..cbae78305c 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/misc/ExtractExpr.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/misc/ExtractExpr.java @@ -42,9 +42,4 @@ public int getFieldIndex() { public T accept(ExpressionVisitor visitor) { return visitor.visitExtractExpression(this); } - - @Override - public String toString() { - return String.format("%s[%d]", operand, index); - } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/misc/GEPExpr.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/misc/GEPExpr.java index 8a7ce15a4c..4648af21d9 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/misc/GEPExpr.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/misc/GEPExpr.java @@ -13,7 +13,6 @@ import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; public final class GEPExpr extends NaryExpressionBase { @@ -52,9 +51,4 @@ public List getOffsets() { public T accept(ExpressionVisitor visitor) { return visitor.visitGEPExpression(this); } - - @Override - public String toString() { - return operands.stream().map(Object::toString).collect(Collectors.joining(", ", "GEP(", ")")); - } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/misc/ITEExpr.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/misc/ITEExpr.java index a87a69a393..abc6311cc8 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/misc/ITEExpr.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/misc/ITEExpr.java @@ -28,11 +28,6 @@ public ITEExpr(Expression condition, Expression trueCase, Expression falseCase) this.falseCase = falseCase; } - @Override - public String toString() { - return String.format("ITE(%s, %s, %s)", condition, trueCase, falseCase); - } - public Expression getCondition() { return condition; } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/utils/AssertionHelper.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/utils/AssertionHelper.java deleted file mode 100644 index 1db5862d9a..0000000000 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/utils/AssertionHelper.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.dat3m.dartagnan.parsers.program.utils; - -import com.dat3m.dartagnan.program.specification.AbstractAssert; -import com.dat3m.dartagnan.parsers.LitmusAssertionsLexer; -import com.dat3m.dartagnan.parsers.LitmusAssertionsParser; -import com.dat3m.dartagnan.parsers.program.visitors.VisitorLitmusAssertions; -import org.antlr.v4.runtime.*; - -public class AssertionHelper { - - public static AbstractAssert parseAssertionList(ProgramBuilder programBuilder, String text){ - CharStream charStream = CharStreams.fromString(text); - LitmusAssertionsLexer lexer = new LitmusAssertionsLexer(charStream); - CommonTokenStream tokenStream = new CommonTokenStream(lexer); - LitmusAssertionsParser parser = new LitmusAssertionsParser(tokenStream); - ParserRuleContext parserEntryPoint = parser.assertionList(); - return parserEntryPoint.accept(new VisitorLitmusAssertions(programBuilder)); - } - - public static AbstractAssert parseAssertionFilter(ProgramBuilder programBuilder, String text){ - CharStream charStream = CharStreams.fromString(text); - LitmusAssertionsLexer lexer = new LitmusAssertionsLexer(charStream); - CommonTokenStream tokenStream = new CommonTokenStream(lexer); - LitmusAssertionsParser parser = new LitmusAssertionsParser(tokenStream); - ParserRuleContext parserEntryPoint = parser.assertionFilter(); - AbstractAssert filter = parserEntryPoint.accept(new VisitorLitmusAssertions(programBuilder)); - filter.setType(AbstractAssert.ASSERT_TYPE_FORALL); - return filter; - } -} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/utils/ProgramBuilder.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/utils/ProgramBuilder.java index e8f33081fd..b2e1d97f7b 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/utils/ProgramBuilder.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/utils/ProgramBuilder.java @@ -20,7 +20,6 @@ import com.dat3m.dartagnan.program.memory.MemoryObject; import com.dat3m.dartagnan.program.memory.VirtualMemoryObject; import com.dat3m.dartagnan.program.processing.IdReassignment; -import com.dat3m.dartagnan.program.specification.AbstractAssert; import com.google.common.base.Preconditions; import com.google.common.base.Verify; import com.google.common.collect.Iterables; @@ -100,11 +99,11 @@ public ExpressionFactory getExpressionFactory() { return expressions; } - public void setAssert(AbstractAssert ass) { - program.setSpecification(ass); + public void setAssert(Program.SpecificationType type, Expression ass) { + program.setSpecification(type, ass); } - public void setAssertFilter(AbstractAssert ass) { + public void setAssertFilter(Expression ass) { program.setFilterSpecification(ass); } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusAArch64.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusAArch64.java index ba64fc81fb..4c0d1e5091 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusAArch64.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusAArch64.java @@ -9,7 +9,6 @@ import com.dat3m.dartagnan.expression.type.TypeFactory; import com.dat3m.dartagnan.parsers.LitmusAArch64BaseVisitor; import com.dat3m.dartagnan.parsers.LitmusAArch64Parser; -import com.dat3m.dartagnan.parsers.program.utils.AssertionHelper; import com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder; import com.dat3m.dartagnan.program.Program; import com.dat3m.dartagnan.program.Register; @@ -17,7 +16,6 @@ import com.dat3m.dartagnan.program.event.arch.StoreExclusive; import com.dat3m.dartagnan.program.event.core.Label; import com.dat3m.dartagnan.program.event.core.Load; -import org.antlr.v4.runtime.misc.Interval; import java.util.HashMap; import java.util.Map; @@ -54,18 +52,7 @@ public Object visitMain(LitmusAArch64Parser.MainContext ctx) { visitThreadDeclaratorList(ctx.program().threadDeclaratorList()); visitVariableDeclaratorList(ctx.variableDeclaratorList()); visitInstructionList(ctx.program().instructionList()); - if(ctx.assertionList() != null){ - int a = ctx.assertionList().getStart().getStartIndex(); - int b = ctx.assertionList().getStop().getStopIndex(); - String raw = ctx.assertionList().getStart().getInputStream().getText(new Interval(a, b)); - programBuilder.setAssert(AssertionHelper.parseAssertionList(programBuilder, raw)); - } - if(ctx.assertionFilter() != null){ - int a = ctx.assertionFilter().getStart().getStartIndex(); - int b = ctx.assertionFilter().getStop().getStopIndex(); - String raw = ctx.assertionFilter().getStart().getInputStream().getText(new Interval(a, b)); - programBuilder.setAssertFilter(AssertionHelper.parseAssertionFilter(programBuilder, raw)); - } + VisitorLitmusAssertions.parseAssertions(programBuilder, ctx.assertionList(), ctx.assertionFilter()); return programBuilder.build(); } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusAssertions.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusAssertions.java index bc36e9225f..20afc5ef5c 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusAssertions.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusAssertions.java @@ -5,41 +5,71 @@ import com.dat3m.dartagnan.expression.ExpressionFactory; import com.dat3m.dartagnan.expression.type.IntegerType; import com.dat3m.dartagnan.parsers.LitmusAssertionsBaseVisitor; +import com.dat3m.dartagnan.parsers.LitmusAssertionsLexer; import com.dat3m.dartagnan.parsers.LitmusAssertionsParser; import com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder; import com.dat3m.dartagnan.program.memory.Location; import com.dat3m.dartagnan.program.memory.MemoryObject; -import com.dat3m.dartagnan.program.specification.*; +import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.CharStreams; +import org.antlr.v4.runtime.CommonTokenStream; +import org.antlr.v4.runtime.ParserRuleContext; +import org.antlr.v4.runtime.misc.Interval; import org.antlr.v4.runtime.tree.TerminalNode; +import static com.dat3m.dartagnan.program.Program.SpecificationType.*; import static com.google.common.base.Preconditions.checkState; -public class VisitorLitmusAssertions extends LitmusAssertionsBaseVisitor { +class VisitorLitmusAssertions extends LitmusAssertionsBaseVisitor { private final ProgramBuilder programBuilder; private final ExpressionFactory expressions; private final IntegerType archType; - public VisitorLitmusAssertions(ProgramBuilder programBuilder) { + private VisitorLitmusAssertions(ProgramBuilder programBuilder) { this.programBuilder = programBuilder; this.expressions = programBuilder.getExpressionFactory(); this.archType = programBuilder.getTypeFactory().getArchType(); } + static void parseAssertions( + ProgramBuilder programBuilder, + ParserRuleContext listContext, + ParserRuleContext filterContext) { + parseAssertions(programBuilder, listContext, false); + parseAssertions(programBuilder, filterContext, true); + } + + private static void parseAssertions(ProgramBuilder programBuilder, ParserRuleContext ctx, boolean filter) { + if (ctx == null) { + return; + } + int a = ctx.getStart().getStartIndex(); + int b = ctx.getStop().getStopIndex(); + String text = ctx.getStart().getInputStream().getText(new Interval(a, b)); + CharStream charStream = CharStreams.fromString(text); + LitmusAssertionsLexer lexer = new LitmusAssertionsLexer(charStream); + CommonTokenStream tokenStream = new CommonTokenStream(lexer); + LitmusAssertionsParser parser = new LitmusAssertionsParser(tokenStream); + ParserRuleContext parserEntryPoint = filter ? parser.assertionFilter() : parser.assertionList(); + parserEntryPoint.accept(new VisitorLitmusAssertions(programBuilder)); + } + @Override - public AbstractAssert visitAssertionFilter(LitmusAssertionsParser.AssertionFilterContext ctx){ - return ctx.assertion().accept(this); + public Expression visitAssertionFilter(LitmusAssertionsParser.AssertionFilterContext ctx) { + programBuilder.setAssertFilter(ctx.assertion().accept(this)); + return null; } @Override - public AbstractAssert visitAssertionList(LitmusAssertionsParser.AssertionListContext ctx){ - AbstractAssert ass = ctx.assertion().accept(this); - if(ctx.AssertionNot() != null) { - ass.setType(AbstractAssert.ASSERT_TYPE_NOT_EXISTS); - } else if(ctx.AssertionExists() != null || ctx.AssertionFinal() != null){ - ass.setType(AbstractAssert.ASSERT_TYPE_EXISTS); - } else if(ctx.AssertionForall() != null){ - ass.setType(AbstractAssert.ASSERT_TYPE_FORALL); + public Expression visitAssertionList(LitmusAssertionsParser.AssertionListContext ctx) { + Expression ass = ctx.assertion().accept(this); + if (ctx.AssertionNot() != null) { + programBuilder.setAssert(NOT_EXISTS, ass); + } else if (ctx.AssertionExists() != null || ctx.AssertionFinal() != null) { + programBuilder.setAssert(EXISTS, ass); + } else if (ctx.AssertionForall() != null) { + programBuilder.setAssert(FORALL, ass); } else { throw new ParsingException("Unrecognised assertion type"); } @@ -47,39 +77,39 @@ public AbstractAssert visitAssertionList(LitmusAssertionsParser.AssertionListCon } @Override - public AbstractAssert visitAssertionParenthesis(LitmusAssertionsParser.AssertionParenthesisContext ctx){ + public Expression visitAssertionParenthesis(LitmusAssertionsParser.AssertionParenthesisContext ctx) { return ctx.assertion().accept(this); } @Override - public AbstractAssert visitAssertionNot(LitmusAssertionsParser.AssertionNotContext ctx){ - return new AssertNot(ctx.assertion().accept(this)); + public Expression visitAssertionNot(LitmusAssertionsParser.AssertionNotContext ctx) { + return expressions.makeNot(ctx.assertion().accept(this)); } @Override - public AbstractAssert visitAssertionAnd(LitmusAssertionsParser.AssertionAndContext ctx){ - return new AssertCompositeAnd(ctx.assertion(0).accept(this), ctx.assertion(1).accept(this)); + public Expression visitAssertionAnd(LitmusAssertionsParser.AssertionAndContext ctx) { + return expressions.makeAnd(ctx.assertion(0).accept(this), ctx.assertion(1).accept(this)); } @Override - public AbstractAssert visitAssertionOr(LitmusAssertionsParser.AssertionOrContext ctx){ - return new AssertCompositeOr(ctx.assertion(0).accept(this), ctx.assertion(1).accept(this)); + public Expression visitAssertionOr(LitmusAssertionsParser.AssertionOrContext ctx) { + return expressions.makeOr(ctx.assertion(0).accept(this), ctx.assertion(1).accept(this)); } @Override - public AbstractAssert visitAssertionBasic(LitmusAssertionsParser.AssertionBasicContext ctx){ - Expression expr1 = acceptAssertionValue(ctx.assertionValue(0),false); - Expression expr2 = acceptAssertionValue(ctx.assertionValue(1),true); - return new AssertBasic(expr1, ctx.assertionCompare().op, expr2); + public Expression visitAssertionBasic(LitmusAssertionsParser.AssertionBasicContext ctx) { + Expression expr1 = acceptAssertionValue(ctx.assertionValue(0), false); + Expression expr2 = acceptAssertionValue(ctx.assertionValue(1), true); + return expressions.makeIntCmp(expr1, ctx.assertionCompare().op, expr2); } private Expression acceptAssertionValue(LitmusAssertionsParser.AssertionValueContext ctx, boolean right) { - if(ctx.constant() != null) { + if (ctx.constant() != null) { return expressions.parseValue(ctx.constant().getText(), archType); } String name = ctx.varName().getText(); - if(ctx.threadId() != null) { - return programBuilder.getOrErrorRegister(ctx.threadId().id,name); + if (ctx.threadId() != null) { + return programBuilder.getOrErrorRegister(ctx.threadId().id, name); } MemoryObject base = programBuilder.getMemoryObject(name); checkState(base != null, "uninitialized location %s", name); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusC.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusC.java index 8343db8778..b8a367561c 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusC.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusC.java @@ -7,7 +7,6 @@ import com.dat3m.dartagnan.expression.type.IntegerType; import com.dat3m.dartagnan.parsers.LitmusCBaseVisitor; import com.dat3m.dartagnan.parsers.LitmusCParser; -import com.dat3m.dartagnan.parsers.program.utils.AssertionHelper; import com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder; import com.dat3m.dartagnan.program.Program; import com.dat3m.dartagnan.program.Register; @@ -18,7 +17,6 @@ import com.dat3m.dartagnan.program.event.core.IfAsJump; import com.dat3m.dartagnan.program.event.core.Label; import com.dat3m.dartagnan.program.memory.MemoryObject; -import org.antlr.v4.runtime.misc.Interval; import java.util.ArrayList; import java.util.List; @@ -48,18 +46,7 @@ public Program visitMain(LitmusCParser.MainContext ctx) { // because variable declaration refer to threads. visitVariableDeclaratorList(ctx.variableDeclaratorList()); visitProgram(ctx.program()); - if(ctx.assertionList() != null){ - int a = ctx.assertionList().getStart().getStartIndex(); - int b = ctx.assertionList().getStop().getStopIndex(); - String raw = ctx.assertionList().getStart().getInputStream().getText(new Interval(a, b)); - programBuilder.setAssert(AssertionHelper.parseAssertionList(programBuilder, raw)); - } - if(ctx.assertionFilter() != null){ - int a = ctx.assertionFilter().getStart().getStartIndex(); - int b = ctx.assertionFilter().getStop().getStopIndex(); - String raw = ctx.assertionFilter().getStart().getInputStream().getText(new Interval(a, b)); - programBuilder.setAssertFilter(AssertionHelper.parseAssertionFilter(programBuilder, raw)); - } + VisitorLitmusAssertions.parseAssertions(programBuilder, ctx.assertionList(), ctx.assertionFilter()); return programBuilder.build(); } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusPPC.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusPPC.java index efd3607d04..09c8c3933f 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusPPC.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusPPC.java @@ -9,14 +9,12 @@ import com.dat3m.dartagnan.expression.type.TypeFactory; import com.dat3m.dartagnan.parsers.LitmusPPCBaseVisitor; import com.dat3m.dartagnan.parsers.LitmusPPCParser; -import com.dat3m.dartagnan.parsers.program.utils.AssertionHelper; import com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder; import com.dat3m.dartagnan.program.Program; import com.dat3m.dartagnan.program.Register; import com.dat3m.dartagnan.program.event.EventFactory; import com.dat3m.dartagnan.program.event.core.Label; import com.google.common.collect.ImmutableSet; -import org.antlr.v4.runtime.misc.Interval; import java.util.HashMap; import java.util.Map; @@ -56,18 +54,7 @@ public Object visitMain(LitmusPPCParser.MainContext ctx) { visitThreadDeclaratorList(ctx.program().threadDeclaratorList()); visitVariableDeclaratorList(ctx.variableDeclaratorList()); visitInstructionList(ctx.program().instructionList()); - if(ctx.assertionList() != null){ - int a = ctx.assertionList().getStart().getStartIndex(); - int b = ctx.assertionList().getStop().getStopIndex(); - String raw = ctx.assertionList().getStart().getInputStream().getText(new Interval(a, b)); - programBuilder.setAssert(AssertionHelper.parseAssertionList(programBuilder, raw)); - } - if(ctx.assertionFilter() != null){ - int a = ctx.assertionFilter().getStart().getStartIndex(); - int b = ctx.assertionFilter().getStop().getStopIndex(); - String raw = ctx.assertionFilter().getStart().getInputStream().getText(new Interval(a, b)); - programBuilder.setAssertFilter(AssertionHelper.parseAssertionFilter(programBuilder, raw)); - } + VisitorLitmusAssertions.parseAssertions(programBuilder, ctx.assertionList(), ctx.assertionFilter()); return programBuilder.build(); } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusPTX.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusPTX.java index b32bf4491a..154759a7a7 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusPTX.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusPTX.java @@ -10,7 +10,6 @@ import com.dat3m.dartagnan.expression.type.TypeFactory; import com.dat3m.dartagnan.parsers.LitmusPTXBaseVisitor; import com.dat3m.dartagnan.parsers.LitmusPTXParser; -import com.dat3m.dartagnan.parsers.program.utils.AssertionHelper; import com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder; import com.dat3m.dartagnan.program.Program; import com.dat3m.dartagnan.program.Register; @@ -25,7 +24,6 @@ import com.dat3m.dartagnan.program.event.core.Load; import com.dat3m.dartagnan.program.event.core.Store; import com.dat3m.dartagnan.program.memory.MemoryObject; -import org.antlr.v4.runtime.misc.Interval; public class VisitorLitmusPTX extends LitmusPTXBaseVisitor { private final ProgramBuilder programBuilder = ProgramBuilder.forArch(Program.SourceLanguage.LITMUS, Arch.PTX); @@ -46,18 +44,7 @@ public Object visitMain(LitmusPTXParser.MainContext ctx) { visitThreadDeclaratorList(ctx.program().threadDeclaratorList()); visitVariableDeclaratorList(ctx.variableDeclaratorList()); visitInstructionList(ctx.program().instructionList()); - if (ctx.assertionList() != null) { - int a = ctx.assertionList().getStart().getStartIndex(); - int b = ctx.assertionList().getStop().getStopIndex(); - String raw = ctx.assertionList().getStart().getInputStream().getText(new Interval(a, b)); - programBuilder.setAssert(AssertionHelper.parseAssertionList(programBuilder, raw)); - } - if (ctx.assertionFilter() != null) { - int a = ctx.assertionFilter().getStart().getStartIndex(); - int b = ctx.assertionFilter().getStop().getStopIndex(); - String raw = ctx.assertionFilter().getStart().getInputStream().getText(new Interval(a, b)); - programBuilder.setAssertFilter(AssertionHelper.parseAssertionFilter(programBuilder, raw)); - } + VisitorLitmusAssertions.parseAssertions(programBuilder, ctx.assertionList(), ctx.assertionFilter()); return programBuilder.build(); } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusRISCV.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusRISCV.java index 190ed1fce7..8959730977 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusRISCV.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusRISCV.java @@ -11,7 +11,6 @@ import com.dat3m.dartagnan.expression.type.TypeFactory; import com.dat3m.dartagnan.parsers.LitmusRISCVBaseVisitor; import com.dat3m.dartagnan.parsers.LitmusRISCVParser; -import com.dat3m.dartagnan.parsers.program.utils.AssertionHelper; import com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder; import com.dat3m.dartagnan.program.Program; import com.dat3m.dartagnan.program.Register; @@ -20,7 +19,6 @@ import com.dat3m.dartagnan.program.event.RegReader; import com.dat3m.dartagnan.program.event.Tag; import com.dat3m.dartagnan.program.event.core.Label; -import org.antlr.v4.runtime.misc.Interval; public class VisitorLitmusRISCV extends LitmusRISCVBaseVisitor { @@ -42,19 +40,7 @@ public Object visitMain(LitmusRISCVParser.MainContext ctx) { visitThreadDeclaratorList(ctx.program().threadDeclaratorList()); visitVariableDeclaratorList(ctx.variableDeclaratorList()); visitInstructionList(ctx.program().instructionList()); - if(ctx.assertionList() != null){ - int a = ctx.assertionList().getStart().getStartIndex(); - int b = ctx.assertionList().getStop().getStopIndex(); - String raw = ctx.assertionList().getStart().getInputStream().getText(new Interval(a, b)); - programBuilder.setAssert(AssertionHelper.parseAssertionList(programBuilder, raw)); - } - if(ctx.assertionFilter() != null){ - int a = ctx.assertionFilter().getStart().getStartIndex(); - int b = ctx.assertionFilter().getStop().getStopIndex(); - String raw = ctx.assertionFilter().getStart().getInputStream().getText(new Interval(a, b)); - programBuilder.setAssertFilter(AssertionHelper.parseAssertionFilter(programBuilder, raw)); - } - + VisitorLitmusAssertions.parseAssertions(programBuilder, ctx.assertionList(), ctx.assertionFilter()); Program prog = programBuilder.build(); replaceX0Register(prog); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusVulkan.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusVulkan.java index 301517f157..161679f7b0 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusVulkan.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusVulkan.java @@ -10,7 +10,6 @@ import com.dat3m.dartagnan.expression.type.TypeFactory; import com.dat3m.dartagnan.parsers.LitmusVulkanBaseVisitor; import com.dat3m.dartagnan.parsers.LitmusVulkanParser; -import com.dat3m.dartagnan.parsers.program.utils.AssertionHelper; import com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder; import com.dat3m.dartagnan.program.Program; import com.dat3m.dartagnan.program.Register; @@ -24,7 +23,6 @@ import com.dat3m.dartagnan.program.event.core.Load; import com.dat3m.dartagnan.program.event.core.Store; import com.dat3m.dartagnan.program.memory.MemoryObject; -import org.antlr.v4.runtime.misc.Interval; import java.util.ArrayList; import java.util.List; @@ -56,18 +54,7 @@ public Object visitMain(LitmusVulkanParser.MainContext ctx) { programBuilder.addSwwPairThreads(threadId0, threadId1); } } - if (ctx.assertionList() != null) { - int a = ctx.assertionList().getStart().getStartIndex(); - int b = ctx.assertionList().getStop().getStopIndex(); - String raw = ctx.assertionList().getStart().getInputStream().getText(new Interval(a, b)); - programBuilder.setAssert(AssertionHelper.parseAssertionList(programBuilder, raw)); - } - if (ctx.assertionFilter() != null) { - int a = ctx.assertionFilter().getStart().getStartIndex(); - int b = ctx.assertionFilter().getStop().getStopIndex(); - String raw = ctx.assertionFilter().getStart().getInputStream().getText(new Interval(a, b)); - programBuilder.setAssertFilter(AssertionHelper.parseAssertionFilter(programBuilder, raw)); - } + VisitorLitmusAssertions.parseAssertions(programBuilder, ctx.assertionList(), ctx.assertionFilter()); return programBuilder.build(); } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusX86.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusX86.java index 6e6d06dcb9..e604b6bf65 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusX86.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusX86.java @@ -8,14 +8,12 @@ import com.dat3m.dartagnan.expression.type.TypeFactory; import com.dat3m.dartagnan.parsers.LitmusX86BaseVisitor; import com.dat3m.dartagnan.parsers.LitmusX86Parser; -import com.dat3m.dartagnan.parsers.program.utils.AssertionHelper; import com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder; import com.dat3m.dartagnan.program.Program; import com.dat3m.dartagnan.program.Register; import com.dat3m.dartagnan.program.event.EventFactory; import com.dat3m.dartagnan.program.memory.MemoryObject; import com.google.common.collect.ImmutableSet; -import org.antlr.v4.runtime.misc.Interval; import static com.dat3m.dartagnan.wmm.RelationNameRepository.MFENCE; @@ -41,18 +39,7 @@ public Object visitMain(LitmusX86Parser.MainContext ctx) { visitThreadDeclaratorList(ctx.program().threadDeclaratorList()); visitVariableDeclaratorList(ctx.variableDeclaratorList()); visitInstructionList(ctx.program().instructionList()); - if(ctx.assertionList() != null){ - int a = ctx.assertionList().getStart().getStartIndex(); - int b = ctx.assertionList().getStop().getStopIndex(); - String raw = ctx.assertionList().getStart().getInputStream().getText(new Interval(a, b)); - programBuilder.setAssert(AssertionHelper.parseAssertionList(programBuilder, raw)); - } - if(ctx.assertionFilter() != null){ - int a = ctx.assertionFilter().getStart().getStartIndex(); - int b = ctx.assertionFilter().getStop().getStopIndex(); - String raw = ctx.assertionFilter().getStart().getInputStream().getText(new Interval(a, b)); - programBuilder.setAssertFilter(AssertionHelper.parseAssertionFilter(programBuilder, raw)); - } + VisitorLitmusAssertions.parseAssertions(programBuilder, ctx.assertionList(), ctx.assertionFilter()); return programBuilder.build(); } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/Program.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/Program.java index d33b1a4ef5..614162b97d 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/Program.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/Program.java @@ -9,7 +9,6 @@ import com.dat3m.dartagnan.program.event.Event; import com.dat3m.dartagnan.program.memory.Memory; import com.dat3m.dartagnan.program.misc.NonDetValue; -import com.dat3m.dartagnan.program.specification.AbstractAssert; import com.google.common.base.Preconditions; import java.util.*; @@ -19,9 +18,12 @@ public class Program { public enum SourceLanguage { LITMUS, LLVM, SPV } + public enum SpecificationType { EXISTS, FORALL, NOT_EXISTS, ASSERT } + private String name; - private AbstractAssert spec; - private AbstractAssert filterSpec; // Acts like "assume" statements, filtering out executions + private SpecificationType specificationType = SpecificationType.ASSERT; + private Expression spec; + private Expression filterSpec; // Acts like "assume" statements, filtering out executions private final List threads; private final List functions; private final List constants = new ArrayList<>(); @@ -81,20 +83,28 @@ public Memory getMemory() { return this.memory; } - public AbstractAssert getSpecification() { + public SpecificationType getSpecificationType() { + return specificationType; + } + + public boolean hasReachabilitySpecification() { + return SpecificationType.EXISTS.equals(specificationType); + } + + public Expression getSpecification() { return spec; } - public void setSpecification(AbstractAssert spec) { + public void setSpecification(SpecificationType type, Expression spec) { + this.specificationType = type; this.spec = spec; } - public AbstractAssert getFilterSpecification() { + public Expression getFilterSpecification() { return filterSpec; } - public void setFilterSpecification(AbstractAssert spec) { - Preconditions.checkArgument(spec == null || AbstractAssert.ASSERT_TYPE_FORALL.equals(spec.getType())); + public void setFilterSpecification(Expression spec) { this.filterSpec = spec; } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AbstractAssert.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AbstractAssert.java deleted file mode 100644 index 3cbbab5458..0000000000 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AbstractAssert.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.dat3m.dartagnan.program.specification; - -import com.dat3m.dartagnan.encoding.EncodingContext; -import com.dat3m.dartagnan.program.Register; -import org.sosy_lab.java_smt.api.BooleanFormula; - -import java.util.List; - -public abstract class AbstractAssert { - - public static final String ASSERT_TYPE_EXISTS = "exists"; - public static final String ASSERT_TYPE_NOT_EXISTS = "not exists"; - public static final String ASSERT_TYPE_FORALL = "forall"; - - private String type; - - public void setType(String type) { - this.type = type; - } - - public String getType() { - return type; - } - - public boolean isSafetySpec() { - // "Forall" queries are safety specs, while existential ones are not. - return ASSERT_TYPE_FORALL.equals(type) || ASSERT_TYPE_NOT_EXISTS.equals(type); - } - - public String toStringWithType() { - return type != null ? (type + " (" + this + ")") : toString(); - } - - public abstract BooleanFormula encode(EncodingContext context); - - public abstract List getRegs(); -} \ No newline at end of file diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertBasic.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertBasic.java deleted file mode 100644 index 9942e79aa3..0000000000 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertBasic.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.dat3m.dartagnan.program.specification; - -import com.dat3m.dartagnan.encoding.EncodingContext; -import com.dat3m.dartagnan.expression.Expression; -import com.dat3m.dartagnan.expression.integers.IntCmpOp; -import com.dat3m.dartagnan.program.Register; -import org.sosy_lab.java_smt.api.BooleanFormula; - -import java.util.ArrayList; -import java.util.List; - -public class AssertBasic extends AbstractAssert { - - private final Expression e1; - private final Expression e2; - private final IntCmpOp op; - - public AssertBasic(Expression e1, IntCmpOp op, Expression e2) { - this.e1 = e1; - this.e2 = e2; - this.op = op; - } - - @Override - public BooleanFormula encode(EncodingContext context) { - return context.encodeComparison(op, - context.encodeFinalExpression(e1), - context.encodeFinalExpression(e2)); - } - - @Override - public String toString() { - return valueToString(e1) + op + valueToString(e2); - } - - private String valueToString(Expression value) { - if (value instanceof Register register) { - return register.getFunction().getId() + ":" + value; - } - return value.toString(); - } - - @Override - public List getRegs() { - List regs = new ArrayList<>(); - if (e1 instanceof Register r1) { - regs.add(r1); - } - if (e2 instanceof Register r2) { - regs.add(r2); - } - return regs; - } -} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertCompositeAnd.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertCompositeAnd.java deleted file mode 100644 index 7c323ba3e6..0000000000 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertCompositeAnd.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.dat3m.dartagnan.program.specification; - -import com.dat3m.dartagnan.encoding.EncodingContext; -import com.dat3m.dartagnan.program.Register; -import org.sosy_lab.java_smt.api.BooleanFormula; - -import java.util.ArrayList; -import java.util.List; - -public class AssertCompositeAnd extends AbstractAssert { - - private final AbstractAssert a1; - private final AbstractAssert a2; - - public AssertCompositeAnd(AbstractAssert a1, AbstractAssert a2) { - this.a1 = a1; - this.a2 = a2; - } - - @Override - public BooleanFormula encode(EncodingContext ctx) { - return ctx.getBooleanFormulaManager().and(a1.encode(ctx), a2.encode(ctx)); - } - - @Override - public String toString() { - return a1 + " && " + a2; - } - - @Override - public List getRegs() { - List regs = new ArrayList<>(); - regs.addAll(a1.getRegs()); - regs.addAll(a2.getRegs()); - return regs; - } -} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertCompositeOr.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertCompositeOr.java deleted file mode 100644 index 991cd0f71e..0000000000 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertCompositeOr.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.dat3m.dartagnan.program.specification; - -import com.dat3m.dartagnan.encoding.EncodingContext; -import com.dat3m.dartagnan.program.Register; -import org.sosy_lab.java_smt.api.BooleanFormula; - -import java.util.ArrayList; -import java.util.List; - -public class AssertCompositeOr extends AbstractAssert { - - private final AbstractAssert a1; - private final AbstractAssert a2; - - public AssertCompositeOr(AbstractAssert a1, AbstractAssert a2) { - this.a1 = a1; - this.a2 = a2; - } - - @Override - public BooleanFormula encode(EncodingContext ctx) { - return ctx.getBooleanFormulaManager().or(a1.encode(ctx), a2.encode(ctx)); - } - - @Override - public String toString() { - return "(" + a1 + " || " + a2 + ")"; - } - - @Override - public List getRegs() { - List regs = new ArrayList<>(); - regs.addAll(a1.getRegs()); - regs.addAll(a2.getRegs()); - return regs; - } -} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertInline.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertInline.java deleted file mode 100644 index 0fcaeba3ea..0000000000 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertInline.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.dat3m.dartagnan.program.specification; - -import com.dat3m.dartagnan.encoding.EncodingContext; -import com.dat3m.dartagnan.program.Register; -import com.dat3m.dartagnan.program.event.core.Assert; -import org.sosy_lab.java_smt.api.BooleanFormula; -import org.sosy_lab.java_smt.api.BooleanFormulaManager; - -import java.util.ArrayList; -import java.util.List; - -public class AssertInline extends AbstractAssert { - - private final Assert assertion; - - public AssertInline(Assert assertion) { - this.assertion = assertion; - } - - @Override - public BooleanFormula encode(EncodingContext ctx) { - final BooleanFormulaManager bmgr = ctx.getBooleanFormulaManager(); - return bmgr.implication(ctx.execution(assertion), - ctx.encodeExpressionAsBooleanAt(assertion.getExpression(), assertion)); - } - - @Override - public String toString() { - return String.format("%s@%d", assertion.getExpression(), assertion.getGlobalId()); - } - - @Override - public List getRegs() { - return new ArrayList<>(assertion.getExpression().getRegs()); - } -} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertNot.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertNot.java deleted file mode 100644 index db89e1930b..0000000000 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertNot.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.dat3m.dartagnan.program.specification; - -import com.dat3m.dartagnan.encoding.EncodingContext; -import com.dat3m.dartagnan.program.Register; -import com.google.common.base.Preconditions; -import org.sosy_lab.java_smt.api.BooleanFormula; - -import java.util.List; - -public class AssertNot extends AbstractAssert { - - private final AbstractAssert child; - - public AssertNot(AbstractAssert child) { - Preconditions.checkNotNull(child, "Empty assertion clause in " + this.getClass().getName()); - this.child = child; - } - - AbstractAssert getChild() { - return child; - } - - @Override - public BooleanFormula encode(EncodingContext ctx) { - return ctx.getBooleanFormulaManager().not(child.encode(ctx)); - } - - @Override - public String toString() { - return "!" + child.toString(); - } - - @Override - public List getRegs() { - return child.getRegs(); - } -} \ No newline at end of file diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertTrue.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertTrue.java deleted file mode 100644 index 0fc5bbc12d..0000000000 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/specification/AssertTrue.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.dat3m.dartagnan.program.specification; - -import com.dat3m.dartagnan.encoding.EncodingContext; -import com.dat3m.dartagnan.program.Register; -import org.sosy_lab.java_smt.api.BooleanFormula; - -import java.util.Collections; -import java.util.List; - -public class AssertTrue extends AbstractAssert { - - @Override - public BooleanFormula encode(EncodingContext ctx) { - return ctx.getBooleanFormulaManager().makeTrue(); - } - - @Override - public String toString() { - return "true"; - } - - @Override - public List getRegs() { - return Collections.emptyList(); - } -} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/verification/solving/ModelChecker.java b/dartagnan/src/main/java/com/dat3m/dartagnan/verification/solving/ModelChecker.java index 644be1d63c..cac688c576 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/verification/solving/ModelChecker.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/verification/solving/ModelChecker.java @@ -9,12 +9,7 @@ import com.dat3m.dartagnan.program.analysis.*; import com.dat3m.dartagnan.program.analysis.alias.AliasAnalysis; import com.dat3m.dartagnan.program.event.Event; -import com.dat3m.dartagnan.program.event.core.Assert; import com.dat3m.dartagnan.program.processing.ProcessingManager; -import com.dat3m.dartagnan.program.specification.AbstractAssert; -import com.dat3m.dartagnan.program.specification.AssertCompositeAnd; -import com.dat3m.dartagnan.program.specification.AssertInline; -import com.dat3m.dartagnan.program.specification.AssertTrue; import com.dat3m.dartagnan.utils.Result; import com.dat3m.dartagnan.verification.Context; import com.dat3m.dartagnan.verification.VerificationTask; @@ -29,7 +24,6 @@ import org.sosy_lab.java_smt.api.ProverEnvironment; import org.sosy_lab.java_smt.api.SolverException; -import java.util.List; import java.util.Optional; import static com.dat3m.dartagnan.configuration.Property.CAT_SPEC; @@ -70,11 +64,6 @@ public boolean hasModel() { public static void preprocessProgram(VerificationTask task, Configuration config) throws InvalidConfigurationException { Program program = task.getProgram(); ProcessingManager.fromConfig(config).run(program); - // This is used to distinguish between Litmus tests (whose assertions are defined differently) - // and C tests. - if(program.getFormat() != Program.SourceLanguage.LITMUS) { - computeSpecificationFromProgramAssertions(program); - } } public static void preprocessMemoryModel(VerificationTask task, Configuration config) throws InvalidConfigurationException{ final Wmm memoryModel = task.getMemoryModel(); @@ -120,21 +109,6 @@ public static void performStaticWmmAnalyses(VerificationTask task, Context analy analysisContext.register(RelationAnalysis.class, RelationAnalysis.fromConfig(task, analysisContext, config)); } - private static void computeSpecificationFromProgramAssertions(Program program) { - // We generate a program-spec from the user-placed assertions inside the C code. - // For litmus tests, this function should not be called. - final List assertions = program.getThreadEvents(Assert.class); - AbstractAssert spec = new AssertTrue(); - if(!assertions.isEmpty()) { - spec = new AssertInline(assertions.get(0)); - for(int i = 1; i < assertions.size(); i++) { - spec = new AssertCompositeAnd(spec, new AssertInline(assertions.get(i))); - } - } - spec.setType(AbstractAssert.ASSERT_TYPE_FORALL); - program.setSpecification(spec); - } - protected void saveFlaggedPairsOutput(Wmm wmm, WmmEncoder encoder, ProverEnvironment prover, EncodingContext ctx, Program program) throws SolverException { if (!ctx.getTask().getProperty().contains(CAT_SPEC)) { return; From d9174017867bfce186aa903265f17d19ca1439ce Mon Sep 17 00:00:00 2001 From: Thomas Haas Date: Wed, 19 Jun 2024 14:22:37 +0200 Subject: [PATCH 14/28] Added TagSet, used in AbstractEvent to store tags of events. (#698) --- .../program/event/AbstractEvent.java | 6 +- .../dat3m/dartagnan/program/event/TagSet.java | 56 +++++++++++++++++++ 2 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 dartagnan/src/main/java/com/dat3m/dartagnan/program/event/TagSet.java diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/AbstractEvent.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/AbstractEvent.java index 2d2c3e4e29..792d44d141 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/AbstractEvent.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/AbstractEvent.java @@ -16,7 +16,7 @@ public abstract class AbstractEvent implements Event { private final MetadataMap metadataMap = new MetadataMap(); - private final Set tags; + private final TagSet tags; private final Set currentUsers = new HashSet<>(); // These ids are dynamically changing during processing. private transient int globalId = -1; // (Global) ID within a program @@ -27,12 +27,12 @@ public abstract class AbstractEvent implements Event { private transient AbstractEvent predecessor; protected AbstractEvent() { - tags = new HashSet<>(); + tags = new TagSet(); } protected AbstractEvent(AbstractEvent other) { copyAllMetadataFrom(other); - this.tags = other.tags; // TODO: Dangerous code! A Copy-on-Write Set should be used (e.g. PersistentSet/Map) + this.tags = other.tags.copy(); } @Override diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/TagSet.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/TagSet.java new file mode 100644 index 0000000000..745161825e --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/TagSet.java @@ -0,0 +1,56 @@ +package com.dat3m.dartagnan.program.event; + +import java.util.*; + +public final class TagSet extends AbstractSet { + + private final List sortedTags = new ArrayList<>(); + + @Override + public boolean add(String tag) { + final int index = Collections.binarySearch(sortedTags, tag); + if (index < 0) { + sortedTags.add(~index, tag); + return true; + } + return false; + } + + @Override + public boolean contains(Object o) { + if (o instanceof String tag) { + return Collections.binarySearch(sortedTags, tag) >= 0; + } + return false; + } + + @Override + public boolean remove(Object o) { + if (!(o instanceof String tag)) { + return false; + } + + final int index = Collections.binarySearch(sortedTags, tag); + if (index >= 0) { + sortedTags.remove(index); + return true; + } + return false; + } + + @Override + public Iterator iterator() { + return sortedTags.listIterator(); + } + + @Override + public int size() { + return sortedTags.size(); + } + + public TagSet copy() { + final TagSet copy = new TagSet(); + copy.sortedTags.addAll(this.sortedTags); + return copy; + } +} From fa5a226afacae66ed64cb6cf1111277fcc5f2f81 Mon Sep 17 00:00:00 2001 From: Hernan Ponce de Leon Date: Mon, 1 Jul 2024 14:26:17 +0200 Subject: [PATCH 15/28] Avoid exception in SyntacticContextAnalysis (#699) Signed-off-by: Hernan Ponce de Leon Co-authored-by: Hernan Ponce de Leon --- .../analysis/SyntacticContextAnalysis.java | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/SyntacticContextAnalysis.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/SyntacticContextAnalysis.java index 2fd733b26d..4a1aca1c78 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/SyntacticContextAnalysis.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/SyntacticContextAnalysis.java @@ -8,6 +8,8 @@ import com.dat3m.dartagnan.program.event.metadata.SourceLocation; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import java.util.HashMap; import java.util.Map; @@ -22,6 +24,8 @@ */ public class SyntacticContextAnalysis { + private static final Logger logger = LogManager.getLogger(SyntacticContextAnalysis.class); + // ============================================================================ // ============================== Helper classes ============================== // ============================================================================ @@ -165,8 +169,12 @@ private void run(Thread thread, LoopAnalysis loops) { // FIXME: DCE can sometimes delete the end marker of functions if those never return // (e.g., "reach_error() { abort(0); }"). // Here we try to also pop those calls that have missing markers. - assert curContextStack.peek() instanceof CallContext; - topCallCtx = (CallContext) curContextStack.pop(); + if(curContextStack.peek() instanceof CallContext) { + topCallCtx = (CallContext) curContextStack.pop(); + } else { + logger.warn("Found a FunCallMarker without a matching FunReturnMarker. Giving up the analysis"); + break; + } } while (!topCallCtx.funCallMarker.getFunctionName().equals(retMarker.getFunctionName())); } @@ -179,10 +187,14 @@ private void run(Thread thread, LoopAnalysis loops) { curContextStack.push(new LoopContext(ev, iteration.getIterationNumber())); } if (end) { - assert curContextStack.peek() instanceof LoopContext c && + if (curContextStack.peek() instanceof LoopContext c && c.loopMarker == iteration.getIterationStart() && - c.iterationNumber == iteration.getIterationNumber(); - curContextStack.pop(); + c.iterationNumber == iteration.getIterationNumber()) { + curContextStack.pop(); + } else { + logger.warn("Found a IterationStart without a matching IterationEnd. Giving up the analysis"); + break; + } } } } From 377143271dc128a41ab51cd86aa58b7d0368d51c Mon Sep 17 00:00:00 2001 From: Hernan Ponce de Leon Date: Tue, 2 Jul 2024 15:32:09 +0200 Subject: [PATCH 16/28] Add loop bound annotation (#687) Signed-off-by: Hernan Ponce de Leon Co-authored-by: Hernan Ponce de Leon Co-authored-by: Thomas Haas --- benchmarks/c/miscellaneous/staticLoops.c | 22 ++ .../expression/integers/IntCmpOp.java | 12 +- .../analysis/LiveRegistersAnalysis.java | 139 ++++++++++++ .../program/analysis/UseDefAnalysis.java | 146 ++++++++++++ .../processing/NaiveLoopBoundAnnotation.java | 208 ++++++++++++++++++ .../program/processing/ProcessingManager.java | 5 +- .../dat3m/dartagnan/c/MiscellaneousTest.java | 1 + .../resources/miscellaneous/staticLoops.ll | 181 +++++++++++++++ 8 files changed, 702 insertions(+), 12 deletions(-) create mode 100644 benchmarks/c/miscellaneous/staticLoops.c create mode 100644 dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/LiveRegistersAnalysis.java create mode 100644 dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/UseDefAnalysis.java create mode 100644 dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/NaiveLoopBoundAnnotation.java create mode 100644 dartagnan/src/test/resources/miscellaneous/staticLoops.ll diff --git a/benchmarks/c/miscellaneous/staticLoops.c b/benchmarks/c/miscellaneous/staticLoops.c new file mode 100644 index 0000000000..7e4f2591ae --- /dev/null +++ b/benchmarks/c/miscellaneous/staticLoops.c @@ -0,0 +1,22 @@ +#include +#include + +#define INCS 3 + +volatile int32_t x = 0; + +int main() +{ + for (int i = 0; i < INCS; i++) + x++; + + for (int i = -1; i < INCS-1; i++) + x++; + + for (int i = 1; i < INCS+1; i++) + x++; + + assert(x == 3*INCS); + + return 0; +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/integers/IntCmpOp.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/integers/IntCmpOp.java index d1b411f903..e694717f6b 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/integers/IntCmpOp.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/integers/IntCmpOp.java @@ -2,8 +2,6 @@ import com.dat3m.dartagnan.expression.ExpressionKind; -import java.math.BigInteger; - public enum IntCmpOp implements ExpressionKind { EQ, NEQ, GTE, LTE, GT, LT, UGTE, ULTE, UGT, ULT; @@ -67,14 +65,10 @@ public boolean isStrict() { }; } - public boolean combine(BigInteger a, BigInteger b){ + public boolean isLessCategory() { return switch (this) { - case EQ -> a.compareTo(b) == 0; - case NEQ -> a.compareTo(b) != 0; - case LT, ULT -> a.compareTo(b) < 0; - case LTE, ULTE -> a.compareTo(b) <= 0; - case GT, UGT -> a.compareTo(b) > 0; - case GTE, UGTE -> a.compareTo(b) >= 0; + case LT, LTE, ULTE, ULT -> true; + default -> false; }; } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/LiveRegistersAnalysis.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/LiveRegistersAnalysis.java new file mode 100644 index 0000000000..5d3356845d --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/LiveRegistersAnalysis.java @@ -0,0 +1,139 @@ +package com.dat3m.dartagnan.program.analysis; + +import com.dat3m.dartagnan.program.Function; +import com.dat3m.dartagnan.program.IRHelper; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.event.RegReader; +import com.dat3m.dartagnan.program.event.RegWriter; +import com.dat3m.dartagnan.program.event.core.CondJump; +import com.dat3m.dartagnan.program.event.core.Label; +import com.dat3m.dartagnan.program.event.functions.AbortIf; +import com.dat3m.dartagnan.program.event.functions.Return; +import com.google.common.collect.ImmutableSet; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/* + Computes the registers that are (potentially) live at every program point. + A register is live, if it is used (i.e., read from) before getting overwritten. + A register may be declared live even if it is not used, however, a non-live (dead) register is always guaranteed + to be overwritten. + + This is a backwards analysis: the control-flow is traversed from exit to beginning. + */ +public class LiveRegistersAnalysis { + + private final Map> liveRegistersMap = new HashMap<>(); + + public static LiveRegistersAnalysis forFunction(Function f) { + final LiveRegistersAnalysis analysis = new LiveRegistersAnalysis(); + analysis.computeForFunction(f); + return analysis; + } + + public Set getLiveRegistersAt(Event ev) { + return liveRegistersMap.getOrDefault(ev, Set.of()); + } + + // ====================================================================== + + private void computeForFunction(Function f) { + computeLiveRegisters(f, computeLiveRegistersAtJumps(f)); + } + + private void computeLiveRegisters(Function f, Map> liveRegsAtJump) { + + Set liveRegs = new HashSet<>(); + // The copy is an optimizations: multiple events may have the same set of live registers, + // so we try to reuse that set to save memory. + Set liveRegsCopy = ImmutableSet.copyOf(liveRegs); + Event cur = f.getExit(); + while (cur != null) { + boolean updated; + if (cur instanceof CondJump jump) { + liveRegs = liveRegsAtJump.get(jump); + updated = true; + } else { + updated = updateLiveRegs(cur, liveRegs); + } + + if (updated) { + liveRegsCopy = ImmutableSet.copyOf(liveRegs); + } + liveRegistersMap.put(cur, liveRegsCopy); + + cur = cur.getPredecessor(); + } + } + + private static Map> computeLiveRegistersAtJumps(Function f) { + Map> liveRegsAtJumpMap = new HashMap<>(); + Set liveRegs = new HashSet<>(); + Event cur = f.getExit(); + while (cur != null) { + + updateLiveRegs(cur, liveRegs); + + if (cur instanceof CondJump jump) { + final Set liveRegsAtJump = liveRegsAtJumpMap.computeIfAbsent(jump, key -> new HashSet<>()); + if (!IRHelper.isAlwaysBranching(jump)) { + liveRegsAtJump.addAll(liveRegs); + } + liveRegs = new HashSet<>(liveRegsAtJump); + } + + if (cur instanceof Label label) { + // Propagate live sets to all incoming jumps. If an incoming jump is a backjump, + // we have a loop and may need to re-traverse the loop with the propagated values. + CondJump latestUpdatedBackjump = null; + for (CondJump jump : label.getJumpSet()) { + if (jump.isDead()) { + continue; + } + + final Set liveRegsAtJump = liveRegsAtJumpMap.computeIfAbsent(jump, key -> new HashSet<>()); + if (liveRegsAtJump.addAll(liveRegs) && jump.getGlobalId() > label.getGlobalId()) { + if (latestUpdatedBackjump == null || jump.getGlobalId() > latestUpdatedBackjump.getGlobalId()) { + latestUpdatedBackjump = jump; + } + } + } + + if (latestUpdatedBackjump != null) { + cur = latestUpdatedBackjump; + continue; + } + } + + cur = cur.getPredecessor(); + } + + return liveRegsAtJumpMap; + } + + // Returns true if the live registers may have updated (may return true even if no actual update happened). + private static boolean updateLiveRegs(Event ev, Set liveRegs) { + boolean changed = false; + if ((ev instanceof AbortIf || ev instanceof Return) && IRHelper.isAlwaysBranching(ev)) { + liveRegs.clear(); + changed = true; + } + + if (ev instanceof RegWriter writer && writer.cfImpliesExec()) { + changed |= liveRegs.remove(writer.getResultRegister()); + } + + if (ev instanceof RegReader reader) { + changed |= reader.getRegisterReads().stream() + .map(read -> liveRegs.add(read.register())) + .reduce(false, (res, b) -> res || b); + } + + return changed; + + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/UseDefAnalysis.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/UseDefAnalysis.java new file mode 100644 index 0000000000..af83d85a66 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/UseDefAnalysis.java @@ -0,0 +1,146 @@ +package com.dat3m.dartagnan.program.analysis; + +import com.dat3m.dartagnan.program.Function; +import com.dat3m.dartagnan.program.IRHelper; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.event.RegReader; +import com.dat3m.dartagnan.program.event.RegWriter; +import com.dat3m.dartagnan.program.event.core.CondJump; +import com.dat3m.dartagnan.program.event.core.Label; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/* + This analysis computes the Use-Def graph of a function. + The Use-Def graph connects a RegReader with possible RegWriters from which it could take its value + (for each register read by the reader). + + FIXME: The analysis currently cannot capture if a register is possibly uninitialized. + In particular, if the Def set consists of a single writer, + then it does not necessarily mean that the writer is the only one (maybe an uninitialized read is also possible). + + NOTE: This analysis is essentially the same as the "Dependency" analysis we already have. + The main difference is that this analysis works independently of other analyses + (e.g., it does not depend on ExecutionAnalysis) and can be used on single functions. + */ +public class UseDefAnalysis { + + private Map>> useDefGraph; + + private UseDefAnalysis() { } + + public static UseDefAnalysis forFunction(Function function) { + final UseDefAnalysis useDefAnalysis = new UseDefAnalysis(); + useDefAnalysis.computeForFunction(function); + return useDefAnalysis; + } + + public Map> getDefs(Event regReader) { + return useDefGraph.getOrDefault(regReader, Map.of()); + } + + public Set getDefs(Event regReader, Register register) { + return getDefs(regReader).getOrDefault(register, Set.of()); + } + + // ====================================================================== + + private void computeForFunction(Function function) { + final Map>> reachingDefinitionsMap = computeReachingDefinitionsAtLabels(function); + this.useDefGraph = computeUseDefGraph(function, reachingDefinitionsMap); + } + + private Map>> computeUseDefGraph( + Function function, Map>> reachingDefinitionsMap + ) { + final Map>> useDefGraph = new HashMap<>(); + + Map> reachingDefinitions = new HashMap<>(); + for (Event e : function.getEvents()) { + if (e instanceof RegReader reader) { + // Project reachable definitions down to those relevant for the RegReader + final Map> readableDefinitions = new HashMap<>(); + for (Register.Read read : reader.getRegisterReads()) { + readableDefinitions.put(read.register(), reachingDefinitions.get(read.register())); + } + useDefGraph.put(reader, readableDefinitions); + } + + updateReachingDefinitions(e, reachingDefinitions); + + if (e instanceof Label label) { + // This will cause entries in "reachingDefinitionsMap" to get mutated, + // but that is fine because we do not need them anymore. + reachingDefinitions = reachingDefinitionsMap.get(label); + } + } + + return useDefGraph; + } + + // For efficiency reasons, we compute reaching definitions only for labels. + // TODO: Maybe add a cheap liveness analysis and restrict to only live definitions. + private Map>> computeReachingDefinitionsAtLabels(Function function) { + final Map>> reachingDefinitionsMap = new HashMap<>(); + + Event cur = function.getEntry(); + Map> reachingDefinitions = new HashMap<>(); + while (cur != null) { + updateReachingDefinitions(cur, reachingDefinitions); + + if (cur instanceof CondJump jump && !jump.isDead()) { + final Map> reachDefAtLabel = reachingDefinitionsMap.computeIfAbsent(jump.getLabel(), k -> new HashMap<>()); + final boolean wasUpdated = joinInto(reachDefAtLabel, reachingDefinitions); + final boolean isBackJump = jump.getLabel().getGlobalId() < jump.getGlobalId(); + if (wasUpdated && isBackJump) { + cur = jump.getLabel(); + continue; + } + } + + if (cur instanceof Label label) { + final Map> reachDefAtLabel = reachingDefinitionsMap.computeIfAbsent(label, k -> new HashMap<>()); + if (!IRHelper.isAlwaysBranching(label.getPredecessor())) { + joinInto(reachDefAtLabel, reachingDefinitions); + } + reachingDefinitions = copy(reachDefAtLabel); + } + + cur = cur.getSuccessor(); + } + + return reachingDefinitionsMap; + } + + private void updateReachingDefinitions(Event ev, Map> reachingDefinitions) { + if (ev instanceof RegWriter writer) { + if (writer.cfImpliesExec()) { + reachingDefinitions.put(writer.getResultRegister(), new HashSet<>(Set.of(writer))); + } else { + reachingDefinitions.computeIfAbsent(writer.getResultRegister(), k -> new HashSet<>()).add(writer); + } + } + } + + private boolean joinInto(Map> base, Map> toJoin) { + boolean changed = false; + for (Map.Entry> entry : toJoin.entrySet()) { + if (!base.containsKey(entry.getKey())) { + changed = true; + } + changed |= base.computeIfAbsent(entry.getKey(), k -> new HashSet<>()).addAll(entry.getValue()); + } + + return changed; + } + + private Map> copy(Map> source) { + final Map> copy = new HashMap<>(source.size() * 4 / 3); + source.forEach((reg, writers) -> copy.put(reg, new HashSet<>(writers))); + return copy; + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/NaiveLoopBoundAnnotation.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/NaiveLoopBoundAnnotation.java new file mode 100644 index 0000000000..a558858f51 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/NaiveLoopBoundAnnotation.java @@ -0,0 +1,208 @@ +package com.dat3m.dartagnan.program.processing; + +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.integers.*; +import com.dat3m.dartagnan.expression.misc.ITEExpr; +import com.dat3m.dartagnan.program.Function; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.analysis.DominatorAnalysis; +import com.dat3m.dartagnan.program.analysis.LiveRegistersAnalysis; +import com.dat3m.dartagnan.program.analysis.LoopAnalysis; +import com.dat3m.dartagnan.program.analysis.UseDefAnalysis; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.event.EventFactory; +import com.dat3m.dartagnan.program.event.RegWriter; +import com.dat3m.dartagnan.program.event.core.CondJump; +import com.dat3m.dartagnan.program.event.core.Label; +import com.dat3m.dartagnan.program.event.core.Local; +import com.dat3m.dartagnan.utils.DominatorTree; + +import java.util.List; +import java.util.Set; + +/* + This pass adds a loop bound annotation to static loops of the form + + for (int i = I; i preDominatorTree = DominatorAnalysis.computePreDominatorTree(function.getEntry(), function.getExit()); + final List loops = LoopAnalysis.onFunction(function).getLoopsOfFunction(function); + + for (LoopAnalysis.LoopInfo loop : loops) { + final List loopBody = loop.iterations().get(0).computeBody(); + final Label label = (Label) loopBody.get(0); + final Event backJump = loopBody.get(loopBody.size() - 1); + + // Find candidate for loop counter register. We check for the shape: + // loopCounter <- constant + // loopHeader: + // The loop header should be dominated by the constant assignment to the counter. + if (!(label.getPredecessor() instanceof Local init && init.getExpr() instanceof IntLiteral initValExpr + && preDominatorTree.isDominatedBy(label, init))) { + continue; + } + final Register counterReg = init.getResultRegister(); + + // Validate that we indeed have found the counter register. + final boolean counterIsLive = liveAnalysis.getLiveRegistersAt(label).contains(counterReg); + final Event loopCountInc = findUniqueIncrement(loopBody, counterReg, useDefAnalysis, preDominatorTree); + final boolean counterIsAlwaysIncremented = + (loopCountInc != null) && preDominatorTree.isDominatedBy(backJump, loopCountInc); + if (!(counterIsLive && counterIsAlwaysIncremented)) { + // The candidate counter is either not the true loop counter, or + // the counter computations are too complex to analyze. + continue; + } + + // Now we look for the loop exit condition. + // (1) Find all exiting jumps + final List exitingJumps = loopBody.stream().filter(e -> e instanceof CondJump jump && + jump.getLabel().getLocalId() > backJump.getLocalId()).map(CondJump.class::cast).toList(); + + // (2) Check for each exit whether it is related to the counter variable. + // If so, try to deduce a loop bound and annotate the loop. + for (CondJump exit : exitingJumps) { + // We check for the special shape: + // if (notExit) goto L; + // goto exit; + if (!(exit.isGoto() && exit.getPredecessor() instanceof CondJump jump)) { + continue; + } + final Expression negatedGuard = jump.getGuard(); + // Now we check for the guard shape "r != 0" (i.e., we exit when r == 0 due to the inversion). + if (!(negatedGuard instanceof IntCmpExpr cond + && cond.getLeft() instanceof Register r + && cond.getKind() == IntCmpOp.NEQ + && cond.getRight() instanceof IntLiteral c && c.isZero())) { + continue; + } + // Now we need to check if r is actually related to the loop counter + // Check if there is a unique ITE defining the r from above and bounding the loop. + final Expression boundExpr = computeLoopBound(loopBody, r, counterReg, + initValExpr.getValueAsInt(), useDefAnalysis, preDominatorTree); + if (boundExpr != null) { + label.getPredecessor().insertAfter(EventFactory.Svcomp.newLoopBound(boundExpr)); + break; + } + } + } + } + + // Check if there is a single increment to the register. + // If there is, it returns the event performing the increment, otherwise it returns null. + private Event findUniqueIncrement(List events, Register register, + UseDefAnalysis useDefAnalysis, DominatorTree preDominatorTree) { + final RegWriter source = findUniqueSource(events, register, useDefAnalysis, preDominatorTree); + if (source == null) { + return null; + } + // We found the non-trivial source. Check that this is indeed the desired increment: + // (1) It is an addition operation + if (!(source instanceof Local local && local.getExpr() instanceof IntBinaryExpr add && add.getKind() == IntBinaryOp.ADD)) { + return null; + } + // (2) The addition is a positive increment of the register. + if (!(add.getLeft().equals(register) && add.getRight() instanceof IntLiteral c && c.getValue().signum() > 0)) { + return null; + } + // TODO: return also the increment + return local; + } + + private Expression computeLoopBound(List events, Register exitReg, Register counterReg, int counterRegInitVal, + UseDefAnalysis useDefAnalysis, DominatorTree preDominatorTree) { + + final RegWriter exitSource = findUniqueSource(events, exitReg, useDefAnalysis, preDominatorTree); + if (exitSource == null) { + return null; + } + + // If the non-trivial assignment has the shape exitCond <- ITE(counter <(=) C, 1, 0), we are done + if (!(exitSource instanceof Local local && local.getExpr() instanceof ITEExpr iteExpr + && iteExpr.getCondition() instanceof IntCmpExpr cond + && cond.getLeft().equals(counterReg) + && cond.getKind().isLessCategory() + && cond.getRight() instanceof IntLiteral bound + && iteExpr.getTrueCase() instanceof IntLiteral one && one.isOne() + && iteExpr.getFalseCase() instanceof IntLiteral zero && zero.isZero())) { + return null; + } + // We use C-I+1 for counter < C and C-I+2 for counter <= C + final ExpressionFactory expressions = ExpressionFactory.getInstance(); + final int loopIterations = bound.getValueAsInt() - counterRegInitVal + (cond.getKind().isStrict() ? 1 : 2); + return expressions.makeValue(loopIterations, bound.getType()); + + } + + // Finds the unique non-trivial assignment that (possibly indirectly) provides the value of + // Returns NULL, if no such unique assignment exists. + private RegWriter findUniqueSource(List events, Register register, UseDefAnalysis useDefAnalysis, DominatorTree preDominatorTree) { + final List writers = events.stream() + .filter(e -> e instanceof RegWriter writer && writer.getResultRegister().equals(register)) + .map(RegWriter.class::cast).toList(); + + if (writers.size() != 1 || !(writers.get(0) instanceof Local assignment)) { + // There is no unique writer, or the unique writer is not a simple assignment. + return null; + } + // Since the assignment may go over several trivial copy assignments, we need to traverse + // the UseDef-chain until we find a non-trivial assignment. + final RegWriter source = chaseUseDefChain(assignment, useDefAnalysis, preDominatorTree); + if (!events.contains(source)) { + // For the edge case where the source is outside the provided events. + return null; + } + return source; + } + + private RegWriter chaseUseDefChain(RegWriter assignment, UseDefAnalysis useDefAnalysis, DominatorTree preDominatorTree) { + RegWriter cur = assignment; + while (cur instanceof Local loc && loc.getExpr() instanceof Register reg) { + final Set defs = useDefAnalysis.getDefs(loc, reg); + if (defs.size() != 1) { + // Multiple assignments (or none): too complex so give up. + return null; + } + final RegWriter def = defs.iterator().next(); + if (!preDominatorTree.isDominatedBy(cur, def)) { + // Sanity check that the only def is also dominating its use. + // This might not be true if there are accesses to uninitialized registers. + return null; + } + cur = def; + } + return cur; + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ProcessingManager.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ProcessingManager.java index b9b6d1fd8d..3ba67f144d 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ProcessingManager.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ProcessingManager.java @@ -85,9 +85,7 @@ private ProcessingManager(Configuration config) throws InvalidConfigurationExcep final FunctionProcessor removeDeadJumps = RemoveDeadCondJumps.fromConfig(config); programProcessors.addAll(Arrays.asList( printBeforeProcessing ? DebugPrint.withHeader("Before processing", Printer.Mode.ALL) : null, - ProgramProcessor.fromFunctionProcessor( - NormalizeLoops.newInstance(), Target.FUNCTIONS, true - ), + ProgramProcessor.fromFunctionProcessor(NormalizeLoops.newInstance(), Target.FUNCTIONS, true), intrinsics.markIntrinsicsPass(), GEPToAddition.newInstance(), NaiveDevirtualisation.newInstance(), @@ -110,6 +108,7 @@ private ProcessingManager(Configuration config) throws InvalidConfigurationExcep ProgramProcessor.fromFunctionProcessor(MemToReg.fromConfig(config), Target.FUNCTIONS, true), ProgramProcessor.fromFunctionProcessor(sccp, Target.FUNCTIONS, false), dynamicSpinLoopDetection ? DynamicSpinLoopDetection.fromConfig(config) : null, + ProgramProcessor.fromFunctionProcessor(NaiveLoopBoundAnnotation.newInstance(), Target.FUNCTIONS, true), LoopUnrolling.fromConfig(config), // We keep unrolling global for now printAfterUnrolling ? DebugPrint.withHeader("After loop unrolling", Printer.Mode.ALL) : null, ProgramProcessor.fromFunctionProcessor( diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/c/MiscellaneousTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/c/MiscellaneousTest.java index 2b8a304440..20dc4de093 100644 --- a/dartagnan/src/test/java/com/dat3m/dartagnan/c/MiscellaneousTest.java +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/c/MiscellaneousTest.java @@ -87,6 +87,7 @@ public static Iterable data() throws IOException { {"uninitRead", IMM, FAIL, 1}, {"multipleBackJumps", IMM, UNKNOWN, 1}, {"memcpy_s", IMM, PASS, 1}, + {"staticLoops", IMM, PASS, 1}, {"offsetof", IMM, PASS, 1}, {"ctlz", IMM, PASS, 1}, {"cttz", IMM, PASS, 1} diff --git a/dartagnan/src/test/resources/miscellaneous/staticLoops.ll b/dartagnan/src/test/resources/miscellaneous/staticLoops.ll new file mode 100644 index 0000000000..8d4a6f3e08 --- /dev/null +++ b/dartagnan/src/test/resources/miscellaneous/staticLoops.ll @@ -0,0 +1,181 @@ +; ModuleID = '/home/ponce/git/Dat3M/output/staticLoops.ll' +source_filename = "/home/ponce/git/Dat3M/benchmarks/c/miscellaneous/staticLoops.c" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-pc-linux-gnu" + +@x = dso_local global i32 0, align 4, !dbg !0 +@.str = private unnamed_addr constant [12 x i8] c"x == 3*INCS\00", align 1 +@.str.1 = private unnamed_addr constant [63 x i8] c"/home/ponce/git/Dat3M/benchmarks/c/miscellaneous/staticLoops.c\00", align 1 +@__PRETTY_FUNCTION__.main = private unnamed_addr constant [11 x i8] c"int main()\00", align 1 + +; Function Attrs: noinline nounwind uwtable +define dso_local i32 @main() #0 !dbg !17 { + %1 = alloca i32, align 4 + %2 = alloca i32, align 4 + %3 = alloca i32, align 4 + %4 = alloca i32, align 4 + store i32 0, i32* %1, align 4 + call void @llvm.dbg.declare(metadata i32* %2, metadata !20, metadata !DIExpression()), !dbg !22 + store i32 0, i32* %2, align 4, !dbg !22 + br label %5, !dbg !23 + +5: ; preds = %11, %0 + %6 = load i32, i32* %2, align 4, !dbg !24 + %7 = icmp slt i32 %6, 3, !dbg !26 + br i1 %7, label %8, label %14, !dbg !27 + +8: ; preds = %5 + %9 = load volatile i32, i32* @x, align 4, !dbg !28 + %10 = add nsw i32 %9, 1, !dbg !28 + store volatile i32 %10, i32* @x, align 4, !dbg !28 + br label %11, !dbg !29 + +11: ; preds = %8 + %12 = load i32, i32* %2, align 4, !dbg !30 + %13 = add nsw i32 %12, 1, !dbg !30 + store i32 %13, i32* %2, align 4, !dbg !30 + br label %5, !dbg !31, !llvm.loop !32 + +14: ; preds = %5 + call void @llvm.dbg.declare(metadata i32* %3, metadata !35, metadata !DIExpression()), !dbg !37 + store i32 -1, i32* %3, align 4, !dbg !37 + br label %15, !dbg !38 + +15: ; preds = %21, %14 + %16 = load i32, i32* %3, align 4, !dbg !39 + %17 = icmp slt i32 %16, 2, !dbg !41 + br i1 %17, label %18, label %24, !dbg !42 + +18: ; preds = %15 + %19 = load volatile i32, i32* @x, align 4, !dbg !43 + %20 = add nsw i32 %19, 1, !dbg !43 + store volatile i32 %20, i32* @x, align 4, !dbg !43 + br label %21, !dbg !44 + +21: ; preds = %18 + %22 = load i32, i32* %3, align 4, !dbg !45 + %23 = add nsw i32 %22, 1, !dbg !45 + store i32 %23, i32* %3, align 4, !dbg !45 + br label %15, !dbg !46, !llvm.loop !47 + +24: ; preds = %15 + call void @llvm.dbg.declare(metadata i32* %4, metadata !49, metadata !DIExpression()), !dbg !51 + store i32 1, i32* %4, align 4, !dbg !51 + br label %25, !dbg !52 + +25: ; preds = %31, %24 + %26 = load i32, i32* %4, align 4, !dbg !53 + %27 = icmp slt i32 %26, 4, !dbg !55 + br i1 %27, label %28, label %34, !dbg !56 + +28: ; preds = %25 + %29 = load volatile i32, i32* @x, align 4, !dbg !57 + %30 = add nsw i32 %29, 1, !dbg !57 + store volatile i32 %30, i32* @x, align 4, !dbg !57 + br label %31, !dbg !58 + +31: ; preds = %28 + %32 = load i32, i32* %4, align 4, !dbg !59 + %33 = add nsw i32 %32, 1, !dbg !59 + store i32 %33, i32* %4, align 4, !dbg !59 + br label %25, !dbg !60, !llvm.loop !61 + +34: ; preds = %25 + %35 = load volatile i32, i32* @x, align 4, !dbg !63 + %36 = icmp eq i32 %35, 9, !dbg !63 + br i1 %36, label %37, label %38, !dbg !66 + +37: ; preds = %34 + br label %39, !dbg !66 + +38: ; preds = %34 + call void @__assert_fail(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0), i32 19, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #3, !dbg !63 + unreachable, !dbg !63 + +39: ; preds = %37 + ret i32 0, !dbg !67 +} + +; Function Attrs: nofree nosync nounwind readnone speculatable willreturn +declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 + +; Function Attrs: noreturn nounwind +declare dso_local void @__assert_fail(i8*, i8*, i32, i8*) #2 + +attributes #0 = { noinline nounwind uwtable "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nofree nosync nounwind readnone speculatable willreturn } +attributes #2 = { noreturn nounwind "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #3 = { noreturn nounwind } + +!llvm.dbg.cu = !{!2} +!llvm.module.flags = !{!13, !14, !15} +!llvm.ident = !{!16} + +!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) +!1 = distinct !DIGlobalVariable(name: "x", scope: !2, file: !6, line: 6, type: !7, isLocal: false, isDefinition: true) +!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "Ubuntu clang version 12.0.0-3ubuntu1~20.04.5", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, splitDebugInlining: false, nameTableKind: None) +!3 = !DIFile(filename: "/home/ponce/git/Dat3M/benchmarks/c/miscellaneous/staticLoops.c", directory: "/home/ponce/git/Dat3M") +!4 = !{} +!5 = !{!0} +!6 = !DIFile(filename: "benchmarks/c/miscellaneous/staticLoops.c", directory: "/home/ponce/git/Dat3M") +!7 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !8) +!8 = !DIDerivedType(tag: DW_TAG_typedef, name: "int32_t", file: !9, line: 26, baseType: !10) +!9 = !DIFile(filename: "/usr/include/x86_64-linux-gnu/bits/stdint-intn.h", directory: "") +!10 = !DIDerivedType(tag: DW_TAG_typedef, name: "__int32_t", file: !11, line: 41, baseType: !12) +!11 = !DIFile(filename: "/usr/include/x86_64-linux-gnu/bits/types.h", directory: "") +!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!13 = !{i32 7, !"Dwarf Version", i32 4} +!14 = !{i32 2, !"Debug Info Version", i32 3} +!15 = !{i32 1, !"wchar_size", i32 4} +!16 = !{!"Ubuntu clang version 12.0.0-3ubuntu1~20.04.5"} +!17 = distinct !DISubprogram(name: "main", scope: !6, file: !6, line: 8, type: !18, scopeLine: 9, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4) +!18 = !DISubroutineType(types: !19) +!19 = !{!12} +!20 = !DILocalVariable(name: "i", scope: !21, file: !6, line: 10, type: !12) +!21 = distinct !DILexicalBlock(scope: !17, file: !6, line: 10, column: 5) +!22 = !DILocation(line: 10, column: 14, scope: !21) +!23 = !DILocation(line: 10, column: 10, scope: !21) +!24 = !DILocation(line: 10, column: 21, scope: !25) +!25 = distinct !DILexicalBlock(scope: !21, file: !6, line: 10, column: 5) +!26 = !DILocation(line: 10, column: 23, scope: !25) +!27 = !DILocation(line: 10, column: 5, scope: !21) +!28 = !DILocation(line: 11, column: 10, scope: !25) +!29 = !DILocation(line: 11, column: 9, scope: !25) +!30 = !DILocation(line: 10, column: 32, scope: !25) +!31 = !DILocation(line: 10, column: 5, scope: !25) +!32 = distinct !{!32, !27, !33, !34} +!33 = !DILocation(line: 11, column: 10, scope: !21) +!34 = !{!"llvm.loop.mustprogress"} +!35 = !DILocalVariable(name: "i", scope: !36, file: !6, line: 13, type: !12) +!36 = distinct !DILexicalBlock(scope: !17, file: !6, line: 13, column: 5) +!37 = !DILocation(line: 13, column: 14, scope: !36) +!38 = !DILocation(line: 13, column: 10, scope: !36) +!39 = !DILocation(line: 13, column: 22, scope: !40) +!40 = distinct !DILexicalBlock(scope: !36, file: !6, line: 13, column: 5) +!41 = !DILocation(line: 13, column: 24, scope: !40) +!42 = !DILocation(line: 13, column: 5, scope: !36) +!43 = !DILocation(line: 14, column: 10, scope: !40) +!44 = !DILocation(line: 14, column: 9, scope: !40) +!45 = !DILocation(line: 13, column: 35, scope: !40) +!46 = !DILocation(line: 13, column: 5, scope: !40) +!47 = distinct !{!47, !42, !48, !34} +!48 = !DILocation(line: 14, column: 10, scope: !36) +!49 = !DILocalVariable(name: "i", scope: !50, file: !6, line: 16, type: !12) +!50 = distinct !DILexicalBlock(scope: !17, file: !6, line: 16, column: 5) +!51 = !DILocation(line: 16, column: 14, scope: !50) +!52 = !DILocation(line: 16, column: 10, scope: !50) +!53 = !DILocation(line: 16, column: 21, scope: !54) +!54 = distinct !DILexicalBlock(scope: !50, file: !6, line: 16, column: 5) +!55 = !DILocation(line: 16, column: 23, scope: !54) +!56 = !DILocation(line: 16, column: 5, scope: !50) +!57 = !DILocation(line: 17, column: 10, scope: !54) +!58 = !DILocation(line: 17, column: 9, scope: !54) +!59 = !DILocation(line: 16, column: 34, scope: !54) +!60 = !DILocation(line: 16, column: 5, scope: !54) +!61 = distinct !{!61, !56, !62, !34} +!62 = !DILocation(line: 17, column: 10, scope: !50) +!63 = !DILocation(line: 19, column: 2, scope: !64) +!64 = distinct !DILexicalBlock(scope: !65, file: !6, line: 19, column: 2) +!65 = distinct !DILexicalBlock(scope: !17, file: !6, line: 19, column: 2) +!66 = !DILocation(line: 19, column: 2, scope: !65) +!67 = !DILocation(line: 21, column: 2, scope: !17) From 63566560cf129f4d4bcf008cea15c58e79bd4c47 Mon Sep 17 00:00:00 2001 From: Hernan Ponce de Leon Date: Thu, 4 Jul 2024 14:55:09 +0200 Subject: [PATCH 17/28] Automatically cancel previous CI when new commits are pushed (#700) Signed-off-by: Hernan Ponce de Leon Co-authored-by: Hernan Ponce de Leon --- .github/workflows/maven.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index b821688688..3aefcac35a 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -3,6 +3,11 @@ name: Build +# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + on: push: branches: [ master, development ] From 9f44db5d8d941ba67f0c3f9d09f094aeb13c444e Mon Sep 17 00:00:00 2001 From: Hernan Ponce de Leon Date: Mon, 22 Jul 2024 11:24:44 +0200 Subject: [PATCH 18/28] Update JavaSMT version (#701) --- .../dartagnan/encoding/ExpressionEncoder.java | 4 +- pom.xml | 54 +++++++++++++++++-- 2 files changed, 51 insertions(+), 7 deletions(-) diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/ExpressionEncoder.java b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/ExpressionEncoder.java index c60b88c542..66a55390d2 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/ExpressionEncoder.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/ExpressionEncoder.java @@ -187,8 +187,8 @@ public Formula visitIntBinaryExpression(IntBinaryExpr iBin) { case MUL -> bvmgr.multiply(bv1, bv2); case DIV -> bvmgr.divide(bv1, bv2, true); case UDIV -> bvmgr.divide(bv1, bv2, false); - case SREM -> bvmgr.modulo(bv1, bv2, true); - case UREM -> bvmgr.modulo(bv1, bv2, false); + case SREM -> bvmgr.remainder(bv1, bv2, true); + case UREM -> bvmgr.remainder(bv1, bv2, false); case AND -> bvmgr.and(bv1, bv2); case OR -> bvmgr.or(bv1, bv2); case XOR -> bvmgr.xor(bv1, bv2); diff --git a/pom.xml b/pom.xml index 1ff80f9116..ab2cc7d50b 100644 --- a/pom.xml +++ b/pom.xml @@ -30,15 +30,16 @@ 3.1.2 - 4.1.0 + 5.0.0 + 0.4.0-g4dbf3b1f 3.2.2-g1a89c229 5.6.10 1.8-prerelease-2020-06-24-g7825d8f28 1.0.5-g4cb2ab9eb - 2.5.2-g7f502169 - 4.1.0-1-gc58fe5b4 + 2.6.0-g2f72cc0e + 4.1.1-734-g3732f7e08 2.6.2-396-g194350c1 - 4.12.2 + 4.12.5 4.13.0 @@ -162,6 +163,22 @@ libz3java + + + org.sosy-lab + javasmt-solver-bitwuzla + ${bitwuzla.version} + jar + bitwuzla + + + org.sosy-lab + javasmt-solver-bitwuzla + ${bitwuzla.version} + libbitwuzlaj + so + + org.sosy-lab @@ -335,6 +352,15 @@ libz3.so + + + org.sosy-lab + javasmt-solver-bitwuzla + so + libbitwuzlaj + libbitwuzlaj.so + + org.sosy-lab @@ -572,6 +598,15 @@ libz3java + + + org.sosy-lab + javasmt-solver-bitwuzla + ${bitwuzla.version} + dll + libbitwuzlaj + + org.sosy-lab @@ -628,6 +663,15 @@ libz3.dll + + + org.sosy-lab + javasmt-solver-bitwuzla + dll + libbitwuzlaj + libbitwuzlaj.dll + + org.sosy-lab @@ -666,4 +710,4 @@ - \ No newline at end of file + From e87cb88b1972983e4fd8ad5c82e45dfe7692ba67 Mon Sep 17 00:00:00 2001 From: Dmitry Ivanov <32366373+DIvanov503@users.noreply.github.com> Date: Mon, 22 Jul 2024 21:34:47 +0200 Subject: [PATCH 19/28] Refactor relation analysis interface (#702) Co-authored-by: Dmitry Ivanov --- .../dartagnan/configuration/OptionNames.java | 3 +- .../configuration/RelationAnalysisMethod.java | 19 + .../dat3m/dartagnan/encoding/WmmEncoder.java | 28 +- .../com/dat3m/dartagnan/wmm/Assumption.java | 11 - .../com/dat3m/dartagnan/wmm/Constraint.java | 15 - .../wmm/analysis/CoarseRelationAnalysis.java | 82 + .../wmm/analysis/NativeRelationAnalysis.java | 1644 +++++++++++++++++ .../wmm/analysis/RelationAnalysis.java | 1545 +--------------- .../dat3m/dartagnan/wmm/axiom/Acyclicity.java | 110 -- .../dat3m/dartagnan/wmm/axiom/Emptiness.java | 7 - .../dartagnan/wmm/axiom/Irreflexivity.java | 9 - 11 files changed, 1812 insertions(+), 1661 deletions(-) create mode 100644 dartagnan/src/main/java/com/dat3m/dartagnan/configuration/RelationAnalysisMethod.java create mode 100644 dartagnan/src/main/java/com/dat3m/dartagnan/wmm/analysis/CoarseRelationAnalysis.java create mode 100644 dartagnan/src/main/java/com/dat3m/dartagnan/wmm/analysis/NativeRelationAnalysis.java diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/configuration/OptionNames.java b/dartagnan/src/main/java/com/dat3m/dartagnan/configuration/OptionNames.java index 824b0f3194..3cec00bf75 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/configuration/OptionNames.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/configuration/OptionNames.java @@ -54,8 +54,7 @@ public class OptionNames { public static final String MERGE_BRANCHES = "program.analysis.cf.mergeBranches"; // Memory Model Options - public static final String ENABLE_RELATION_ANALYSIS = "wmm.analysis.relationAnalysis"; - public static final String ENABLE_MUST_SETS = "wmm.analysis.mustSets"; + public static final String RELATION_ANALYSIS = "wmm.analysis.relationAnalysis"; public static final String ENABLE_EXTENDED_RELATION_ANALYSIS = "wmm.analysis.extendedRelationAnalysis"; // Refinement Options diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/configuration/RelationAnalysisMethod.java b/dartagnan/src/main/java/com/dat3m/dartagnan/configuration/RelationAnalysisMethod.java new file mode 100644 index 0000000000..c0f57dae6d --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/configuration/RelationAnalysisMethod.java @@ -0,0 +1,19 @@ +package com.dat3m.dartagnan.configuration; + +import java.util.Arrays; + +public enum RelationAnalysisMethod implements OptionInterface { + NONE, NATIVE; + + public static RelationAnalysisMethod getDefault() { + return NATIVE; + } + + // Used to decide the order shown by the selector in the UI + public static RelationAnalysisMethod[] orderedValues() { + RelationAnalysisMethod[] order = { NONE, NATIVE }; + // Be sure no element is missing + assert(Arrays.asList(order).containsAll(Arrays.asList(values()))); + return order; + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/WmmEncoder.java b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/WmmEncoder.java index 7cd860cd17..ff1f0e49d3 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/WmmEncoder.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/WmmEncoder.java @@ -135,7 +135,7 @@ public BooleanFormula encodeConsistency() { enc.addAll(a.consistent(context)); } } - ra.getMutuallyExclusiveEdges() + ra.getContradictions() .apply((e1, e2) -> enc.add(bmgr.not(context.execution(e1, e2)))); return bmgr.and(enc); } @@ -145,7 +145,7 @@ public EventGraph getEventGraph(Relation relation, Model model) { EventGraph encodeSet = encodeSets.getOrDefault(relation, EventGraph.empty()) .filter((e1, e2) -> TRUE.equals(model.evaluate(edge.encode(e1, e2)))); EventGraph mustEncodeSet = context.getAnalysisContext().get(RelationAnalysis.class).getKnowledge(relation).getMustSet() - .filter((e1, e2) -> TRUE.equals(model.evaluate(context.execution(e1, e2)))); + .filter((e1, e2) -> TRUE.equals(model.evaluate(context.execution(e1, e2)))); encodeSet.addAll(mustEncodeSet); return encodeSet; } @@ -648,9 +648,9 @@ public Void visitSyncBarrier(SyncBar syncBar) { @Override public Void visitSyncFence(SyncFence syncFenceDef) { - final Relation syncFence = syncFenceDef.getDefinedRelation();; + final Relation syncFence = syncFenceDef.getDefinedRelation(); final boolean idl = !context.useSATEncoding; - final String relName = syncFence.getName().get(); // syncFence is base, it always has a name + final String relName = syncFence.getName().orElseThrow(); // syncFence is base, it always has a name List allFenceSC = program.getThreadEventsWithAllTags(VISIBLE, FENCE, PTX.SC); allFenceSC.removeIf(e -> !e.getThread().hasScope()); EncodingContext.EdgeEncoder edge = context.edge(syncFence); @@ -725,25 +725,7 @@ private void initializeEncodeSets() { } } RelationAnalysis ra = context.getAnalysisContext().get(RelationAnalysis.class); - RelationAnalysis.Propagator p = ra.new Propagator(); - for (Relation r : context.getTask().getMemoryModel().getRelations()) { - EventGraph may = new EventGraph(); - EventGraph must = new EventGraph(); - if (r.getDependencies().isEmpty()) { - continue; - } - for (Relation c : r.getDependencies()) { - p.setSource(c); - p.setMay(ra.getKnowledge(p.getSource()).getMaySet()); - p.setMust(ra.getKnowledge(p.getSource()).getMustSet()); - RelationAnalysis.Delta s = r.getDefinition().accept(p); - may.addAll(s.may); - must.addAll(s.must); - } - may.removeAll(ra.getKnowledge(r).getMaySet()); - EventGraph must2 = difference(ra.getKnowledge(r).getMustSet(), must); - queue.computeIfAbsent(r, k -> new ArrayList<>()).add(EventGraph.union(may, must2)); - } + ra.populateQueue(queue, context.getTask().getMemoryModel().getRelations()); while (!queue.isEmpty()) { Relation r = queue.keySet().iterator().next(); logger.trace("Update encode set of '{}'", r); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/Assumption.java b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/Assumption.java index 4131d62f81..2da9f984e9 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/Assumption.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/Assumption.java @@ -35,17 +35,6 @@ public Set getConstrainedRelations() { return Set.of(rel); } - @Override - public Map computeInitialKnowledgeClosure(Map knowledgeMap, Context analysisContext) { - RelationAnalysis.Knowledge k = knowledgeMap.get(rel); - EventGraph d = difference(k.getMaySet(), may); - EventGraph e = difference(must, k.getMustSet()); - if (d.size() + e.size() != 0) { - logger.info("Assumption disables {} and enables {} at {}", d.size(), e.size(), rel.getNameOrTerm()); - } - return Map.of(rel, new RelationAnalysis.ExtendedDelta(d, e)); - } - @Override public T accept(Visitor visitor) { return visitor.visitAssumption(this); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/Constraint.java b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/Constraint.java index fb87df1478..1a674d9626 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/Constraint.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/Constraint.java @@ -19,21 +19,6 @@ public interface Constraint { T accept(Constraint.Visitor visitor); - default Map computeInitialKnowledgeClosure( - Map knowledgeMap, - Context analysisContext) { - return Map.of(); - } - - default Map computeIncrementalKnowledgeClosure( - Relation origin, - EventGraph disabled, - EventGraph enabled, - Map knowledgeMap, - Context analysisContext) { - return Map.of(); - } - default Map getEncodeGraph(VerificationTask task, Context analysisContext) { return Map.of(); } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/analysis/CoarseRelationAnalysis.java b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/analysis/CoarseRelationAnalysis.java new file mode 100644 index 0000000000..ed6e99e5c1 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/analysis/CoarseRelationAnalysis.java @@ -0,0 +1,82 @@ +package com.dat3m.dartagnan.wmm.analysis; + +import com.dat3m.dartagnan.program.analysis.Dependency; +import com.dat3m.dartagnan.program.analysis.ExecutionAnalysis; +import com.dat3m.dartagnan.program.analysis.alias.AliasAnalysis; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.utils.dependable.DependencyGraph; +import com.dat3m.dartagnan.verification.Context; +import com.dat3m.dartagnan.verification.VerificationTask; +import com.dat3m.dartagnan.wmm.*; +import com.dat3m.dartagnan.wmm.utils.EventGraph; +import org.sosy_lab.common.configuration.Configuration; +import org.sosy_lab.common.configuration.InvalidConfigurationException; + +import java.util.*; + +import static com.dat3m.dartagnan.program.event.Tag.*; +import static java.util.stream.Collectors.toSet; + +public class CoarseRelationAnalysis extends NativeRelationAnalysis { + + private CoarseRelationAnalysis(VerificationTask t, Context context, Configuration config) { + super(t, context, config); + } + + /** + * Performs a static analysis on the relationships that may occur in an execution. + * + * @param task Program, target memory model and property to check. + * @param context Collection of static analyses already performed on {@code task} with respect to {@code memoryModel}. + * Should at least include the following elements: + *
    + *
  • {@link ExecutionAnalysis} + *
  • {@link Dependency} + *
  • {@link AliasAnalysis} + *
  • {@link WmmAnalysis} + *
+ * @param config User-defined options to further specify the behavior. + */ + public static CoarseRelationAnalysis fromConfig(VerificationTask task, Context context, Configuration config) throws InvalidConfigurationException { + return new CoarseRelationAnalysis(task, context, config); + } + + @Override + protected void processSCC(Propagator propagator, Set.Node> scc, Map> qGlobal, Map> dependents) { + if (scc.stream().map(DependencyGraph.Node::getContent).noneMatch(Relation::isInternal)) { + return; + } + super.processSCC(propagator, scc, qGlobal, dependents); + } + + @Override + protected void checkAfterRun(Map> qGlobal) { + } + + @Override + public void runExtended() { + run(); + } + + @Override + protected Initializer getInitializer() { + return new EmptyInitializer(); + } + + private final class EmptyInitializer extends NativeRelationAnalysis.Initializer { + final Knowledge defaultKnowledge; + + EmptyInitializer() { + EventGraph may = new EventGraph(); + Set events = program.getThreadEvents().stream().filter(e -> e.hasTag(VISIBLE)).collect(toSet()); + events.forEach(x -> may.addRange(x, events)); + defaultKnowledge = new Knowledge(may, EventGraph.empty()); + } + + @Override + public Knowledge visitDefinition(Definition def) { + return !def.getDefinedRelation().isInternal() ? defaultKnowledge + : new Knowledge(new EventGraph(), new EventGraph()); + } + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/analysis/NativeRelationAnalysis.java b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/analysis/NativeRelationAnalysis.java new file mode 100644 index 0000000000..1528e45fed --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/analysis/NativeRelationAnalysis.java @@ -0,0 +1,1644 @@ +package com.dat3m.dartagnan.wmm.analysis; + +import com.dat3m.dartagnan.program.Program; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.Register.UsageType; +import com.dat3m.dartagnan.program.Thread; +import com.dat3m.dartagnan.program.analysis.BranchEquivalence; +import com.dat3m.dartagnan.program.analysis.Dependency; +import com.dat3m.dartagnan.program.analysis.ExecutionAnalysis; +import com.dat3m.dartagnan.program.analysis.alias.AliasAnalysis; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.event.MemoryEvent; +import com.dat3m.dartagnan.program.event.RegReader; +import com.dat3m.dartagnan.program.event.Tag; +import com.dat3m.dartagnan.program.event.core.*; +import com.dat3m.dartagnan.program.event.lang.svcomp.EndAtomic; +import com.dat3m.dartagnan.program.filter.Filter; +import com.dat3m.dartagnan.program.memory.VirtualMemoryObject; +import com.dat3m.dartagnan.utils.dependable.DependencyGraph; +import com.dat3m.dartagnan.verification.Context; +import com.dat3m.dartagnan.verification.VerificationTask; +import com.dat3m.dartagnan.witness.graphml.WitnessGraph; +import com.dat3m.dartagnan.wmm.*; +import com.dat3m.dartagnan.wmm.axiom.Acyclicity; +import com.dat3m.dartagnan.wmm.axiom.Axiom; +import com.dat3m.dartagnan.wmm.axiom.Emptiness; +import com.dat3m.dartagnan.wmm.axiom.Irreflexivity; +import com.dat3m.dartagnan.wmm.definition.*; +import com.dat3m.dartagnan.wmm.utils.EventGraph; +import com.dat3m.dartagnan.wmm.utils.Tuple; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.sosy_lab.common.configuration.Configuration; +import org.sosy_lab.common.configuration.InvalidConfigurationException; + +import java.util.*; +import java.util.stream.Stream; + +import static com.dat3m.dartagnan.configuration.Arch.RISCV; +import static com.dat3m.dartagnan.program.Register.UsageType.*; +import static com.dat3m.dartagnan.program.event.Tag.*; +import static com.dat3m.dartagnan.wmm.utils.EventGraph.difference; +import static com.dat3m.dartagnan.wmm.utils.EventGraph.intersection; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Verify.verify; +import static com.google.common.collect.Lists.reverse; +import static java.util.stream.Collectors.toList; +import static java.util.stream.Collectors.toSet; +import static java.util.stream.IntStream.iterate; + +public class NativeRelationAnalysis implements RelationAnalysis { + + private static final Logger logger = LogManager.getLogger(NativeRelationAnalysis.class); + + protected final VerificationTask task; + protected final Context analysisContext; + protected final ExecutionAnalysis exec; + protected final AliasAnalysis alias; + protected final Dependency dep; + protected final WmmAnalysis wmmAnalysis; + protected final Map knowledgeMap = new HashMap<>(); + protected final EventGraph mutex = new EventGraph(); + + protected NativeRelationAnalysis(VerificationTask t, Context context, Configuration config) { + task = checkNotNull(t); + analysisContext = context; + exec = context.requires(ExecutionAnalysis.class); + alias = context.requires(AliasAnalysis.class); + dep = context.requires(Dependency.class); + wmmAnalysis = context.requires(WmmAnalysis.class); + } + + /** + * Performs a static analysis on the relationships that may occur in an execution. + * + * @param task Program, target memory model and property to check. + * @param context Collection of static analyses already performed on {@code task} with respect to {@code memoryModel}. + * Should at least include the following elements: + *
    + *
  • {@link ExecutionAnalysis} + *
  • {@link Dependency} + *
  • {@link AliasAnalysis} + *
  • {@link WmmAnalysis} + *
+ * @param config User-defined options to further specify the behavior. + */ + public static NativeRelationAnalysis fromConfig(VerificationTask task, Context context, Configuration config) throws InvalidConfigurationException { + return new NativeRelationAnalysis(task, context, config); + } + + @Override + public Knowledge getKnowledge(Relation relation) { + return knowledgeMap.get(relation); + } + + @Override + public EventGraph getContradictions() { + //TODO return undirected pairs + return mutex; + } + + @Override + public void populateQueue(Map> queue, Set relations) { + Propagator p = new Propagator(); + for (Relation r : relations) { + EventGraph may = new EventGraph(); + EventGraph must = new EventGraph(); + if (r.getDependencies().isEmpty()) { + continue; + } + for (Relation c : r.getDependencies()) { + p.setSource(c); + p.setMay(getKnowledge(p.getSource()).getMaySet()); + p.setMust(getKnowledge(p.getSource()).getMustSet()); + Delta s = r.getDefinition().accept(p); + may.addAll(s.may); + must.addAll(s.must); + } + may.removeAll(getKnowledge(r).getMaySet()); + EventGraph must2 = difference(getKnowledge(r).getMustSet(), must); + queue.computeIfAbsent(r, k -> new ArrayList<>()).add(EventGraph.union(may, must2)); + } + } + + @Override + public EventGraph findTransitivelyImpliedCo(Relation co) { + final Knowledge k = getKnowledge(co); + EventGraph transCo = new EventGraph(); + Map> mustIn = k.getMustSet().getInMap(); + Map> mustOut = k.getMustSet().getOutMap(); + k.getMaySet().apply((e1, e2) -> { + final MemoryEvent x = (MemoryEvent) e1; + final MemoryEvent z = (MemoryEvent) e2; + boolean hasIntermediary = mustOut.getOrDefault(x, Set.of()).stream().anyMatch(y -> y != x && y != z && + (exec.isImplied(x, y) || exec.isImplied(z, y)) && + !k.getMaySet().contains(z, y)) + || mustIn.getOrDefault(z, Set.of()).stream().anyMatch(y -> y != x && y != z && + (exec.isImplied(x, y) || exec.isImplied(z, y)) && + !k.getMaySet().contains(y, x)); + if (hasIntermediary) { + transCo.add(e1, e2); + } + }); + return transCo; + } + + @Override + public void run() { + logger.trace("Start"); + final Wmm memoryModel = task.getMemoryModel(); + final Map> dependents = new HashMap<>(); + for (Relation r : memoryModel.getRelations()) { + for (Relation d : r.getDependencies()) { + dependents.computeIfAbsent(d, k -> new ArrayList<>()).add(r.getDefinition()); + } + } + // ------------------------------------------------ + final Initializer initializer = getInitializer(); + final Map> qGlobal = new HashMap<>(); + for (Relation r : memoryModel.getRelations()) { + Knowledge k = r.getDefinition().accept(initializer); + knowledgeMap.put(r, k); + if (!k.getMaySet().isEmpty() || !k.getMustSet().isEmpty()) { + qGlobal.computeIfAbsent(r, x -> new ArrayList<>(1)) + .add(new Delta(k.getMaySet(), k.getMustSet())); + } + } + // ------------------------------------------------ + final Propagator propagator = new Propagator(); + DependencyGraph.from(memoryModel.getRelations()).getSCCs().forEach(scc -> processSCC(propagator, scc, qGlobal, dependents)); + checkAfterRun(qGlobal); + logger.trace("End"); + } + + protected void checkAfterRun(Map> qGlobal) { + verify(qGlobal.isEmpty(), "knowledge buildup propagated downwards"); + } + + protected void processSCC(Propagator propagator, Set.Node> scc, Map> qGlobal, Map> dependents) { + logger.trace("Regular analysis for component {}", scc); + Set stratum = scc.stream().map(DependencyGraph.Node::getContent).collect(toSet()); + // the algorithm has deterministic order, only if all components are deterministically-ordered + Map> qLocal = new LinkedHashMap<>(); + // move from global queue + for (Relation r : stratum) { + List d = qGlobal.remove(r); + if (d != null) { + qLocal.put(r, d); + } + } + // repeat until convergence + while (!qLocal.isEmpty()) { + Relation relation = qLocal.keySet().iterator().next(); + logger.trace("Regular knowledge update for '{}'", relation); + + // A fix for https://github.com/hernanponcedeleon/Dat3M/issues/523 + // In our current propagation approach, whenever a relation r gets updated, + // we compute for each dependent relation "r' = r op x" an update U(r, x, r') that needs to get applied. + // When r' gets processed, the update U(r, x, r') is applied as is to r'. + // However, depending on whether x is before or after r in the stratification, the computed update + // may be different. In particular, we compute updates to r' before all its dependencies were computed + // and thus our computation does not strictly follow the stratification. + // This does not matter if the update function U(r, x, r') is monotonic in r/x but if it is not, + // an early computed update may be too large! + // We fix this problem by reducing the potentially too large update U(r, x, r') before applying it to r'. + // TODO: The necessity of the fix suggests that our propagation algorithm is flawed. + // We should reconsider our algorithm. + Delta toAdd = Delta.combine(qLocal.remove(relation)); + if (relation.getDefinition() instanceof Difference difference) { + // Our propagated update may be "too large" so we reduce it. + Knowledge k = knowledgeMap.get(difference.getSubtrahend()); + toAdd.may.removeAll(k.getMustSet()); + toAdd.must.removeAll(k.getMaySet()); + } + + Delta delta = joinSet(knowledgeMap.get(relation), List.of(toAdd)); + if (delta.may.isEmpty() && delta.must.isEmpty()) { + continue; + } + + propagator.setSource(relation); + propagator.setMay(delta.may); + propagator.setMust(delta.must); + for (Definition c : dependents.getOrDefault(relation, List.of())) { + logger.trace("Regular propagation from '{}' to '{}'", relation, c); + Relation r = c.getDefinedRelation(); + Delta d = c.accept(propagator); + (stratum.contains(r) ? qLocal : qGlobal) + .computeIfAbsent(r, k -> new ArrayList<>()) + .add(d); + } + } + } + + @Override + public void runExtended() { + logger.trace("Start"); + Wmm memoryModel = task.getMemoryModel(); + Map> dependents = new HashMap<>(); + Map> q = new LinkedHashMap<>(); + for (Constraint c : memoryModel.getConstraints()) { + if (c instanceof Axiom axiom && axiom.isFlagged()) { + continue; + } + for (Relation r : c.getConstrainedRelations()) { + dependents.computeIfAbsent(r, k -> new ArrayList<>()).add(c); + } + for (Map.Entry e : + c.accept(new InitialKnowledgeCloser(knowledgeMap, analysisContext)).entrySet()) { + q.computeIfAbsent(e.getKey(), k -> new ArrayList<>()).add(e.getValue()); + } + } + ExtendedPropagator propagator = new ExtendedPropagator(); + // repeat until convergence + while (!q.isEmpty()) { + Relation relation = q.keySet().iterator().next(); + logger.trace("Extended knowledge update for '{}'", relation); + Knowledge knowledge = knowledgeMap.get(relation); + ExtendedDelta delta = join(knowledge, q.remove(relation)); + if (delta.disabled.isEmpty() && delta.enabled.isEmpty()) { + continue; + } + mutex.addAll(difference(delta.enabled, knowledge.getMaySet())); + mutex.addAll(intersection(delta.disabled, knowledge.getMustSet())); + propagator.origin = relation; + EventGraph disabled = propagator.disabled = delta.disabled; + EventGraph enabled = propagator.enabled = delta.enabled; + for (Constraint c : dependents.getOrDefault(relation, List.of())) { + logger.trace("Extended propagation from '{}' to '{}'", relation, c); + for (Map.Entry e : + c.accept(new IncrementalKnowledgeCloser(relation, disabled, enabled, knowledgeMap, analysisContext)).entrySet()) { + q.computeIfAbsent(e.getKey(), k -> new ArrayList<>()).add(e.getValue()); + } + if (!(c instanceof Definition)) { + continue; + } + for (Map.Entry e : c.accept(propagator).entrySet()) { + q.computeIfAbsent(e.getKey(), k -> new ArrayList<>()).add(e.getValue()); + } + } + } + logger.trace("End"); + } + + protected Initializer getInitializer() { + return new Initializer(); + } + + private static Delta joinSet(Knowledge k, List l) { + verify(!l.isEmpty(), "empty update"); + EventGraph may = k.getMaySet(); + EventGraph must = k.getMustSet(); + // NOTE optimization due to initial deltas carrying references to knowledge sets + EventGraph maySet = may.isEmpty() || l.get(0).may == may ? may : new EventGraph(); + EventGraph mustSet = must.isEmpty() || l.get(0).must == must ? must : new EventGraph(); + for (Delta d : l) { + d.may.apply((e1, e2) -> { + if (may.add(e1, e2)) { + maySet.add(e1, e2); + } + }); + d.must.apply((e1, e2) -> { + if (must.add(e1, e2)) { + mustSet.add(e1, e2); + } + }); + } + return new Delta(maySet, mustSet); + } + + private static ExtendedDelta join(Knowledge k, List l) { + verify(!l.isEmpty(), "empty update in extended analysis"); + EventGraph may = k.getMaySet(); + EventGraph must = k.getMustSet(); + EventGraph disableSet = new EventGraph(); + EventGraph enableSet = new EventGraph(); + l.stream().map(d -> d.disabled).map(EventGraph::new).forEach(e -> e.filter(may::remove).apply(disableSet::add)); + l.stream().map(d -> d.enabled).map(EventGraph::new).forEach(e -> e.filter(must::remove).apply(enableSet::add)); + return new ExtendedDelta(disableSet, enableSet); + } + + private static final class InitialKnowledgeCloser implements Constraint.Visitor> { + private final Map knowledgeMap; + private final Context analysisContext; + + public InitialKnowledgeCloser( + Map knowledgeMap, + Context analysisContext) { + this.knowledgeMap = knowledgeMap; + this.analysisContext = analysisContext; + } + + @Override + public Map visitConstraint(Constraint constraint) { + return Map.of(); + } + + @Override + public Map visitEmptiness(Emptiness axiom) { + Relation rel = axiom.getRelation(); + return Map.of(rel, new ExtendedDelta(knowledgeMap.get(rel).getMaySet(), EventGraph.empty())); + } + + @Override + public Map visitIrreflexivity(Irreflexivity axiom) { + Relation rel = axiom.getRelation(); + Knowledge k = knowledgeMap.get(rel); + EventGraph d = k.getMaySet().filter(Tuple::isLoop); + return Map.of(rel, new ExtendedDelta(d, EventGraph.empty())); + } + + @Override + public Map visitAcyclicity(Acyclicity axiom) { + long t0 = System.currentTimeMillis(); + Relation rel = axiom.getRelation(); + ExecutionAnalysis exec = analysisContext.get(ExecutionAnalysis.class); + Knowledge knowledge = knowledgeMap.get(rel); + EventGraph may = knowledge.getMaySet(); + EventGraph must = knowledge.getMustSet(); + EventGraph newDisabled = new EventGraph(); + may.filter((e1, e2) -> Tuple.isLoop(e1, e2) || must.contains(e2, e1)).apply(newDisabled::add); + Map> mustOut = new HashMap<>(); + must.filter((e1, e2) -> !Tuple.isLoop(e1, e2)).apply((e1, e2) -> mustOut.computeIfAbsent(e1, x -> new ArrayList<>()).add(e2)); + EventGraph current = knowledge.getMustSet(); + do { + EventGraph next = new EventGraph(); + current.filter(Tuple::isLoop).apply((x, y) -> { + boolean implied = exec.isImplied(x, y); + mustOut.getOrDefault(y, List.of()).stream() + .filter(z -> implied || exec.isImplied(z, y)) + .filter(z -> !exec.areMutuallyExclusive(x, z)) + .filter(z -> newDisabled.add(z, x)) + .forEach(z -> next.add(x, z)); + }); + current = next; + } while (!current.isEmpty()); + newDisabled.retainAll(knowledge.getMaySet()); + logger.debug("disabled {} edges in {}ms", newDisabled.size(), System.currentTimeMillis() - t0); + return Map.of(rel, new ExtendedDelta(newDisabled, EventGraph.empty())); + } + + @Override + public Map visitAssumption(Assumption assume) { + Relation rel = assume.getRelation(); + Knowledge k = knowledgeMap.get(rel); + EventGraph d = difference(k.getMaySet(), assume.getMaySet()); + EventGraph e = difference(assume.getMustSet(), k.getMustSet()); + if (d.size() + e.size() != 0) { + logger.info("Assumption disables {} and enables {} at {}", d.size(), e.size(), rel.getNameOrTerm()); + } + return Map.of(rel, new ExtendedDelta(d, e)); + } + } + + private static final class IncrementalKnowledgeCloser implements Constraint.Visitor> { + private final Relation changed; + private final EventGraph disabled; + private final EventGraph enabled; + private final Map knowledgeMap; + private final Context analysisContext; + + public IncrementalKnowledgeCloser( + Relation changed, + EventGraph disabled, + EventGraph enabled, + Map knowledgeMap, + Context analysisContext) { + this.changed = changed; + this.disabled = disabled; + this.enabled = enabled; + this.knowledgeMap = knowledgeMap; + this.analysisContext = analysisContext; + } + + @Override + public Map visitConstraint(Constraint constraint) { + return Map.of(); + } + + @Override + public Map visitAcyclicity(Acyclicity axiom) { + Relation rel = axiom.getRelation(); + checkArgument(changed == rel, + "misdirected knowledge propagation from relation %s to %s", changed, this); + long t0 = System.currentTimeMillis(); + ExecutionAnalysis exec = analysisContext.get(ExecutionAnalysis.class); + Knowledge knowledge = knowledgeMap.get(rel); + EventGraph may = knowledge.getMaySet(); + EventGraph newDisabled = new EventGraph(); + enabled.filter((e1, e2) -> may.contains(e2, e1)).apply((e1, e2) -> newDisabled.add(e2, e1)); + Map> mustIn = new HashMap<>(); + Map> mustOut = new HashMap<>(); + knowledge.getMustSet().filter((e1, e2) -> !Tuple.isLoop(e1, e2)).apply((e1, e2) -> { + mustIn.computeIfAbsent(e2, x -> new ArrayList<>()).add(e1); + mustOut.computeIfAbsent(e1, x -> new ArrayList<>()).add(e2); + }); + + EventGraph current = enabled; + do { + EventGraph next = new EventGraph(); + current.filter((x, y) -> !Tuple.isLoop(x, y)).apply((x, y) -> { + boolean implies = exec.isImplied(x, y); + boolean implied = exec.isImplied(y, x); + mustIn.getOrDefault(x, List.of()).stream() + .filter(w -> implied || exec.isImplied(w, x)) + .filter(w -> !exec.areMutuallyExclusive(w, y)) + .filter(w -> newDisabled.add(y, w)) + .forEach(w -> next.add(w, y)); + mustOut.getOrDefault(y, List.of()).stream() + .filter(z -> implies || exec.isImplied(z, y)) + .filter(z -> !exec.areMutuallyExclusive(x, z)) + .filter(z -> newDisabled.add(z, x)) + .forEach(z -> next.add(x, z)); + }); + current = next; + } while (!current.isEmpty()); + newDisabled.retainAll(knowledge.getMaySet()); + logger.debug("Disabled {} edges in {}ms", newDisabled.size(), System.currentTimeMillis() - t0); + return Map.of(rel, new ExtendedDelta(newDisabled, EventGraph.empty())); + } + } + + protected class Initializer implements Definition.Visitor { + final Program program = task.getProgram(); + final WitnessGraph witness = task.getWitness(); + + @Override + public Knowledge visitDefinition(Definition def) { + return new Knowledge(new EventGraph(), new EventGraph()); + } + + @Override + public Knowledge visitFree(Free def) { + final List visibleEvents = program.getThreadEventsWithAllTags(VISIBLE); + EventGraph must = EventGraph.empty(); + EventGraph may = new EventGraph(); + + for (Event e1 : visibleEvents) { + for (Event e2 : visibleEvents) { + may.add(e1, e2); + } + } + + return new Knowledge(may, must); + } + + @Override + public Knowledge visitProduct(CartesianProduct prod) { + final Filter domain = prod.getFirstFilter(); + final Filter range = prod.getSecondFilter(); + EventGraph must = new EventGraph(); + List l1 = program.getThreadEvents().stream().filter(domain::apply).toList(); + List l2 = program.getThreadEvents().stream().filter(range::apply).toList(); + for (Event e1 : l1) { + Set rangeEvents = l2.stream() + .filter(e2 -> !exec.areMutuallyExclusive(e1, e2)) + .collect(toSet()); + must.addRange(e1, rangeEvents); + } + return new Knowledge(must, new EventGraph(must)); + } + + @Override + public Knowledge visitSetIdentity(SetIdentity id) { + final Filter set = id.getFilter(); + EventGraph must = new EventGraph(); + program.getThreadEvents().stream().filter(set::apply).forEach(e -> must.add(e, e)); + return new Knowledge(must, new EventGraph(must)); + } + + @Override + public Knowledge visitExternal(External ext) { + EventGraph must = new EventGraph(); + List threads = program.getThreads(); + for (int i = 0; i < threads.size(); i++) { + Thread t1 = threads.get(i); + List visible1 = visibleEvents(t1); + for (int j = i + 1; j < threads.size(); j++) { + Thread t2 = threads.get(j); + for (Event e2 : visibleEvents(t2)) { + for (Event e1 : visible1) { + // No test for exec.areMutuallyExclusive, since that currently does not span across threads + must.add(e1, e2); + must.add(e2, e1); + } + } + } + } + return new Knowledge(must, new EventGraph(must)); + } + + @Override + public Knowledge visitInternal(Internal internal) { + EventGraph must = new EventGraph(); + for (Thread t : program.getThreads()) { + List events = visibleEvents(t); + for (Event e1 : events) { + Set rangeEvents = events.stream() + .filter(e2 -> !exec.areMutuallyExclusive(e1, e2)) + .collect(toSet()); + must.addRange(e1, rangeEvents); + } + } + return new Knowledge(must, new EventGraph(must)); + } + + @Override + public Knowledge visitProgramOrder(ProgramOrder po) { + final Filter type = po.getFilter(); + EventGraph must = new EventGraph(); + for (Thread t : program.getThreads()) { + List events = t.getEvents().stream().filter(type::apply).toList(); + for (int i = 0; i < events.size(); i++) { + Event e1 = events.get(i); + for (int j = i + 1; j < events.size(); j++) { + Event e2 = events.get(j); + if (!exec.areMutuallyExclusive(e1, e2)) { + must.add(e1, e2); + } + } + } + } + return new Knowledge(must, new EventGraph(must)); + } + + @Override + public Knowledge visitControlDependency(DirectControlDependency ctrlDep) { + //TODO: We can restrict the codomain to visible events as the only usage of this Relation is in + // ctrl := idd^+;ctrlDirect & (R*V) + EventGraph must = new EventGraph(); + for (Thread thread : program.getThreads()) { + for (CondJump jump : thread.getEvents(CondJump.class)) { + if (jump.isGoto() || jump.isDead()) { + continue; // There is no point in ctrl-edges from unconditional jumps. + } + + final List ctrlDependentEvents; + if (jump instanceof IfAsJump ifJump) { + // Ctrl dependencies of Ifs (under Linux) only extend up until the merge point of both + // branches. + ctrlDependentEvents = ifJump.getBranchesEvents(); + } else { + // Regular jumps give dependencies to all successors. + ctrlDependentEvents = jump.getSuccessor().getSuccessors(); + } + + for (Event e : ctrlDependentEvents) { + if (!exec.areMutuallyExclusive(jump, e)) { + must.add(jump, e); + } + } + } + } + return new Knowledge(must, new EventGraph(must)); + } + + @Override + public Knowledge visitAddressDependency(DirectAddressDependency addrDep) { + return computeInternalDependencies(EnumSet.of(ADDR)); + } + + @Override + public Knowledge visitInternalDataDependency(DirectDataDependency idd) { + // FIXME: Our "internal data dependency" relation is quite odd an contains all but address dependencies. + return computeInternalDependencies(EnumSet.of(DATA, CTRL, OTHER)); + } + + @Override + public Knowledge visitFences(Fences fenceDef) { + final Filter fence = fenceDef.getFilter(); + EventGraph may = new EventGraph(); + EventGraph must = new EventGraph(); + for (Thread t : program.getThreads()) { + List events = visibleEvents(t); + int end = events.size(); + for (int i = 0; i < end; i++) { + Event f = events.get(i); + if (!fence.apply(f)) { + continue; + } + for (Event x : events.subList(0, i)) { + if (exec.areMutuallyExclusive(x, f)) { + continue; + } + boolean implies = exec.isImplied(x, f); + for (Event y : events.subList(i + 1, end)) { + if (exec.areMutuallyExclusive(x, y) || exec.areMutuallyExclusive(f, y)) { + continue; + } + may.add(x, y); + if (implies || exec.isImplied(y, f)) { + must.add(x, y); + } + } + } + } + } + return new Knowledge(may, must); + } + + @Override + public Knowledge visitCASDependency(CASDependency casDep) { + EventGraph must = new EventGraph(); + for (Event e : program.getThreadEvents()) { + if (e.hasTag(IMM.CASDEPORIGIN)) { + // The target of a CASDep is always the successor of the origin + must.add(e, e.getSuccessor()); + } + } + return new Knowledge(must, new EventGraph(must)); + } + + @Override + public Knowledge visitLinuxCriticalSections(LinuxCriticalSections rscs) { + EventGraph may = new EventGraph(); + EventGraph must = new EventGraph(); + //assume locks and unlocks are distinct + Map> mayMap = new HashMap<>(); + Map> mustMap = new HashMap<>(); + for (Thread thread : program.getThreads()) { + List locks = reverse(thread.getEvents().stream().filter(e -> e.hasTag(Linux.RCU_LOCK)).collect(toList())); + for (Event unlock : thread.getEvents()) { + if (!unlock.hasTag(Linux.RCU_UNLOCK)) { + continue; + } + // iteration order assures that all intermediaries were already iterated + for (Event lock : locks) { + if (unlock.getGlobalId() < lock.getGlobalId() || + exec.areMutuallyExclusive(lock, unlock) || + Stream.concat(mustMap.getOrDefault(lock, Set.of()).stream(), + mustMap.getOrDefault(unlock, Set.of()).stream()) + .anyMatch(e -> exec.isImplied(lock, e) || exec.isImplied(unlock, e))) { + continue; + } + boolean noIntermediary = + mayMap.getOrDefault(unlock, Set.of()).stream() + .allMatch(e -> exec.areMutuallyExclusive(lock, e)) && + mayMap.getOrDefault(lock, Set.of()).stream() + .allMatch(e -> exec.areMutuallyExclusive(e, unlock)); + may.add(lock, unlock); + mayMap.computeIfAbsent(lock, x -> new HashSet<>()).add(unlock); + mayMap.computeIfAbsent(unlock, x -> new HashSet<>()).add(lock); + if (noIntermediary) { + must.add(lock, unlock); + mustMap.computeIfAbsent(lock, x -> new HashSet<>()).add(unlock); + mustMap.computeIfAbsent(unlock, x -> new HashSet<>()).add(lock); + } + } + } + } + return new Knowledge(may, must); + } + + @Override + public Knowledge visitReadModifyWrites(ReadModifyWrites rmw) { + //NOTE: Changes to the semantics of this method may need to be reflected in RMWGraph for Refinement! + // ----- Compute must set ----- + EventGraph must = new EventGraph(); + // RMWLoad -> RMWStore + for (RMWStore store : program.getThreadEvents(RMWStore.class)) { + must.add(store.getLoadEvent(), store); + } + + // Atomics blocks: BeginAtomic -> EndAtomic + for (EndAtomic end : program.getThreadEvents(EndAtomic.class)) { + List block = end.getBlock().stream().filter(x -> x.hasTag(VISIBLE)).toList(); + for (int i = 0; i < block.size(); i++) { + Event e = block.get(i); + for (int j = i + 1; j < block.size(); j++) { + if (!exec.areMutuallyExclusive(e, block.get(j))) { + must.add(e, block.get(j)); + } + } + } + } + // ----- Compute may set ----- + EventGraph may = new EventGraph(must); + // LoadExcl -> StoreExcl + for (Thread thread : program.getThreads()) { + List events = thread.getEvents().stream().filter(e -> e.hasTag(EXCL)).toList(); + // assume order by globalId + // assume globalId describes a topological sorting over the control flow + for (int end = 1; end < events.size(); end++) { + if (!(events.get(end) instanceof RMWStoreExclusive store)) { + continue; + } + int start = iterate(end - 1, i -> i >= 0, i -> i - 1) + .filter(i -> exec.isImplied(store, events.get(i))) + .findFirst().orElse(0); + List candidates = events.subList(start, end).stream() + .filter(e -> !exec.areMutuallyExclusive(e, store)) + .toList(); + int size = candidates.size(); + for (int i = 0; i < size; i++) { + Event load = candidates.get(i); + List intermediaries = candidates.subList(i + 1, size); + if (!(load instanceof Load) || intermediaries.stream().anyMatch(e -> exec.isImplied(load, e))) { + continue; + } + may.add(load, store); + if (intermediaries.stream().allMatch(e -> exec.areMutuallyExclusive(load, e)) && + (store.doesRequireMatchingAddresses() || alias.mustAlias((Load) load, store))) { + must.add(load, store); + } + } + } + } + return new Knowledge(may, must); + } + + @Override + public Knowledge visitCoherence(Coherence co) { + logger.trace("Computing knowledge about memory order"); + List nonInitWrites = program.getThreadEvents(Store.class); + nonInitWrites.removeIf(Init.class::isInstance); + EventGraph may = new EventGraph(); + for (Store w1 : program.getThreadEvents(Store.class)) { + for (Store w2 : nonInitWrites) { + if (w1.getGlobalId() != w2.getGlobalId() && !exec.areMutuallyExclusive(w1, w2) + && alias.mayAlias(w1, w2)) { + may.add(w1, w2); + } + } + } + EventGraph must = new EventGraph(); + may.apply((e1, e2) -> { + MemoryCoreEvent w1 = (MemoryCoreEvent) e1; + MemoryCoreEvent w2 = (MemoryCoreEvent) e2; + if (!w2.hasTag(INIT) && alias.mustAlias(w1, w2) && w1.hasTag(INIT)) { + must.add(w1, w2); + } + }); + if (wmmAnalysis.isLocallyConsistent()) { + may.removeIf(Tuple::isBackward); + may.apply((e1, e2) -> { + MemoryCoreEvent w1 = (MemoryCoreEvent) e1; + MemoryCoreEvent w2 = (MemoryCoreEvent) e2; + if (alias.mustAlias(w1, w2) && Tuple.isForward(e1, e2)) { + must.add(w1, w2); + } + }); + } + + // Must-co from violation witness + if (!witness.isEmpty()) { + must.addAll(witness.getCoherenceKnowledge(program, alias)); + } + + logger.debug("Initial may set size for memory order: {}", may.size()); + return new Knowledge(may, must); + } + + @Override + public Knowledge visitReadFrom(ReadFrom rf) { + logger.trace("Computing knowledge about read-from"); + final BranchEquivalence eq = analysisContext.requires(BranchEquivalence.class); + EventGraph may = new EventGraph(); + EventGraph must = new EventGraph(); + List loadEvents = program.getThreadEvents(Load.class); + for (Store e1 : program.getThreadEvents(Store.class)) { + for (Load e2 : loadEvents) { + if (alias.mayAlias(e1, e2) && !exec.areMutuallyExclusive(e1, e2)) { + may.add(e1, e2); + } + } + } + + // Here we add must-rf edges between loads/stores that synchronize threads. + for (Thread thread : program.getThreads()) { + List spawned = thread.getSpawningEvents(); + if (spawned.size() == 2) { + MemoryCoreEvent startLoad = spawned.get(0); + MemoryCoreEvent startStore = spawned.get(1); + must.add(startStore, startLoad); + if (eq.isImplied(startLoad, startStore)) { + may.removeIf((e1, e2) -> e2 == startLoad && e1 != startStore); + } + } + } + + if (wmmAnalysis.isLocallyConsistent()) { + // Remove future reads + may.removeIf(Tuple::isBackward); + // Remove past reads + EventGraph deletedEdges = new EventGraph(); + Map> writesByRead = new HashMap<>(); + may.apply((e1, e2) -> writesByRead.computeIfAbsent(e2, x -> new ArrayList<>()).add(e1)); + for (Load read : program.getThreadEvents(Load.class)) { + // The set of same-thread writes as well as init writes that could be read from (all before the read) + // sorted by order (init events first) + List possibleWrites = writesByRead.getOrDefault(read, List.of()).stream() + .filter(e -> (e.getThread() == read.getThread() || e.hasTag(INIT))) + .map(x -> (MemoryCoreEvent) x) + .sorted((o1, o2) -> o1.hasTag(INIT) == o2.hasTag(INIT) ? (o1.getGlobalId() - o2.getGlobalId()) : o1.hasTag(INIT) ? -1 : 1) + .toList(); + // The set of writes that won't be readable due getting overwritten. + Set deletedWrites = new HashSet<>(); + // A rf-edge (w1, r) is impossible, if there exists a write w2 such that + // - w2 is exec-implied by w1 or r (i.e. cf-implied + w2.cfImpliesExec) + // - w2 must alias with either w1 or r. + for (int i = 0; i < possibleWrites.size(); i++) { + MemoryCoreEvent w1 = possibleWrites.get(i); + for (MemoryCoreEvent w2 : possibleWrites.subList(i + 1, possibleWrites.size())) { + // w2 dominates w1 if it aliases with it and it is guaranteed to execute if either w1 or the read are + // executed + if ((exec.isImplied(w1, w2) || exec.isImplied(read, w2)) + && (alias.mustAlias(w1, w2) || alias.mustAlias(w2, read))) { + deletedWrites.add(w1); + break; + } + } + } + for (Event w : deletedWrites) { + deletedEdges.add(w, read); + } + } + may.removeAll(deletedEdges); + } + if (wmmAnalysis.doesRespectAtomicBlocks()) { + //TODO: This function can not only reduce rf-edges + // but we could also figure out implied coherences: + // Assume w1 and w2 are aliasing in the same block and w1 is before w2, + // then if w1 is co-before some external w3, then so is w2, i.e. + // co(w1, w3) => co(w2, w3), but we also have co(w2, w3) => co(w1, w3) + // so co(w1, w3) <=> co(w2, w3). + // This information is not expressible in terms of min/must sets, but + // we could still encode it. + int sizeBefore = may.size(); + // Atomics blocks: BeginAtomic -> EndAtomic + for (EndAtomic endAtomic : program.getThreadEvents(EndAtomic.class)) { + // Collect memEvents of the atomic block + List writes = new ArrayList<>(); + List reads = new ArrayList<>(); + for (Event b : endAtomic.getBlock()) { + if (b instanceof Load load) { + reads.add(load); + } else if (b instanceof Store store) { + writes.add(store); + } + } + for (Load r : reads) { + // If there is any write w inside the atomic block that is guaranteed to + // execute before the read and that aliases with it, + // then the read won't be able to read any external writes + boolean hasImpliedWrites = writes.stream() + .anyMatch(w -> w.getGlobalId() < r.getGlobalId() + && exec.isImplied(r, w) && alias.mustAlias(r, w)); + if (hasImpliedWrites) { + may.removeIf((e1, e2) -> e2 == r && Tuple.isCrossThread(e1, e2)); + } + } + } + logger.debug("Atomic block optimization eliminated {} reads", sizeBefore - may.size()); + } + + // Must-rf from violation witness + if (!witness.isEmpty()) { + EventGraph g = witness.getReadFromKnowledge(program, alias); + must.addAll(g); + for (Event r : g.getRange()) { + may.removeIf((e1, e2) -> e2 == r); + } + } + + logger.debug("Initial may set size for read-from: {}", may.size()); + return new Knowledge(may, must); + } + + @Override + public Knowledge visitSameLocation(SameLocation loc) { + EventGraph may = new EventGraph(); + List events = program.getThreadEvents(MemoryCoreEvent.class); + for (MemoryCoreEvent e1 : events) { + for (MemoryCoreEvent e2 : events) { + if (alias.mayAlias(e1, e2) && !exec.areMutuallyExclusive(e1, e2)) { + may.add(e1, e2); + } + } + } + EventGraph must = new EventGraph(); + may.apply((e1, e2) -> { + if (alias.mustAlias((MemoryCoreEvent) e1, (MemoryCoreEvent) e2)) { + must.add(e1, e2); + } + }); + return new Knowledge(may, must); + } + + private Knowledge computeInternalDependencies(Set usageTypes) { + EventGraph may = new EventGraph(); + EventGraph must = new EventGraph(); + + for (RegReader regReader : program.getThreadEvents(RegReader.class)) { + for (Register.Read regRead : regReader.getRegisterReads()) { + if (!usageTypes.contains(regRead.usageType())) { + continue; + } + final Register register = regRead.register(); + // Register x0 is hardwired to the constant 0 in RISCV + // https://en.wikichip.org/wiki/risc-v/registers, + // and thus it generates no dependency, see + // https://github.com/herd/herdtools7/issues/408 + // TODO: Can't we just replace all reads of "x0" by 0 in RISC-specific preprocessing? + if (program.getArch().equals(RISCV) && register.getName().equals("x0")) { + continue; + } + Dependency.State r = dep.of(regReader, register); + for (Event regWriter : r.may) { + may.add(regWriter, regReader); + } + for (Event regWriter : r.must) { + must.add(regWriter, regReader); + } + } + } + + // We need to track ExecutionStatus events separately, because they induce data-dependencies + // without reading from a register. + if (usageTypes.contains(DATA)) { + for (ExecutionStatus execStatus : program.getThreadEvents(ExecutionStatus.class)) { + if (execStatus.doesTrackDep()) { + may.add(execStatus.getStatusEvent(), execStatus); + must.add(execStatus.getStatusEvent(), execStatus); + } + } + } + + return new Knowledge(may, must); + } + + @Override + public Knowledge visitSameScope(SameScope sc) { + final String specificScope = sc.getSpecificScope(); + EventGraph must = new EventGraph(); + List events = program.getThreadEvents().stream() + .filter(e -> e.hasTag(VISIBLE) && e.getThread().hasScope()) + .toList(); + for (Event e1 : events) { + for (Event e2 : events) { + if (exec.areMutuallyExclusive(e1, e2)) { + continue; + } + Thread thread1 = e1.getThread(); + Thread thread2 = e2.getThread(); + if (specificScope != null) { // scope specified + if (thread1.getScopeHierarchy().canSyncAtScope(thread2.getScopeHierarchy(), specificScope)) { + must.add(e1, e2); + } + } else { + String scope1 = Tag.getScopeTag(e1, program.getArch()); + String scope2 = Tag.getScopeTag(e2, program.getArch()); + if (!scope1.isEmpty() && !scope2.isEmpty() && thread1.getScopeHierarchy().canSyncAtScope(thread2.getScopeHierarchy(), scope1) + && thread2.getScopeHierarchy().canSyncAtScope(thread1.getScopeHierarchy(), scope2)) { + must.add(e1, e2); + } + } + } + } + return new Knowledge(must, new EventGraph(must)); + } + + @Override + public Knowledge visitSyncBarrier(SyncBar syncBar) { + EventGraph may = new EventGraph(); + EventGraph must = new EventGraph(); + List fenceEvents = program.getThreadEvents(FenceWithId.class); + for (FenceWithId e1 : fenceEvents) { + for (FenceWithId e2 : fenceEvents) { + // “A bar.sync or bar.red or bar.arrive operation synchronizes with a bar.sync + // or bar.red operation executed on the same barrier.” + if (exec.areMutuallyExclusive(e1, e2) || e2.hasTag(PTX.ARRIVE)) { + continue; + } + may.add(e1, e2); + if (e1.getFenceID().equals(e2.getFenceID())) { + must.add(e1, e2); + } + } + } + return new Knowledge(may, must); + } + + @Override + public Knowledge visitSyncFence(SyncFence syncFence) { + EventGraph may = new EventGraph(); + EventGraph must = EventGraph.empty(); + List fenceEventsSC = program.getThreadEventsWithAllTags(VISIBLE, FENCE, PTX.SC); + for (Event e1 : fenceEventsSC) { + for (Event e2 : fenceEventsSC) { + if (!exec.areMutuallyExclusive(e1, e2)) { + may.add(e1, e2); + } + } + } + return new Knowledge(may, must); + } + + @Override + public Knowledge visitSameVirtualLocation(SameVirtualLocation vloc) { + EventGraph must = new EventGraph(); + EventGraph may = new EventGraph(); + List events = program.getThreadEvents(MemoryCoreEvent.class); + for (MemoryCoreEvent e1 : events) { + for (MemoryCoreEvent e2 : events) { + if (sameGenericAddress(e1, e2) && !exec.areMutuallyExclusive(e1, e2)) { + if (alias.mustAlias(e1, e2)) { + must.add(e1, e2); + } + if (alias.mayAlias(e1, e2)) { + may.add(e1, e2); + } + } + } + } + return new Knowledge(may, must); + } + + @Override + public Knowledge visitSyncWith(SyncWith syncWith) { + EventGraph must = new EventGraph(); + List events = new ArrayList<>(program.getThreadEventsWithAllTags(VISIBLE)); + events.removeIf(Init.class::isInstance); + for (Event e1 : events) { + for (Event e2 : events) { + Thread thread1 = e1.getThread(); + Thread thread2 = e2.getThread(); + if (thread1 == thread2 || !thread1.hasSyncSet()) { + continue; + } + if (thread1.getSyncSet().contains(thread2) && !exec.areMutuallyExclusive(e1, e2)) { + must.add(e1, e2); + } + } + } + return new Knowledge(must, new EventGraph(must)); + } + } + + private final class ExtendedPropagator implements Definition.Visitor> { + Relation origin; + EventGraph disabled; + EventGraph enabled; + + @Override + public Map visitDefinition(Definition def) { + return Map.of(); + } + + @Override + public Map visitUnion(Union union) { + final Relation rel = union.getDefinedRelation(); + final List operands = union.getOperands(); + Map map = new HashMap<>(); + if (origin.equals(rel)) { + for (Relation o : operands) { + map.put(o, new ExtendedDelta(disabled, EventGraph.empty())); + } + } + if (operands.contains(origin)) { + EventGraph d = new EventGraph(); + disabled.apply((e1, e2) -> { + if (operands.stream().noneMatch(o -> knowledgeMap.get(o).getMaySet().contains(e1, e2))) { + d.add(e1, e2); + } + }); + map.put(rel, new ExtendedDelta(d, enabled)); + } + return map; + } + + @Override + public Map visitIntersection(Intersection inter) { + final Relation rel = inter.getDefinedRelation(); + final List operands = inter.getOperands(); + Map map = new HashMap<>(); + if (origin.equals(rel)) { + for (Relation o : operands) { + EventGraph d = operands.stream() + .map(r -> o.equals(r) ? disabled : knowledgeMap.get(r).getMustSet()) + .sorted(Comparator.comparingInt(EventGraph::size)) + .reduce(EventGraph::intersection) + .orElseThrow(); + map.putIfAbsent(o, new ExtendedDelta(d, enabled)); + } + } + if (operands.contains(origin)) { + EventGraph e = operands.stream() + .map(r -> origin.equals(r) ? enabled : knowledgeMap.get(r).getMustSet()) + .sorted(Comparator.comparingInt(EventGraph::size)) + .reduce(EventGraph::intersection) + .orElseThrow(); + map.put(rel, new ExtendedDelta(disabled, e)); + } + return map; + } + + @Override + public Map visitDifference(Difference diff) { + final Relation r0 = diff.getDefinedRelation(); + final Relation r1 = diff.getMinuend(); + final Relation r2 = diff.getSubtrahend(); + Map map = new HashMap<>(); + if (origin.equals(r0)) { + map.put(r1, new ExtendedDelta(difference(disabled, knowledgeMap.get(r2).getMaySet()), enabled)); + //map.put(r2, new ExtendedDelta(EMPTY_SET, intersection(disabled, knowledgeMap.get(r1).getMustSet()))); + } + if (origin.equals(r1)) { + map.put(r0, new ExtendedDelta(disabled, difference(enabled, knowledgeMap.get(r2).getMaySet()))); + } + if (origin.equals(r2)) { + Knowledge k1 = knowledgeMap.get(r1); + map.put(r0, new ExtendedDelta(intersection(enabled, k1.getMaySet()), intersection(disabled, k1.getMustSet()))); + map.put(r1, new ExtendedDelta(difference(disabled, knowledgeMap.get(r0).getMaySet()), EventGraph.empty())); + } + return map; + } + + @Override + public Map visitComposition(Composition comp) { + final Relation r0 = comp.getDefinedRelation(); + final Relation r1 = comp.getLeftOperand(); + final Relation r2 = comp.getRightOperand(); + EventGraph d0 = new EventGraph(); + EventGraph e0 = new EventGraph(); + EventGraph d1 = new EventGraph(); + EventGraph d2 = new EventGraph(); + Knowledge k0 = knowledgeMap.get(r0); + Knowledge k1 = knowledgeMap.get(r1); + Knowledge k2 = knowledgeMap.get(r2); + if (origin.equals(r0)) { + Map> mustOut1 = k1.getMustSet().getOutMap(); + Map> mustIn2 = k2.getMustSet().getInMap(); + disabled.apply((x, z) -> { + boolean implies = exec.isImplied(x, z); + boolean implied = exec.isImplied(z, x); + for (Event y : mustOut1.getOrDefault(x, Set.of())) { + if ((implied || exec.isImplied(y, x)) && k2.getMaySet().contains(y, z)) { + d2.add(y, z); + } + } + for (Event y : mustIn2.getOrDefault(z, Set.of())) { + if ((implies || exec.isImplied(y, z)) && k1.getMaySet().contains(x, y)) { + d1.add(x, y); + } + } + }); + } + + if (origin.equals(r1)) { + List result = handleCompositionChild(disabled, enabled, + k0.getMaySet(), k1.getMaySet(), k2.getMaySet(), k2.getMustSet()); + result.get(0).getOutMap().forEach((e1, value) -> value.forEach(e2 -> d0.add(e1, e2))); + result.get(1).getOutMap().forEach((e1, value) -> value.forEach(e2 -> e0.add(e1, e2))); + result.get(2).getOutMap().forEach((e1, value) -> value.forEach(e2 -> d2.add(e1, e2))); + } + + if (origin.equals(r2)) { + List result = handleCompositionChild(disabled.inverse(), enabled.inverse(), + k0.getMaySet().inverse(), k2.getMaySet().inverse(), k1.getMaySet().inverse(), k1.getMustSet().inverse()); + result.get(0).getOutMap().forEach((e2, value) -> value.forEach(e1 -> d0.add(e1, e2))); + result.get(1).getOutMap().forEach((e2, value) -> value.forEach(e1 -> e0.add(e1, e2))); + result.get(2).getOutMap().forEach((e2, value) -> value.forEach(e1 -> d1.add(e1, e2))); + } + + Map map = new HashMap<>(); + map.put(r0, new ExtendedDelta(d0, e0)); + map.computeIfAbsent(r1, k -> new ExtendedDelta(d1, new EventGraph())).disabled.addAll(d1); + map.computeIfAbsent(r2, k -> new ExtendedDelta(d2, new EventGraph())).disabled.addAll(d2); + return map; + } + + private List handleCompositionChild( + EventGraph disOut1, + EventGraph enOut1, + EventGraph mayOut0, + EventGraph mayOut1, + EventGraph mayOut2, + EventGraph mustOut2 + ) { + List result = handleCompositionEnabledSet(enOut1, mayOut2, mustOut2, mayOut0); + EventGraph disOut0 = handleCompositionDisabledSet(disOut1, mayOut1, mayOut2); + EventGraph enOut0 = result.get(0); + EventGraph disOut2 = result.get(1); + return List.of(disOut0, enOut0, disOut2); + } + + private EventGraph handleCompositionDisabledSet( + EventGraph disOut1, + EventGraph mayOut1, + EventGraph mayOut2 + ) { + EventGraph result = new EventGraph(); + for (Event e1 : disOut1.getDomain()) { + for (Event e : disOut1.getRange(e1)) { + Set e2Set = new HashSet<>(mayOut2.getRange(e)); + e2Set.removeIf(e2 -> exec.areMutuallyExclusive(e1, e2)); + e2Set.removeAll(result.getRange(e1)); + if (!e2Set.isEmpty()) { + for (Event eAlt : mayOut1.getRange(e1)) { + e2Set.removeAll(mayOut2.getRange(eAlt)); + if (e2Set.isEmpty()) { + break; + } + } + } + result.addRange(e1, e2Set); + } + } + return result; + } + + private List handleCompositionEnabledSet( + EventGraph enOut1, + EventGraph mayOut2, + EventGraph mustOut2, + EventGraph mayOut0 + ) { + EventGraph enOut0 = new EventGraph(); + EventGraph disOut2 = new EventGraph(); + for (Event e1 : enOut1.getDomain()) { + for (Event e : enOut1.getRange(e1)) { + Set e2Set = new HashSet<>(mayOut2.getRange(e)); + e2Set.removeIf(e2 -> exec.areMutuallyExclusive(e1, e2)); + if (!e2Set.isEmpty()) { + Set e2SetCopy = new HashSet<>(e2Set); + e2Set.retainAll(mustOut2.getRange(e)); + if (!exec.isImplied(e1, e)) { + e2Set.removeIf(e2 -> !exec.isImplied(e2, e)); + } + enOut0.addRange(e1, e2Set); + e2SetCopy.removeAll(mayOut0.getRange(e1)); + if (!exec.isImplied(e, e1)) { + e2SetCopy.removeIf(e2 -> !exec.isImplied(e2, e1)); + } + disOut2.addRange(e, e2SetCopy); + } + } + } + return List.of(enOut0, disOut2); + } + + @Override + public Map visitInverse(Inverse inv) { + final Relation r0 = inv.getDefinedRelation(); + final Relation r1 = inv.getOperand(); + if (origin.equals(r0)) { + return Map.of(r1, new ExtendedDelta(disabled.inverse(), EventGraph.empty())); + } + if (origin.equals(r1)) { + return Map.of(r0, new ExtendedDelta(disabled.inverse(), enabled.inverse())); + } + return Map.of(); + } + + @Override + public Map visitTransitiveClosure(TransitiveClosure trans) { + final Relation r0 = trans.getDefinedRelation(); + final Relation r1 = trans.getOperand(); + EventGraph d0 = new EventGraph(); + EventGraph e0 = new EventGraph(); + EventGraph d1 = new EventGraph(); + Knowledge k0 = knowledgeMap.get(r0); + Knowledge k1 = knowledgeMap.get(r1); + if (origin.equals(r1)) { + Map> mayOut0 = k0.getMaySet().getOutMap(); + Map> mayIn0 = k0.getMaySet().getInMap(); + disabled.apply((x, y) -> { + Set alternatives = k1.getMaySet().getRange(x); + if (k0.getMaySet().contains(x, y) + && Collections.disjoint(alternatives, mayIn0.getOrDefault(y, Set.of()))) { + d0.add(x, y); + } + if (!Tuple.isLoop(x, y)) { + for (Event z : mayOut0.getOrDefault(y, Set.of())) { + if (k0.getMaySet().contains(x, z) + && !alternatives.contains(z) + && Collections.disjoint(alternatives, mayIn0.getOrDefault(z, Set.of()))) { + d0.add(x, z); + } + } + } + }); + e0.addAll(enabled); + enabled.apply((x, y) -> { + if (!Tuple.isLoop(x, y)) { + boolean implied = exec.isImplied(y, x); + boolean implies = exec.isImplied(x, y); + for (Event z : mayOut0.getOrDefault(y, Set.of())) { + if (exec.areMutuallyExclusive(x, z)) { + continue; + } + if ((implies || exec.isImplied(z, y)) && k0.getMustSet().contains(y, z)) { + e0.add(x, z); + } + if ((implied || exec.isImplied(z, x)) && !k0.getMaySet().contains(x, z)) { + d0.add(y, z); + } + } + } + }); + } + if (origin.equals(r0)) { + Map> mustIn0 = k0.getMustSet().getInMap(); + Map> mayIn1 = k1.getMaySet().getInMap(); + Map> mustOut1 = k1.getMustSet().getOutMap(); + d1.addAll(intersection(disabled, k1.getMaySet())); + disabled.apply((x, z) -> { + if (!Tuple.isLoop(x, z)) { + boolean implied = exec.isImplied(z, x); + boolean implies = exec.isImplied(x, z); + for (Event y : mustOut1.getOrDefault(x, Set.of())) { + if ((implied || exec.isImplied(y, x)) && k0.getMaySet().contains(y, z)) { + d0.add(y, z); + } + } + for (Event y : mustIn0.getOrDefault(z, Set.of())) { + if ((implies || exec.isImplied(y, z)) && k1.getMaySet().contains(x, y)) { + d1.add(x, y); + } + } + } + }); + enabled.apply((y, z) -> { + if (!Tuple.isLoop(y, z)) { + boolean implied = exec.isImplied(z, y); + boolean implies = exec.isImplied(y, z); + for (Event x : mayIn1.getOrDefault(y, Set.of())) { + if (exec.areMutuallyExclusive(x, z)) { + continue; + } + if ((implied || exec.isImplied(x, y)) && k1.getMustSet().contains(x, y)) { + e0.add(x, z); + } + if ((implies || exec.isImplied(x, z)) && !k0.getMaySet().contains(x, z)) { + d1.add(x, y); + } + } + } + }); + } + return Map.of( + r0, new ExtendedDelta(d0, e0), + r1, new ExtendedDelta(d1, EventGraph.empty())); + } + + @Override + public Map visitCoherence(Coherence coDef) { + if (disabled.isEmpty()) { + return Map.of(); + } + //TODO use transitivity + EventGraph e = new EventGraph(); + disabled.apply((x, y) -> { + if (alias.mustAlias((MemoryCoreEvent) x, (MemoryCoreEvent) y)) { + e.add(y, x); + } + }); + return Map.of(coDef.getDefinedRelation(), new ExtendedDelta(EventGraph.empty(), e)); + } + } + + private static List visibleEvents(Thread t) { + return t.getEvents().stream().filter(e -> e.hasTag(VISIBLE)).toList(); + } + + @Override + public long countMaySet() { + return knowledgeMap.values().stream().mapToLong(k -> k.getMaySet().size()).sum(); + } + + @Override + public long countMustSet() { + return knowledgeMap.values().stream().mapToLong(k -> k.getMustSet().size()).sum(); + } + + // GPU memory models make use of virtual addresses. + // This models same_alias_r from the PTX Alloy model + // Checking address1 and address2 hold the same generic address + private boolean sameGenericAddress(MemoryCoreEvent e1, MemoryCoreEvent e2) { + // TODO: Add support for pointers, i.e. if `x` and `y` virtually alias, + // then `x + offset` and `y + offset` should too + if (!(e1.getAddress() instanceof VirtualMemoryObject addr1) + || !(e2.getAddress() instanceof VirtualMemoryObject addr2)) { + return false; + } + return addr1.getGenericAddress() == addr2.getGenericAddress(); + } + + protected static final class Delta { + public static final Delta EMPTY = new Delta(EventGraph.empty(), EventGraph.empty()); + + public final EventGraph may; + public final EventGraph must; + + public Delta(EventGraph maySet, EventGraph mustSet) { + may = maySet; + must = mustSet; + } + + public static Delta combine(List deltas) { + if (deltas.size() == 1) { + return deltas.get(0); + } + EventGraph mayDelta = new EventGraph(); + EventGraph mustDelta = new EventGraph(); + for (Delta d : deltas) { + mayDelta.addAll(d.may); + mustDelta.addAll(d.must); + } + return new Delta(mayDelta, mustDelta); + } + } + + //FIXME should be visible only to implementations of Constraint + private static final class ExtendedDelta { + final EventGraph disabled; + final EventGraph enabled; + + public ExtendedDelta(EventGraph d, EventGraph e) { + disabled = d; + enabled = e; + } + } + + protected final class Propagator implements Definition.Visitor { + private Relation source; + private EventGraph may; + private EventGraph must; + + public Relation getSource() { + return source; + } + + public void setSource(Relation source) { + this.source = source; + } + + public EventGraph getMay() { + return may; + } + + public void setMay(EventGraph may) { + this.may = may; + } + + public EventGraph getMust() { + return must; + } + + public void setMust(EventGraph must) { + this.must = must; + } + + @Override + public Delta visitUnion(Union union) { + if (union.getOperands().contains(source)) { + return new Delta(may, must); + } + return Delta.EMPTY; + } + + @Override + public Delta visitIntersection(Intersection inter) { + final List operands = inter.getOperands(); + if (operands.contains(source)) { + EventGraph maySet = operands.stream() + .map(r -> source.equals(r) ? may : getKnowledge(r).getMaySet()) + .sorted(Comparator.comparingInt(EventGraph::size)) + .reduce(EventGraph::intersection) + .orElseThrow(); + EventGraph mustSet = operands.stream() + .map(r -> source.equals(r) ? must : getKnowledge(r).getMustSet()) + .sorted(Comparator.comparingInt(EventGraph::size)) + .reduce(EventGraph::intersection) + .orElseThrow(); + return new Delta(maySet, mustSet); + } + return Delta.EMPTY; + } + + @Override + public Delta visitDifference(Difference diff) { + if (diff.getMinuend().equals(source)) { + Knowledge k = getKnowledge(diff.getSubtrahend()); + return new Delta(difference(may, k.getMustSet()), difference(must, k.getMaySet())); + } + return Delta.EMPTY; + } + + @Override + public Delta visitComposition(Composition comp) { + final Relation r1 = comp.getLeftOperand(); + final Relation r2 = comp.getRightOperand(); + EventGraph maySet = new EventGraph(); + EventGraph mustSet = new EventGraph(); + if (r1.equals(source)) { + computeComposition(maySet, may, getKnowledge(r2).getMaySet(), true); + computeComposition(mustSet, must, getKnowledge(r2).getMustSet(), false); + } + if (r2.equals(source)) { + computeComposition(maySet, getKnowledge(r1).getMaySet(), may, true); + computeComposition(mustSet, getKnowledge(r1).getMustSet(), must, false); + } + return new Delta(maySet, mustSet); + } + + private void computeComposition(EventGraph result, EventGraph left, EventGraph right, final boolean isMay) { + for (Event e1 : left.getDomain()) { + Set update = new HashSet<>(); + for (Event e : left.getRange(e1)) { + if (isMay || exec.isImplied(e1, e)) { + update.addAll(right.getRange(e)); + } else { + update.addAll(right.getRange(e).stream() + .filter(e2 -> exec.isImplied(e2, e)).toList()); + } + } + update.removeIf(e -> exec.areMutuallyExclusive(e1, e)); + result.addRange(e1, update); + } + } + + @Override + public Delta visitDomainIdentity(DomainIdentity domId) { + if (domId.getOperand().equals(source)) { + EventGraph maySet = new EventGraph(); + may.getDomain().forEach(e -> maySet.add(e, e)); + EventGraph mustSet = new EventGraph(); + must.apply((e1, e2) -> { + if (exec.isImplied(e1, e2)) { + mustSet.add(e1, e1); + } + }); + return new Delta(maySet, mustSet); + } + return Delta.EMPTY; + } + + @Override + public Delta visitRangeIdentity(RangeIdentity rangeId) { + if (rangeId.getOperand().equals(source)) { + EventGraph maySet = new EventGraph(); + may.getRange().forEach(e -> maySet.add(e, e)); + EventGraph mustSet = new EventGraph(); + must.apply((e1, e2) -> { + if (exec.isImplied(e2, e1)) { + mustSet.add(e2, e2); + } + }); + return new Delta(maySet, mustSet); + } + return Delta.EMPTY; + } + + @Override + public Delta visitInverse(Inverse inv) { + if (inv.getOperand().equals(source)) { + return new Delta(may.inverse(), must.inverse()); + } + return Delta.EMPTY; + } + + @Override + public Delta visitTransitiveClosure(TransitiveClosure trans) { + final Relation rel = trans.getDefinedRelation(); + if (trans.getOperand().equals(source)) { + EventGraph maySet = computeTransitiveClosure(getKnowledge(rel).getMaySet(), may, true); + EventGraph mustSet = computeTransitiveClosure(getKnowledge(rel).getMustSet(), must, false); + return new Delta(maySet, mustSet); + } + return Delta.EMPTY; + } + + private EventGraph computeTransitiveClosure(EventGraph oldOuter, EventGraph inner, boolean isMay) { + EventGraph next; + EventGraph outer = new EventGraph(oldOuter); + outer.addAll(inner); + for (EventGraph current = inner; !current.isEmpty(); current = next) { + next = new EventGraph(); + for (Event e1 : current.getDomain()) { + Set update = new HashSet<>(); + for (Event e2 : current.getRange(e1)) { + if (isMay) { + update.addAll(outer.getRange(e2)); + } else { + boolean implies = exec.isImplied(e1, e2); + update.addAll(outer.getRange(e2).stream() + .filter(e -> implies || exec.isImplied(e, e2)) + .toList()); + } + } + Set known = outer.getRange(e1); + update.removeIf(e -> known.contains(e) || exec.areMutuallyExclusive(e1, e)); + if (!update.isEmpty()) { + next.addRange(e1, update); + } + } + outer.addAll(next); + } + return outer; + } + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/analysis/RelationAnalysis.java b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/analysis/RelationAnalysis.java index 3b3ffdb083..de5de01ce1 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/analysis/RelationAnalysis.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/analysis/RelationAnalysis.java @@ -1,34 +1,14 @@ package com.dat3m.dartagnan.wmm.analysis; -import com.dat3m.dartagnan.program.Program; -import com.dat3m.dartagnan.program.Register; -import com.dat3m.dartagnan.program.Register.UsageType; -import com.dat3m.dartagnan.program.Thread; -import com.dat3m.dartagnan.program.analysis.BranchEquivalence; +import com.dat3m.dartagnan.configuration.RelationAnalysisMethod; import com.dat3m.dartagnan.program.analysis.Dependency; import com.dat3m.dartagnan.program.analysis.ExecutionAnalysis; import com.dat3m.dartagnan.program.analysis.alias.AliasAnalysis; -import com.dat3m.dartagnan.program.event.Event; -import com.dat3m.dartagnan.program.event.MemoryEvent; -import com.dat3m.dartagnan.program.event.RegReader; -import com.dat3m.dartagnan.program.event.Tag; -import com.dat3m.dartagnan.program.event.core.*; -import com.dat3m.dartagnan.program.event.lang.svcomp.EndAtomic; -import com.dat3m.dartagnan.program.filter.Filter; -import com.dat3m.dartagnan.program.memory.VirtualMemoryObject; import com.dat3m.dartagnan.utils.Utils; -import com.dat3m.dartagnan.utils.dependable.DependencyGraph; import com.dat3m.dartagnan.verification.Context; import com.dat3m.dartagnan.verification.VerificationTask; -import com.dat3m.dartagnan.witness.graphml.WitnessGraph; -import com.dat3m.dartagnan.wmm.Constraint; -import com.dat3m.dartagnan.wmm.Definition; import com.dat3m.dartagnan.wmm.Relation; -import com.dat3m.dartagnan.wmm.Wmm; -import com.dat3m.dartagnan.wmm.axiom.Axiom; -import com.dat3m.dartagnan.wmm.definition.*; import com.dat3m.dartagnan.wmm.utils.EventGraph; -import com.dat3m.dartagnan.wmm.utils.Tuple; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.sosy_lab.common.configuration.Configuration; @@ -37,62 +17,15 @@ import org.sosy_lab.common.configuration.Options; import java.util.*; -import java.util.stream.Stream; -import static com.dat3m.dartagnan.configuration.Arch.RISCV; import static com.dat3m.dartagnan.configuration.OptionNames.*; -import static com.dat3m.dartagnan.program.Register.UsageType.*; -import static com.dat3m.dartagnan.program.event.Tag.*; import static com.dat3m.dartagnan.wmm.RelationNameRepository.CO; import static com.dat3m.dartagnan.wmm.RelationNameRepository.RF; -import static com.dat3m.dartagnan.wmm.utils.EventGraph.difference; -import static com.dat3m.dartagnan.wmm.utils.EventGraph.intersection; import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Verify.verify; -import static com.google.common.collect.Lists.reverse; -import static java.util.stream.Collectors.toList; -import static java.util.stream.Collectors.toSet; -import static java.util.stream.IntStream.iterate; -@Options -public class RelationAnalysis { +public interface RelationAnalysis { - private static final Logger logger = LogManager.getLogger(RelationAnalysis.class); - - private static final Delta EMPTY = new Delta(EventGraph.empty(), EventGraph.empty()); - - private final VerificationTask task; - private final Context analysisContext; - private final ExecutionAnalysis exec; - private final AliasAnalysis alias; - private final Dependency dep; - private final WmmAnalysis wmmAnalysis; - private final Map knowledgeMap = new HashMap<>(); - private final EventGraph mutex = new EventGraph(); - - @Option(name = ENABLE_RELATION_ANALYSIS, - description = "Derived relations of the memory model ", - secure = true) - private boolean enable = true; - - @Option(name = ENABLE_MUST_SETS, - description = "Tracks relationships of the memory model, which exist in all execution that execute the two participating events.", - secure = true) - private boolean enableMustSets = true; - - @Option(name = ENABLE_EXTENDED_RELATION_ANALYSIS, - description = "Marks relationships as trivially false, if they alone would violate a consistency property of the target memory model.", - secure = true) - private boolean enableExtended = true; - - private RelationAnalysis(VerificationTask t, Context context, Configuration config) { - task = checkNotNull(t); - analysisContext = context; - exec = context.requires(ExecutionAnalysis.class); - alias = context.requires(AliasAnalysis.class); - dep = context.requires(Dependency.class); - wmmAnalysis = context.requires(WmmAnalysis.class); - } + Logger logger = LogManager.getLogger(RelationAnalysis.class); /** * Performs a static analysis on the relationships that may occur in an execution. @@ -108,23 +41,23 @@ private RelationAnalysis(VerificationTask t, Context context, Configuration conf * * @param config User-defined options to further specify the behavior. */ - public static RelationAnalysis fromConfig(VerificationTask task, Context context, Configuration config) throws InvalidConfigurationException { - RelationAnalysis a = new RelationAnalysis(task, context, config); - task.getConfig().inject(a); + static RelationAnalysis fromConfig(VerificationTask task, Context context, Configuration config) throws InvalidConfigurationException { + RelationAnalysis.Config c = new RelationAnalysis.Config(config); + logger.info("Selected relation analysis: {}", c.method); + + RelationAnalysis a = switch (c.method) { + case NONE -> CoarseRelationAnalysis.fromConfig(task, context, config); + case NATIVE -> NativeRelationAnalysis.fromConfig(task, context, config); + }; final StringBuilder configSummary = new StringBuilder().append("\n"); - configSummary.append("\t").append(ENABLE_RELATION_ANALYSIS).append(": ").append(a.enable).append("\n"); - configSummary.append("\t").append(ENABLE_MUST_SETS).append(": ").append(a.enableMustSets).append("\n"); - configSummary.append("\t").append(ENABLE_EXTENDED_RELATION_ANALYSIS).append(": ").append(a.enableExtended); + configSummary.append("\t").append(RELATION_ANALYSIS).append(": ").append(c.method).append("\n"); + configSummary.append("\t").append(ENABLE_EXTENDED_RELATION_ANALYSIS).append(": ").append(c.enableExtended); logger.info(configSummary); - if (a.enableMustSets && !a.enable) { - logger.warn("{} implies {}", ENABLE_MUST_SETS, ENABLE_RELATION_ANALYSIS); - a.enableMustSets = false; - } - if (a.enableExtended && !a.enable) { - logger.warn("{} implies {}", ENABLE_EXTENDED_RELATION_ANALYSIS, ENABLE_RELATION_ANALYSIS); - a.enableExtended = false; + if (c.enableExtended && c.method == RelationAnalysisMethod.NONE) { + logger.warn("{} implies {}", ENABLE_EXTENDED_RELATION_ANALYSIS, RELATION_ANALYSIS); + c.enableExtended = false; } long t0 = System.currentTimeMillis(); @@ -136,7 +69,7 @@ public static RelationAnalysis fromConfig(VerificationTask task, Context context .append("\n======== RelationAnalysis summary ======== \n"); summary.append("\t#Relations: ").append(task.getMemoryModel().getRelations().size()).append("\n"); summary.append("\t#Axioms: ").append(task.getMemoryModel().getAxioms().size()).append("\n"); - if (a.enableExtended) { + if (c.enableExtended) { long mayCount = a.countMaySet(); long mustCount = a.countMustSet(); a.runExtended(); @@ -144,11 +77,10 @@ public static RelationAnalysis fromConfig(VerificationTask task, Context context summary.append("\t#may-edges removed (extended): ").append(mayCount - a.countMaySet()).append("\n"); summary.append("\t#must-edges added (extended): ").append(a.countMustSet() - mustCount).append("\n"); } - verify(a.enableMustSets || a.knowledgeMap.values().stream().allMatch(k -> k.must.isEmpty())); - Knowledge rf = a.knowledgeMap.get(task.getMemoryModel().getRelation(RF)); - Knowledge co = a.knowledgeMap.get(task.getMemoryModel().getRelation(CO)); + Knowledge rf = a.getKnowledge(task.getMemoryModel().getRelation(RF)); + Knowledge co = a.getKnowledge(task.getMemoryModel().getRelation(CO)); summary.append("\ttotal #must|may|exclusive edges: ") - .append(a.countMustSet()).append("|").append(a.countMaySet()).append("|").append(a.mutex.size()).append("\n"); + .append(a.countMustSet()).append("|").append(a.countMaySet()).append("|").append(a.getContradictions().size()).append("\n"); summary.append("\t#must|may rf edges: ").append(rf.must.size()).append("|").append(rf.may.size()).append("\n"); summary.append("\t#must|may co edges: ").append(co.must.size()).append("|").append(co.may.size()).append("\n"); summary.append("==========================================="); @@ -156,23 +88,35 @@ public static RelationAnalysis fromConfig(VerificationTask task, Context context return a; } + @Options + final class Config { + @Option(name = RELATION_ANALYSIS, + description = "Relation analysis engine.", + secure = true) + private RelationAnalysisMethod method = RelationAnalysisMethod.getDefault(); + + @Option(name = ENABLE_EXTENDED_RELATION_ANALYSIS, + description = "Marks relationships as trivially false, if they alone would violate a consistency property of the target memory model.", + secure = true) + private boolean enableExtended = true; + + private Config(Configuration config) throws InvalidConfigurationException { + config.inject(this); + } + } + /** * Fetches results of this analysis. * * @param relation Some element in the associated task's memory model. * @return Pairs of events of the program that may be related in some execution or even must be related in all executions. */ - public Knowledge getKnowledge(Relation relation) { - return knowledgeMap.get(relation); - } + Knowledge getKnowledge(Relation relation); /** * Iterates those event pairs that, if both executed, violate some axiom of the memory model. */ - public EventGraph getMutuallyExclusiveEdges() { - //TODO return undirected pairs - return mutex; - } + EventGraph getContradictions(); /* Returns a set of edges (e1, e2) (subset of may set) for ordered relations whose @@ -193,124 +137,39 @@ The former is disallowed by assumption, so we have co(w3, w2) and hence c(w3) < not involve encoding a clock constraint (due to this optimization). There is also a symmetric case where co(w3, w1) is impossible and co(w3, w2) is a must-edge. */ - public EventGraph findTransitivelyImpliedCo(Relation co) { - final RelationAnalysis.Knowledge k = getKnowledge(co); - EventGraph transCo = new EventGraph(); - Map> mustIn = k.getMustSet().getInMap(); - Map> mustOut = k.getMustSet().getOutMap(); - k.may.apply((e1, e2) -> { - final MemoryEvent x = (MemoryEvent) e1; - final MemoryEvent z = (MemoryEvent) e2; - boolean hasIntermediary = mustOut.getOrDefault(x, Set.of()).stream().anyMatch(y -> y != x && y != z && - (exec.isImplied(x, y) || exec.isImplied(z, y)) && - !k.getMaySet().contains(z, y)) - || mustIn.getOrDefault(z, Set.of()).stream().anyMatch(y -> y != x && y != z && - (exec.isImplied(x, y) || exec.isImplied(z, y)) && - !k.getMaySet().contains(y, x)); - if (hasIntermediary) { - transCo.add(e1, e2); - } - }); - return transCo; - } + EventGraph findTransitivelyImpliedCo(Relation co); - private void run() { - logger.trace("Start"); - final Wmm memoryModel = task.getMemoryModel(); - final Map> dependents = new HashMap<>(); - for (Relation r : memoryModel.getRelations()) { - for (Relation d : r.getDependencies()) { - dependents.computeIfAbsent(d, k -> new ArrayList<>()).add(r.getDefinition()); - } - } - // ------------------------------------------------ - final Initializer initializer = new Initializer(); - final Map> qGlobal = new HashMap<>(); - for (Relation r : memoryModel.getRelations()) { - Knowledge k = r.getDefinition().accept(initializer); - if (!enableMustSets) { - k = new Knowledge(k.getMaySet(), EventGraph.empty()); - } - knowledgeMap.put(r, k); - if (!k.may.isEmpty() || !k.must.isEmpty()) { - qGlobal.computeIfAbsent(r, x -> new ArrayList<>(1)) - .add(new Delta(k.may, k.must)); - } - } - // ------------------------------------------------ - final Propagator propagator = new Propagator(); - for (Set.Node> scc : DependencyGraph.from(memoryModel.getRelations()).getSCCs()) { - logger.trace("Regular analysis for component {}", scc); - Set stratum = scc.stream().map(DependencyGraph.Node::getContent).collect(toSet()); - if (!enable && stratum.stream().noneMatch(Relation::isInternal)) { - continue; - } - // the algorithm has deterministic order, only if all components are deterministically-ordered - Map> qLocal = new LinkedHashMap<>(); - // move from global queue - for (Relation r : stratum) { - List d = qGlobal.remove(r); - if (d != null) { - qLocal.put(r, d); - } - } - // repeat until convergence - while (!qLocal.isEmpty()) { - Relation relation = qLocal.keySet().iterator().next(); - logger.trace("Regular knowledge update for '{}'", relation); + /** + * Runs the relation analysis. + */ + void run(); - // A fix for https://github.com/hernanponcedeleon/Dat3M/issues/523 - // In our current propagation approach, whenever a relation r gets updated, - // we compute for each dependent relation "r' = r op x" an update U(r, x, r') that needs to get applied. - // When r' gets processed, the update U(r, x, r') is applied as is to r'. - // However, depending on whether x is before or after r in the stratification, the computed update - // may be different. In particular, we compute updates to r' before all its dependencies were computed - // and thus our computation does not strictly follow the stratification. - // This does not matter if the update function U(r, x, r') is monotonic in r/x but if it is not, - // an early computed update may be too large! - // We fix this problem by reducing the potentially too large update U(r, x, r') before applying it to r'. - // TODO: The necessity of the fix suggests that our propagation algorithm is flawed. - // We should reconsider our algorithm. - Delta toAdd = Delta.combine(qLocal.remove(relation)); - if (relation.getDefinition() instanceof Difference difference) { - // Our propagated update may be "too large" so we reduce it. - Knowledge k = knowledgeMap.get(difference.getSubtrahend()); - toAdd.may.removeAll(k.must); - toAdd.must.removeAll(k.may); - } + /** + * Runs the extended relation analysis. + */ + void runExtended(); - Delta delta = knowledgeMap.get(relation).joinSet(List.of(toAdd)); - if (delta.may.isEmpty() && delta.must.isEmpty()) { - continue; - } + /** + * Returns the may set size. + */ + long countMaySet(); - propagator.source = relation; - propagator.may = delta.may; - propagator.must = delta.must; - for (Definition c : dependents.getOrDefault(relation, List.of())) { - logger.trace("Regular propagation from '{}' to '{}'", relation, c); - Relation r = c.getDefinedRelation(); - Delta d = c.accept(propagator); - verify(enableMustSets || d.must.isEmpty(), - "although disabled, computed a non-empty must set for relation %s", r); - (stratum.contains(r) ? qLocal : qGlobal) - .computeIfAbsent(r, k -> new ArrayList<>()) - .add(d); - } - } - } - verify(!enable || qGlobal.isEmpty(), "knowledge buildup propagated downwards"); - logger.trace("End"); - } + /** + * Returns the must set size. + */ + long countMustSet(); + + void populateQueue(Map> queue, Set relations); - public static final class Knowledge { + final class Knowledge { private final EventGraph may; private final EventGraph must; - private Knowledge(EventGraph maySet, EventGraph mustSet) { + public Knowledge(EventGraph maySet, EventGraph mustSet) { may = checkNotNull(maySet); must = checkNotNull(mustSet); } + public EventGraph getMaySet() { return may; } @@ -323,1287 +182,5 @@ public EventGraph getMustSet() { public String toString() { return "(may:" + may.size() + ", must:" + must.size() + ")"; } - - private Delta joinSet(List l) { - verify(!l.isEmpty(), "empty update"); - // NOTE optimization due to initial deltas carrying references to knowledge sets - EventGraph maySet = may.isEmpty() || l.get(0).may == may ? may : new EventGraph(); - EventGraph mustSet = must.isEmpty() || l.get(0).must == must ? must : new EventGraph(); - for (Delta d : l) { - d.may.apply((e1, e2) -> { - if (may.add(e1, e2)) { - maySet.add(e1, e2); - } - }); - d.must.apply((e1, e2) -> { - if (must.add(e1, e2)) { - mustSet.add(e1, e2); - } - }); - } - return new Delta(maySet, mustSet); - } - - private ExtendedDelta join(List l) { - verify(!l.isEmpty(), "empty update in extended analysis"); - EventGraph disableSet = new EventGraph(); - EventGraph enableSet = new EventGraph(); - for (ExtendedDelta d : l) { - new EventGraph(d.disabled).apply((e1, e2) -> { - if (may.remove(e1, e2)) { - disableSet.add(e1, e2); - } - }); - new EventGraph(d.enabled).apply((e1, e2) -> { - if (must.add(e1, e2)) { - enableSet.add(e1, e2); - } - }); - } - return new ExtendedDelta(disableSet, enableSet); - } - } - - private void runExtended() { - logger.trace("Start"); - Wmm memoryModel = task.getMemoryModel(); - Map> dependents = new HashMap<>(); - Map> q = new LinkedHashMap<>(); - for (Constraint c : memoryModel.getConstraints()) { - if (c instanceof Axiom axiom && axiom.isFlagged()) { - continue; - } - for (Relation r : c.getConstrainedRelations()) { - dependents.computeIfAbsent(r, k -> new ArrayList<>()).add(c); - } - for (Map.Entry e : - c.computeInitialKnowledgeClosure(knowledgeMap, analysisContext).entrySet()) { - q.computeIfAbsent(e.getKey(), k -> new ArrayList<>()).add(e.getValue()); - } - } - ExtendedPropagator propagator = new ExtendedPropagator(); - // repeat until convergence - while (!q.isEmpty()) { - Relation relation = q.keySet().iterator().next(); - logger.trace("Extended knowledge update for '{}'", relation); - Knowledge knowledge = knowledgeMap.get(relation); - ExtendedDelta delta = knowledge.join(q.remove(relation)); - if (delta.disabled.isEmpty() && delta.enabled.isEmpty()) { - continue; - } - mutex.addAll(difference(delta.enabled, knowledge.may)); - mutex.addAll(intersection(delta.disabled, knowledge.must)); - propagator.origin = relation; - EventGraph disabled = propagator.disabled = delta.disabled; - EventGraph enabled = propagator.enabled = delta.enabled; - for (Constraint c : dependents.getOrDefault(relation, List.of())) { - logger.trace("Extended propagation from '{}' to '{}'", relation, c); - for (Map.Entry e : - c.computeIncrementalKnowledgeClosure( - relation, disabled, enabled, knowledgeMap, analysisContext).entrySet()) { - q.computeIfAbsent(e.getKey(), k -> new ArrayList<>()).add(e.getValue()); - } - if (!(c instanceof Definition)) { - continue; - } - for (Map.Entry e : c.accept(propagator).entrySet()) { - q.computeIfAbsent(e.getKey(), k -> new ArrayList<>()).add(e.getValue()); - } - } - } - logger.trace("End"); - } - - public static final class Delta { - public final EventGraph may; - public final EventGraph must; - - Delta(EventGraph maySet, EventGraph mustSet) { - may = maySet; - must = mustSet; - } - - private static Delta combine(List deltas) { - if (deltas.size() == 1) { - return deltas.get(0); - } - EventGraph mayDelta = new EventGraph(); - EventGraph mustDelta = new EventGraph(); - for (Delta d : deltas) { - mayDelta.addAll(d.may); - mustDelta.addAll(d.must); - } - return new Delta(mayDelta, mustDelta); - } - } - - //FIXME should be visible only to implementations of Constraint - public static final class ExtendedDelta { - final EventGraph disabled; - final EventGraph enabled; - - public ExtendedDelta(EventGraph d, EventGraph e) { - disabled = d; - enabled = e; - } - } - - private final class Initializer implements Definition.Visitor { - final Program program = task.getProgram(); - final WitnessGraph witness = task.getWitness(); - final Knowledge defaultKnowledge; - - Initializer() { - if (enable) { - defaultKnowledge = null; - } else { - EventGraph may = new EventGraph(); - Set events = program.getThreadEvents().stream().filter(e -> e.hasTag(VISIBLE)).collect(toSet()); - for (Event x : events) { - may.addRange(x, events); - } - defaultKnowledge = new Knowledge(may, EventGraph.empty()); - } - } - - @Override - public Knowledge visitDefinition(Definition def) { - return defaultKnowledge != null && !def.getDefinedRelation().isInternal() ? defaultKnowledge - : new Knowledge(new EventGraph(), new EventGraph()); - } - - @Override - public Knowledge visitFree(Free def) { - final List visibleEvents = program.getThreadEventsWithAllTags(VISIBLE); - EventGraph must = EventGraph.empty(); - EventGraph may = new EventGraph(); - - for (Event e1 : visibleEvents) { - for (Event e2 : visibleEvents) { - may.add(e1, e2); - } - } - - return new Knowledge(may, must); - } - - @Override - public Knowledge visitProduct(CartesianProduct prod) { - final Filter domain = prod.getFirstFilter(); - final Filter range = prod.getSecondFilter(); - EventGraph must = new EventGraph(); - List l1 = program.getThreadEvents().stream().filter(domain::apply).toList(); - List l2 = program.getThreadEvents().stream().filter(range::apply).toList(); - for (Event e1 : l1) { - Set rangeEvents = l2.stream() - .filter(e2 -> !exec.areMutuallyExclusive(e1, e2)) - .collect(toSet()); - must.addRange(e1, rangeEvents); - } - return new Knowledge(must, new EventGraph(must)); - } - - @Override - public Knowledge visitSetIdentity(SetIdentity id) { - final Filter set = id.getFilter(); - EventGraph must = new EventGraph(); - program.getThreadEvents().stream().filter(set::apply).forEach(e -> must.add(e, e)); - return new Knowledge(must, new EventGraph(must)); - } - - @Override - public Knowledge visitExternal(External ext) { - EventGraph must = new EventGraph(); - List threads = program.getThreads(); - for (int i = 0; i < threads.size(); i++) { - Thread t1 = threads.get(i); - List visible1 = visibleEvents(t1); - for (int j = i + 1; j < threads.size(); j++) { - Thread t2 = threads.get(j); - for (Event e2 : visibleEvents(t2)) { - for (Event e1 : visible1) { - // No test for exec.areMutuallyExclusive, since that currently does not span across threads - must.add(e1, e2); - must.add(e2, e1); - } - } - } - } - return new Knowledge(must, new EventGraph(must)); - } - - @Override - public Knowledge visitInternal(Internal internal) { - EventGraph must = new EventGraph(); - for (Thread t : program.getThreads()) { - List events = visibleEvents(t); - for (Event e1 : events) { - Set rangeEvents = events.stream() - .filter(e2 -> !exec.areMutuallyExclusive(e1, e2)) - .collect(toSet()); - must.addRange(e1, rangeEvents); - } - } - return new Knowledge(must, new EventGraph(must)); - } - - @Override - public Knowledge visitProgramOrder(ProgramOrder po) { - final Filter type = po.getFilter(); - EventGraph must = new EventGraph(); - for (Thread t : program.getThreads()) { - List events = t.getEvents().stream().filter(type::apply).toList(); - for (int i = 0; i < events.size(); i++) { - Event e1 = events.get(i); - for (int j = i + 1; j < events.size(); j++) { - Event e2 = events.get(j); - if (!exec.areMutuallyExclusive(e1, e2)) { - must.add(e1, e2); - } - } - } - } - return new Knowledge(must, new EventGraph(must)); - } - - @Override - public Knowledge visitControlDependency(DirectControlDependency ctrlDep) { - //TODO: We can restrict the codomain to visible events as the only usage of this Relation is in - // ctrl := idd^+;ctrlDirect & (R*V) - EventGraph must = new EventGraph(); - for (Thread thread : program.getThreads()) { - for (CondJump jump : thread.getEvents(CondJump.class)) { - if (jump.isGoto() || jump.isDead()) { - continue; // There is no point in ctrl-edges from unconditional jumps. - } - - final List ctrlDependentEvents; - if (jump instanceof IfAsJump ifJump) { - // Ctrl dependencies of Ifs (under Linux) only extend up until the merge point of both - // branches. - ctrlDependentEvents = ifJump.getBranchesEvents(); - } else { - // Regular jumps give dependencies to all successors. - ctrlDependentEvents = jump.getSuccessor().getSuccessors(); - } - - for (Event e : ctrlDependentEvents) { - if (!exec.areMutuallyExclusive(jump, e)) { - must.add(jump, e); - } - } - } - } - return new Knowledge(must, new EventGraph(must)); - } - - @Override - public Knowledge visitAddressDependency(DirectAddressDependency addrDep) { - return computeInternalDependencies(EnumSet.of(ADDR)); - } - - @Override - public Knowledge visitInternalDataDependency(DirectDataDependency idd) { - // FIXME: Our "internal data dependency" relation is quite odd an contains all but address dependencies. - return computeInternalDependencies(EnumSet.of(DATA, CTRL, OTHER)); - } - - @Override - public Knowledge visitFences(Fences fenceDef) { - final Filter fence = fenceDef.getFilter(); - EventGraph may = new EventGraph(); - EventGraph must = new EventGraph(); - for (Thread t : program.getThreads()) { - List events = visibleEvents(t); - int end = events.size(); - for (int i = 0; i < end; i++) { - Event f = events.get(i); - if (!fence.apply(f)) { - continue; - } - for (Event x : events.subList(0, i)) { - if (exec.areMutuallyExclusive(x, f)) { - continue; - } - boolean implies = exec.isImplied(x, f); - for (Event y : events.subList(i + 1, end)) { - if (exec.areMutuallyExclusive(x, y) || exec.areMutuallyExclusive(f, y)) { - continue; - } - may.add(x, y); - if (implies || exec.isImplied(y, f)) { - must.add(x, y); - } - } - } - } - } - return new Knowledge(may, must); - } - - @Override - public Knowledge visitCASDependency(CASDependency casDep) { - EventGraph must = new EventGraph(); - for (Event e : program.getThreadEvents()) { - if (e.hasTag(IMM.CASDEPORIGIN)) { - // The target of a CASDep is always the successor of the origin - must.add(e, e.getSuccessor()); - } - } - return new Knowledge(must, new EventGraph(must)); - } - - @Override - public Knowledge visitLinuxCriticalSections(LinuxCriticalSections rscs) { - EventGraph may = new EventGraph(); - EventGraph must = new EventGraph(); - //assume locks and unlocks are distinct - Map> mayMap = new HashMap<>(); - Map> mustMap = new HashMap<>(); - for (Thread thread : program.getThreads()) { - List locks = reverse(thread.getEvents().stream().filter(e -> e.hasTag(Linux.RCU_LOCK)).collect(toList())); - for (Event unlock : thread.getEvents()) { - if (!unlock.hasTag(Linux.RCU_UNLOCK)) { - continue; - } - // iteration order assures that all intermediaries were already iterated - for (Event lock : locks) { - if (unlock.getGlobalId() < lock.getGlobalId() || - exec.areMutuallyExclusive(lock, unlock) || - Stream.concat(mustMap.getOrDefault(lock, Set.of()).stream(), - mustMap.getOrDefault(unlock, Set.of()).stream()) - .anyMatch(e -> exec.isImplied(lock, e) || exec.isImplied(unlock, e))) { - continue; - } - boolean noIntermediary = - mayMap.getOrDefault(unlock, Set.of()).stream() - .allMatch(e -> exec.areMutuallyExclusive(lock, e)) && - mayMap.getOrDefault(lock, Set.of()).stream() - .allMatch(e -> exec.areMutuallyExclusive(e, unlock)); - may.add(lock, unlock); - mayMap.computeIfAbsent(lock, x -> new HashSet<>()).add(unlock); - mayMap.computeIfAbsent(unlock, x -> new HashSet<>()).add(lock); - if (noIntermediary) { - must.add(lock, unlock); - mustMap.computeIfAbsent(lock, x -> new HashSet<>()).add(unlock); - mustMap.computeIfAbsent(unlock, x -> new HashSet<>()).add(lock); - } - } - } - } - return new Knowledge(may, must); - } - - @Override - public Knowledge visitReadModifyWrites(ReadModifyWrites rmw) { - //NOTE: Changes to the semantics of this method may need to be reflected in RMWGraph for Refinement! - // ----- Compute must set ----- - EventGraph must = new EventGraph(); - // RMWLoad -> RMWStore - for (RMWStore store : program.getThreadEvents(RMWStore.class)) { - must.add(store.getLoadEvent(), store); - } - - // Atomics blocks: BeginAtomic -> EndAtomic - for (EndAtomic end : program.getThreadEvents(EndAtomic.class)) { - List block = end.getBlock().stream().filter(x -> x.hasTag(VISIBLE)).toList(); - for (int i = 0; i < block.size(); i++) { - Event e = block.get(i); - for (int j = i + 1; j < block.size(); j++) { - if (!exec.areMutuallyExclusive(e, block.get(j))) { - must.add(e, block.get(j)); - } - } - } - } - // ----- Compute may set ----- - EventGraph may = new EventGraph(must); - // LoadExcl -> StoreExcl - for (Thread thread : program.getThreads()) { - List events = thread.getEvents().stream().filter(e -> e.hasTag(EXCL)).toList(); - // assume order by globalId - // assume globalId describes a topological sorting over the control flow - for (int end = 1; end < events.size(); end++) { - if (!(events.get(end) instanceof RMWStoreExclusive store)) { - continue; - } - int start = iterate(end - 1, i -> i >= 0, i -> i - 1) - .filter(i -> exec.isImplied(store, events.get(i))) - .findFirst().orElse(0); - List candidates = events.subList(start, end).stream() - .filter(e -> !exec.areMutuallyExclusive(e, store)) - .toList(); - int size = candidates.size(); - for (int i = 0; i < size; i++) { - Event load = candidates.get(i); - List intermediaries = candidates.subList(i + 1, size); - if (!(load instanceof Load) || intermediaries.stream().anyMatch(e -> exec.isImplied(load, e))) { - continue; - } - may.add(load, store); - if (intermediaries.stream().allMatch(e -> exec.areMutuallyExclusive(load, e)) && - (store.doesRequireMatchingAddresses() || alias.mustAlias((Load) load, store))) { - must.add(load, store); - } - } - } - } - return new Knowledge(may, must); - } - - @Override - public Knowledge visitCoherence(Coherence co) { - logger.trace("Computing knowledge about memory order"); - List nonInitWrites = program.getThreadEvents(Store.class); - nonInitWrites.removeIf(Init.class::isInstance); - EventGraph may = new EventGraph(); - for (Store w1 : program.getThreadEvents(Store.class)) { - for (Store w2 : nonInitWrites) { - if (w1.getGlobalId() != w2.getGlobalId() && !exec.areMutuallyExclusive(w1, w2) - && alias.mayAlias(w1, w2)) { - may.add(w1, w2); - } - } - } - EventGraph must = new EventGraph(); - may.apply((e1, e2) -> { - MemoryCoreEvent w1 = (MemoryCoreEvent) e1; - MemoryCoreEvent w2 = (MemoryCoreEvent) e2; - if (!w2.hasTag(INIT) && alias.mustAlias(w1, w2) && w1.hasTag(INIT)) { - must.add(w1, w2); - } - }); - if (wmmAnalysis.isLocallyConsistent()) { - may.removeIf(Tuple::isBackward); - may.apply((e1, e2) -> { - MemoryCoreEvent w1 = (MemoryCoreEvent) e1; - MemoryCoreEvent w2 = (MemoryCoreEvent) e2; - if (alias.mustAlias(w1, w2) && Tuple.isForward(e1, e2)) { - must.add(w1, w2); - } - }); - } - - // Must-co from violation witness - if(!witness.isEmpty()) { - must.addAll(witness.getCoherenceKnowledge(program, alias)); - } - - logger.debug("Initial may set size for memory order: {}", may.size()); - return new Knowledge(may, must); - } - - @Override - public Knowledge visitReadFrom(ReadFrom rf) { - logger.trace("Computing knowledge about read-from"); - final BranchEquivalence eq = analysisContext.requires(BranchEquivalence.class); - EventGraph may = new EventGraph(); - EventGraph must = new EventGraph(); - List loadEvents = program.getThreadEvents(Load.class); - for (Store e1 : program.getThreadEvents(Store.class)) { - for (Load e2 : loadEvents) { - if (alias.mayAlias(e1, e2) && !exec.areMutuallyExclusive(e1, e2)) { - may.add(e1, e2); - } - } - } - - // Here we add must-rf edges between loads/stores that synchronize threads. - for (Thread thread : program.getThreads()) { - List spawned = thread.getSpawningEvents(); - if(spawned.size() == 2) { - MemoryCoreEvent startLoad = spawned.get(0); - MemoryCoreEvent startStore = spawned.get(1); - must.add(startStore, startLoad); - if (eq.isImplied(startLoad, startStore)) { - may.removeIf((e1, e2) -> e2 == startLoad && e1 != startStore); - } - } - } - - if (wmmAnalysis.isLocallyConsistent()) { - // Remove future reads - may.removeIf(Tuple::isBackward); - // Remove past reads - EventGraph deletedEdges = new EventGraph(); - Map> writesByRead = new HashMap<>(); - may.apply((e1, e2) -> writesByRead.computeIfAbsent(e2, x -> new ArrayList<>()).add(e1)); - for (Load read : program.getThreadEvents(Load.class)) { - // The set of same-thread writes as well as init writes that could be read from (all before the read) - // sorted by order (init events first) - List possibleWrites = writesByRead.getOrDefault(read, List.of()).stream() - .filter(e -> (e.getThread() == read.getThread() || e.hasTag(INIT))) - .map(x -> (MemoryCoreEvent) x) - .sorted((o1, o2) -> o1.hasTag(INIT) == o2.hasTag(INIT) ? (o1.getGlobalId() - o2.getGlobalId()) : o1.hasTag(INIT) ? -1 : 1) - .toList(); - // The set of writes that won't be readable due getting overwritten. - Set deletedWrites = new HashSet<>(); - // A rf-edge (w1, r) is impossible, if there exists a write w2 such that - // - w2 is exec-implied by w1 or r (i.e. cf-implied + w2.cfImpliesExec) - // - w2 must alias with either w1 or r. - for (int i = 0; i < possibleWrites.size(); i++) { - MemoryCoreEvent w1 = possibleWrites.get(i); - for (MemoryCoreEvent w2 : possibleWrites.subList(i + 1, possibleWrites.size())) { - // w2 dominates w1 if it aliases with it and it is guaranteed to execute if either w1 or the read are - // executed - if ((exec.isImplied(w1, w2) || exec.isImplied(read, w2)) - && (alias.mustAlias(w1, w2) || alias.mustAlias(w2, read))) { - deletedWrites.add(w1); - break; - } - } - } - for (Event w : deletedWrites) { - deletedEdges.add(w, read); - } - } - may.removeAll(deletedEdges); - } - if (wmmAnalysis.doesRespectAtomicBlocks()) { - //TODO: This function can not only reduce rf-edges - // but we could also figure out implied coherences: - // Assume w1 and w2 are aliasing in the same block and w1 is before w2, - // then if w1 is co-before some external w3, then so is w2, i.e. - // co(w1, w3) => co(w2, w3), but we also have co(w2, w3) => co(w1, w3) - // so co(w1, w3) <=> co(w2, w3). - // This information is not expressible in terms of min/must sets, but - // we could still encode it. - int sizeBefore = may.size(); - // Atomics blocks: BeginAtomic -> EndAtomic - for (EndAtomic endAtomic : program.getThreadEvents(EndAtomic.class)) { - // Collect memEvents of the atomic block - List writes = new ArrayList<>(); - List reads = new ArrayList<>(); - for (Event b : endAtomic.getBlock()) { - if (b instanceof Load load) { - reads.add(load); - } else if (b instanceof Store store) { - writes.add(store); - } - } - for (Load r : reads) { - // If there is any write w inside the atomic block that is guaranteed to - // execute before the read and that aliases with it, - // then the read won't be able to read any external writes - boolean hasImpliedWrites = writes.stream() - .anyMatch(w -> w.getGlobalId() < r.getGlobalId() - && exec.isImplied(r, w) && alias.mustAlias(r, w)); - if (hasImpliedWrites) { - may.removeIf((e1, e2) -> e2 == r && Tuple.isCrossThread(e1, e2)); - } - } - } - logger.debug("Atomic block optimization eliminated {} reads", sizeBefore - may.size()); - } - - // Must-rf from violation witness - if(!witness.isEmpty()) { - EventGraph g = witness.getReadFromKnowledge(program, alias); - must.addAll(g); - for(Event r : g.getRange()) { - may.removeIf((e1, e2) -> e2 == r); - } - } - - logger.debug("Initial may set size for read-from: {}", may.size()); - return new Knowledge(may, must); - } - - @Override - public Knowledge visitSameLocation(SameLocation loc) { - EventGraph may = new EventGraph(); - List events = program.getThreadEvents(MemoryCoreEvent.class); - for (MemoryCoreEvent e1 : events) { - for (MemoryCoreEvent e2 : events) { - if (alias.mayAlias(e1, e2) && !exec.areMutuallyExclusive(e1, e2)) { - may.add(e1, e2); - } - } - } - EventGraph must = new EventGraph(); - may.apply((e1, e2) -> { - if (alias.mustAlias((MemoryCoreEvent) e1, (MemoryCoreEvent) e2)) { - must.add(e1, e2); - } - }); - return new Knowledge(may, must); - } - - private Knowledge computeInternalDependencies(Set usageTypes) { - EventGraph may = new EventGraph(); - EventGraph must = new EventGraph(); - - for (RegReader regReader : program.getThreadEvents(RegReader.class)) { - for (Register.Read regRead : regReader.getRegisterReads()) { - if (!usageTypes.contains(regRead.usageType())) { - continue; - } - final Register register = regRead.register(); - // Register x0 is hardwired to the constant 0 in RISCV - // https://en.wikichip.org/wiki/risc-v/registers, - // and thus it generates no dependency, see - // https://github.com/herd/herdtools7/issues/408 - // TODO: Can't we just replace all reads of "x0" by 0 in RISC-specific preprocessing? - if (program.getArch().equals(RISCV) && register.getName().equals("x0")) { - continue; - } - Dependency.State r = dep.of(regReader, register); - for (Event regWriter : r.may) { - may.add(regWriter, regReader); - } - for (Event regWriter : r.must) { - must.add(regWriter, regReader); - } - } - } - - // We need to track ExecutionStatus events separately, because they induce data-dependencies - // without reading from a register. - if (usageTypes.contains(DATA)) { - for (ExecutionStatus execStatus : program.getThreadEvents(ExecutionStatus.class)) { - if (execStatus.doesTrackDep()) { - may.add(execStatus.getStatusEvent(), execStatus); - must.add(execStatus.getStatusEvent(), execStatus); - } - } - } - - return new Knowledge(may, must); - } - - @Override - public Knowledge visitSameScope(SameScope sc) { - final String specificScope = sc.getSpecificScope(); - EventGraph must = new EventGraph(); - List events = program.getThreadEvents().stream() - .filter(e -> e.hasTag(VISIBLE) && e.getThread().hasScope()) - .toList(); - for (Event e1 : events) { - for (Event e2 : events) { - if (exec.areMutuallyExclusive(e1, e2)) { - continue; - } - Thread thread1 = e1.getThread(); - Thread thread2 = e2.getThread(); - if (specificScope != null) { // scope specified - if (thread1.getScopeHierarchy().canSyncAtScope(thread2.getScopeHierarchy(), specificScope)) { - must.add(e1, e2); - } - } else { - String scope1 = Tag.getScopeTag(e1, program.getArch()); - String scope2 = Tag.getScopeTag(e2, program.getArch()); - if (!scope1.isEmpty() && !scope2.isEmpty() && thread1.getScopeHierarchy().canSyncAtScope(thread2.getScopeHierarchy(), scope1) - && thread2.getScopeHierarchy().canSyncAtScope(thread1.getScopeHierarchy(), scope2)) { - must.add(e1, e2); - } - } - } - } - return new Knowledge(must, new EventGraph(must)); - } - - @Override - public Knowledge visitSyncBarrier(SyncBar syncBar) { - EventGraph may = new EventGraph(); - EventGraph must = new EventGraph(); - List fenceEvents = program.getThreadEvents(FenceWithId.class); - for (FenceWithId e1 : fenceEvents) { - for (FenceWithId e2 : fenceEvents) { - // “A bar.sync or bar.red or bar.arrive operation synchronizes with a bar.sync - // or bar.red operation executed on the same barrier.” - if(exec.areMutuallyExclusive(e1, e2) || e2.hasTag(PTX.ARRIVE)) { - continue; - } - may.add(e1, e2); - if (e1.getFenceID().equals(e2.getFenceID())) { - must.add(e1, e2); - } - } - } - return new Knowledge(may, must); - } - - @Override - public Knowledge visitSyncFence(SyncFence syncFence) { - EventGraph may = new EventGraph(); - EventGraph must = EventGraph.empty(); - List fenceEventsSC = program.getThreadEventsWithAllTags(VISIBLE, FENCE, PTX.SC); - for (Event e1 : fenceEventsSC) { - for (Event e2 : fenceEventsSC) { - if (!exec.areMutuallyExclusive(e1, e2)) { - may.add(e1, e2); - } - } - } - return new Knowledge(may, must); - } - - @Override - public Knowledge visitSameVirtualLocation(SameVirtualLocation vloc) { - EventGraph must = new EventGraph(); - EventGraph may = new EventGraph(); - List events = program.getThreadEvents(MemoryCoreEvent.class); - for (MemoryCoreEvent e1 : events) { - for (MemoryCoreEvent e2 : events) { - if (sameGenericAddress(e1, e2) && !exec.areMutuallyExclusive(e1, e2)) { - if (alias.mustAlias(e1, e2)) { - must.add(e1, e2); - } - if (alias.mayAlias(e1, e2)) { - may.add(e1, e2); - } - } - } - } - return new Knowledge(may, must); - } - - @Override - public Knowledge visitSyncWith(SyncWith syncWith) { - EventGraph must = new EventGraph(); - List events = new ArrayList<>(program.getThreadEventsWithAllTags(VISIBLE)); - events.removeIf(Init.class::isInstance); - for (Event e1 : events) { - for (Event e2 : events) { - Thread thread1 = e1.getThread(); - Thread thread2 = e2.getThread(); - if (thread1 == thread2 || !thread1.hasSyncSet()) { - continue; - } - if (thread1.getSyncSet().contains(thread2) && !exec.areMutuallyExclusive(e1, e2)) { - must.add(e1, e2); - } - } - } - return new Knowledge(must, new EventGraph(must)); - } - } - - public final class Propagator implements Definition.Visitor { - - private Relation source; - private EventGraph may; - private EventGraph must; - - public Relation getSource() { - return source; - } - - public void setSource(Relation source) { - this.source = source; - } - - public EventGraph getMay() { - return may; - } - - public void setMay(EventGraph may) { - this.may = may; - } - - public EventGraph getMust() { - return must; - } - - public void setMust(EventGraph must) { - this.must = must; - } - - @Override - public Delta visitUnion(Union union) { - if (union.getOperands().contains(source)) { - return new Delta(may, must); - } - return EMPTY; - } - - @Override - public Delta visitIntersection(Intersection inter) { - final List operands = inter.getOperands(); - if (operands.contains(source)) { - EventGraph maySet = operands.stream() - .map(r -> source.equals(r) ? may : knowledgeMap.get(r).may) - .sorted(Comparator.comparingInt(EventGraph::size)) - .reduce(EventGraph::intersection) - .orElseThrow(); - EventGraph mustSet = operands.stream() - .map(r -> source.equals(r) ? must : knowledgeMap.get(r).must) - .sorted(Comparator.comparingInt(EventGraph::size)) - .reduce(EventGraph::intersection) - .orElseThrow(); - return new Delta(maySet, mustSet); - } - return EMPTY; - } - - @Override - public Delta visitDifference(Difference diff) { - if (diff.getMinuend().equals(source)) { - Knowledge k = knowledgeMap.get(diff.getSubtrahend()); - return new Delta(difference(may, k.must), difference(must, k.may)); - } - return EMPTY; - } - - @Override - public Delta visitComposition(Composition comp) { - final Relation r1 = comp.getLeftOperand(); - final Relation r2 = comp.getRightOperand(); - EventGraph maySet = new EventGraph(); - EventGraph mustSet = new EventGraph(); - if (r1.equals(source)) { - computeComposition(maySet, may, knowledgeMap.get(r2).may, true); - computeComposition(mustSet, must, knowledgeMap.get(r2).must, false); - } - if (r2.equals(source)) { - computeComposition(maySet, knowledgeMap.get(r1).may, may, true); - computeComposition(mustSet, knowledgeMap.get(r1).must, must, false); - } - return new Delta(maySet, mustSet); - } - - private void computeComposition(EventGraph result, EventGraph left, EventGraph right, final boolean isMay) { - for (Event e1 : left.getDomain()) { - Set update = new HashSet<>(); - for (Event e : left.getRange(e1)) { - if (isMay || exec.isImplied(e1, e)) { - update.addAll(right.getRange(e)); - } else { - update.addAll(right.getRange(e).stream() - .filter(e2 -> exec.isImplied(e2, e)).toList()); - } - } - update.removeIf(e -> exec.areMutuallyExclusive(e1, e)); - result.addRange(e1, update); - } - } - - @Override - public Delta visitDomainIdentity(DomainIdentity domId) { - if (domId.getOperand().equals(source)) { - EventGraph maySet = new EventGraph(); - may.getDomain().forEach(e -> maySet.add(e, e)); - EventGraph mustSet = new EventGraph(); - must.apply((e1, e2) -> { - if (exec.isImplied(e1, e2)) { - mustSet.add(e1, e1); - } - }); - return new Delta(maySet, mustSet); - } - return EMPTY; - } - - @Override - public Delta visitRangeIdentity(RangeIdentity rangeId) { - if (rangeId.getOperand().equals(source)) { - EventGraph maySet = new EventGraph(); - may.getRange().forEach(e -> maySet.add(e, e)); - EventGraph mustSet = new EventGraph(); - must.apply((e1, e2) -> { - if (exec.isImplied(e2, e1)) { - mustSet.add(e2, e2); - } - }); - return new Delta(maySet, mustSet); - } - return EMPTY; - } - - @Override - public Delta visitInverse(Inverse inv) { - if (inv.getOperand().equals(source)) { - return new Delta(may.inverse(), must.inverse()); - } - return EMPTY; - } - - @Override - public Delta visitTransitiveClosure(TransitiveClosure trans) { - final Relation rel = trans.getDefinedRelation(); - if (trans.getOperand().equals(source)) { - EventGraph maySet = computeTransitiveClosure(knowledgeMap.get(rel).may, may, true); - EventGraph mustSet = computeTransitiveClosure(knowledgeMap.get(rel).must, must, false); - return new Delta(maySet, mustSet); - } - return EMPTY; - } - - private EventGraph computeTransitiveClosure(EventGraph oldOuter, EventGraph inner, boolean isMay) { - EventGraph next; - EventGraph outer = new EventGraph(oldOuter); - outer.addAll(inner); - for (EventGraph current = inner; !current.isEmpty(); current = next) { - next = new EventGraph(); - for (Event e1 : current.getDomain()) { - Set update = new HashSet<>(); - for (Event e2 : current.getRange(e1)) { - if (isMay) { - update.addAll(outer.getRange(e2)); - } else { - boolean implies = exec.isImplied(e1, e2); - update.addAll(outer.getRange(e2).stream() - .filter(e -> implies || exec.isImplied(e, e2)) - .toList()); - } - } - Set known = outer.getRange(e1); - update.removeIf(e -> known.contains(e) || exec.areMutuallyExclusive(e1, e)); - if (!update.isEmpty()) { - next.addRange(e1, update); - } - } - outer.addAll(next); - } - return outer; - } - } - - private final class ExtendedPropagator implements Definition.Visitor> { - Relation origin; - EventGraph disabled; - EventGraph enabled; - - @Override - public Map visitDefinition(Definition def) { - return Map.of(); - } - - @Override - public Map visitUnion(Union union) { - final Relation rel = union.getDefinedRelation(); - final List operands = union.getOperands(); - Map map = new HashMap<>(); - if (origin.equals(rel)) { - for (Relation o : operands) { - map.put(o, new ExtendedDelta(disabled, EventGraph.empty())); - } - } - if (operands.contains(origin)) { - EventGraph d = new EventGraph(); - disabled.apply((e1, e2) -> { - if (operands.stream().noneMatch(o -> knowledgeMap.get(o).getMaySet().contains(e1, e2))) { - d.add(e1, e2); - } - }); - map.put(rel, new ExtendedDelta(d, enabled)); - } - return map; - } - - @Override - public Map visitIntersection(Intersection inter) { - final Relation rel = inter.getDefinedRelation(); - final List operands = inter.getOperands(); - Map map = new HashMap<>(); - if (origin.equals(rel)) { - for (Relation o : operands) { - EventGraph d = operands.stream() - .map(r -> o.equals(r) ? disabled : knowledgeMap.get(r).must) - .sorted(Comparator.comparingInt(EventGraph::size)) - .reduce(EventGraph::intersection) - .orElseThrow(); - map.putIfAbsent(o, new ExtendedDelta(d, enabled)); - } - } - if (operands.contains(origin)) { - EventGraph e = operands.stream() - .map(r -> origin.equals(r) ? enabled : knowledgeMap.get(r).must) - .sorted(Comparator.comparingInt(EventGraph::size)) - .reduce(EventGraph::intersection) - .orElseThrow(); - map.put(rel, new ExtendedDelta(disabled, e)); - } - return map; - } - - @Override - public Map visitDifference(Difference diff) { - final Relation r0 = diff.getDefinedRelation(); - final Relation r1 = diff.getMinuend(); - final Relation r2 = diff.getSubtrahend(); - Map map = new HashMap<>(); - if (origin.equals(r0)) { - map.put(r1, new ExtendedDelta(difference(disabled, knowledgeMap.get(r2).may), enabled)); - //map.put(r2, new ExtendedDelta(EMPTY_SET, intersection(disabled, knowledgeMap.get(r1).getMustSet()))); - } - if (origin.equals(r1)) { - map.put(r0, new ExtendedDelta(disabled, difference(enabled, knowledgeMap.get(r2).may))); - } - if (origin.equals(r2)) { - Knowledge k1 = knowledgeMap.get(r1); - map.put(r0, new ExtendedDelta(intersection(enabled, k1.may), intersection(disabled, k1.must))); - map.put(r1, new ExtendedDelta(difference(disabled, knowledgeMap.get(r0).may), EventGraph.empty())); - } - return map; - } - - @Override - public Map visitComposition(Composition comp) { - final Relation r0 = comp.getDefinedRelation(); - final Relation r1 = comp.getLeftOperand(); - final Relation r2 = comp.getRightOperand(); - EventGraph d0 = new EventGraph(); - EventGraph e0 = new EventGraph(); - EventGraph d1 = new EventGraph(); - EventGraph d2 = new EventGraph(); - Knowledge k0 = knowledgeMap.get(r0); - Knowledge k1 = knowledgeMap.get(r1); - Knowledge k2 = knowledgeMap.get(r2); - if (origin.equals(r0)) { - Map> mustOut1 = k1.must.getOutMap(); - Map> mustIn2 = k2.must.getInMap(); - disabled.apply((x, z) -> { - boolean implies = exec.isImplied(x, z); - boolean implied = exec.isImplied(z, x); - for (Event y : mustOut1.getOrDefault(x, Set.of())) { - if ((implied || exec.isImplied(y, x)) && k2.may.contains(y, z)) { - d2.add(y, z); - } - } - for (Event y : mustIn2.getOrDefault(z, Set.of())) { - if ((implies || exec.isImplied(y, z)) && k1.may.contains(x, y)) { - d1.add(x, y); - } - } - }); - } - - if (origin.equals(r1)) { - List result = handleCompositionChild(disabled, enabled, - k0.may, k1.may, k2.may, k2.must); - result.get(0).getOutMap().forEach((e1, value) -> value.forEach(e2 -> d0.add(e1, e2))); - result.get(1).getOutMap().forEach((e1, value) -> value.forEach(e2 -> e0.add(e1, e2))); - result.get(2).getOutMap().forEach((e1, value) -> value.forEach(e2 -> d2.add(e1, e2))); - } - - if (origin.equals(r2)) { - List result = handleCompositionChild(disabled.inverse(), enabled.inverse(), - k0.may.inverse(), k2.may.inverse(), k1.may.inverse(), k1.must.inverse()); - result.get(0).getOutMap().forEach((e2, value) -> value.forEach(e1 -> d0.add(e1, e2))); - result.get(1).getOutMap().forEach((e2, value) -> value.forEach(e1 -> e0.add(e1, e2))); - result.get(2).getOutMap().forEach((e2, value) -> value.forEach(e1 -> d1.add(e1, e2))); - } - - Map map = new HashMap<>(); - map.put(r0, new ExtendedDelta(d0, e0)); - map.computeIfAbsent(r1, k -> new ExtendedDelta(d1, new EventGraph())).disabled.addAll(d1); - map.computeIfAbsent(r2, k -> new ExtendedDelta(d2, new EventGraph())).disabled.addAll(d2); - return map; - } - - private List handleCompositionChild( - EventGraph disOut1, - EventGraph enOut1, - EventGraph mayOut0, - EventGraph mayOut1, - EventGraph mayOut2, - EventGraph mustOut2 - ) { - List result = handleCompositionEnabledSet(enOut1, mayOut2, mustOut2, mayOut0); - EventGraph disOut0 = handleCompositionDisabledSet(disOut1, mayOut1, mayOut2); - EventGraph enOut0 = result.get(0); - EventGraph disOut2 = result.get(1); - return List.of(disOut0, enOut0, disOut2); - } - - private EventGraph handleCompositionDisabledSet( - EventGraph disOut1, - EventGraph mayOut1, - EventGraph mayOut2 - ) { - EventGraph result = new EventGraph(); - for (Event e1 : disOut1.getDomain()) { - for (Event e : disOut1.getRange(e1)) { - Set e2Set = new HashSet<>(mayOut2.getRange(e)); - e2Set.removeIf(e2 -> exec.areMutuallyExclusive(e1, e2)); - e2Set.removeAll(result.getRange(e1)); - if (!e2Set.isEmpty()) { - for (Event eAlt : mayOut1.getRange(e1)) { - e2Set.removeAll(mayOut2.getRange(eAlt)); - if (e2Set.isEmpty()) { - break; - } - } - } - result.addRange(e1, e2Set); - } - } - return result; - } - - private List handleCompositionEnabledSet( - EventGraph enOut1, - EventGraph mayOut2, - EventGraph mustOut2, - EventGraph mayOut0 - ) { - EventGraph enOut0 = new EventGraph(); - EventGraph disOut2 = new EventGraph(); - for (Event e1 : enOut1.getDomain()) { - for (Event e : enOut1.getRange(e1)) { - Set e2Set = new HashSet<>(mayOut2.getRange(e)); - e2Set.removeIf(e2 -> exec.areMutuallyExclusive(e1, e2)); - if (!e2Set.isEmpty()) { - Set e2SetCopy = new HashSet<>(e2Set); - e2Set.retainAll(mustOut2.getRange(e)); - if (!exec.isImplied(e1, e)) { - e2Set.removeIf(e2 -> !exec.isImplied(e2, e)); - } - enOut0.addRange(e1, e2Set); - e2SetCopy.removeAll(mayOut0.getRange(e1)); - if (!exec.isImplied(e, e1)) { - e2SetCopy.removeIf(e2 -> !exec.isImplied(e2, e1)); - } - disOut2.addRange(e, e2SetCopy); - } - } - } - return List.of(enOut0, disOut2); - } - - @Override - public Map visitInverse(Inverse inv) { - final Relation r0 = inv.getDefinedRelation(); - final Relation r1 = inv.getOperand(); - if (origin.equals(r0)) { - return Map.of(r1, new ExtendedDelta(disabled.inverse(), EventGraph.empty())); - } - if (origin.equals(r1)) { - return Map.of(r0, new ExtendedDelta(disabled.inverse(), enabled.inverse())); - } - return Map.of(); - } - - @Override - public Map visitTransitiveClosure(TransitiveClosure trans) { - final Relation r0 = trans.getDefinedRelation(); - final Relation r1 = trans.getOperand(); - EventGraph d0 = new EventGraph(); - EventGraph e0 = new EventGraph(); - EventGraph d1 = new EventGraph(); - Knowledge k0 = knowledgeMap.get(r0); - Knowledge k1 = knowledgeMap.get(r1); - if (origin.equals(r1)) { - Map> mayOut0 = k0.may.getOutMap(); - Map> mayIn0 = k0.may.getInMap(); - disabled.apply((x, y) -> { - Set alternatives = k1.may.getRange(x); - if (k0.getMaySet().contains(x, y) - && Collections.disjoint(alternatives, mayIn0.getOrDefault(y, Set.of()))) { - d0.add(x, y); - } - if (!Tuple.isLoop(x, y)) { - for (Event z : mayOut0.getOrDefault(y, Set.of())) { - if (k0.getMaySet().contains(x, z) - && !alternatives.contains(z) - && Collections.disjoint(alternatives, mayIn0.getOrDefault(z, Set.of()))) { - d0.add(x, z); - } - } - } - }); - e0.addAll(enabled); - enabled.apply((x, y) -> { - if (!Tuple.isLoop(x, y)) { - boolean implied = exec.isImplied(y, x); - boolean implies = exec.isImplied(x, y); - for (Event z : mayOut0.getOrDefault(y, Set.of())) { - if (exec.areMutuallyExclusive(x, z)) { - continue; - } - if ((implies || exec.isImplied(z, y)) && k0.getMustSet().contains(y, z)) { - e0.add(x, z); - } - if ((implied || exec.isImplied(z, x)) && !k0.getMaySet().contains(x, z)) { - d0.add(y, z); - } - } - } - }); - } - if (origin.equals(r0)) { - Map> mustIn0 = k0.must.getInMap(); - Map> mayIn1 = k1.may.getInMap(); - Map> mustOut1 = k1.must.getOutMap(); - d1.addAll(intersection(disabled, k1.may)); - disabled.apply((x, z) -> { - if (!Tuple.isLoop(x, z)) { - boolean implied = exec.isImplied(z, x); - boolean implies = exec.isImplied(x, z); - for (Event y : mustOut1.getOrDefault(x, Set.of())) { - if ((implied || exec.isImplied(y, x)) && k0.may.contains(y, z)) { - d0.add(y, z); - } - } - for (Event y : mustIn0.getOrDefault(z, Set.of())) { - if ((implies || exec.isImplied(y, z)) && k1.may.contains(x, y)) { - d1.add(x, y); - } - } - } - }); - enabled.apply((y, z) -> { - if (!Tuple.isLoop(y, z)) { - boolean implied = exec.isImplied(z, y); - boolean implies = exec.isImplied(y, z); - for (Event x : mayIn1.getOrDefault(y, Set.of())) { - if (exec.areMutuallyExclusive(x, z)) { - continue; - } - if ((implied || exec.isImplied(x, y)) && k1.must.contains(x, y)) { - e0.add(x, z); - } - if ((implies || exec.isImplied(x, z)) && !k0.may.contains(x, z)) { - d1.add(x, y); - } - } - } - }); - } - return Map.of( - r0, new ExtendedDelta(d0, e0), - r1, new ExtendedDelta(d1, EventGraph.empty())); - } - - @Override - public Map visitCoherence(Coherence coDef) { - if (disabled.isEmpty()) { - return Map.of(); - } - //TODO use transitivity - EventGraph e = new EventGraph(); - disabled.apply((x, y) -> { - if (alias.mustAlias((MemoryCoreEvent) x, (MemoryCoreEvent) y)) { - e.add(y, x); - } - }); - return Map.of(coDef.getDefinedRelation(), new ExtendedDelta(EventGraph.empty(), e)); - } - } - - private static List visibleEvents(Thread t) { - return t.getEvents().stream().filter(e -> e.hasTag(VISIBLE)).toList(); - } - - private long countMaySet() { - return knowledgeMap.values().stream().mapToLong(k -> k.may.size()).sum(); - } - - private long countMustSet() { - return knowledgeMap.values().stream().mapToLong(k -> k.must.size()).sum(); - } - - // GPU memory models make use of virtual addresses. - // This models same_alias_r from the PTX Alloy model - // Checking address1 and address2 hold the same generic address - private boolean sameGenericAddress(MemoryCoreEvent e1, MemoryCoreEvent e2) { - // TODO: Add support for pointers, i.e. if `x` and `y` virtually alias, - // then `x + offset` and `y + offset` should too - if (!(e1.getAddress() instanceof VirtualMemoryObject addr1) - || !(e2.getAddress() instanceof VirtualMemoryObject addr2)) { - return false; - } - return addr1.getGenericAddress() == addr2.getGenericAddress(); } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/axiom/Acyclicity.java b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/axiom/Acyclicity.java index 1443e4c941..c30b5bf000 100755 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/axiom/Acyclicity.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/axiom/Acyclicity.java @@ -81,116 +81,6 @@ public String toString() { return (negated ? "~" : "") + "acyclic " + rel.getNameOrTerm(); } - @Override - public Map computeInitialKnowledgeClosure( - Map knowledgeMap, - Context analysisContext) { - long t0 = System.currentTimeMillis(); - ExecutionAnalysis exec = analysisContext.get(ExecutionAnalysis.class); - RelationAnalysis.Knowledge knowledge = knowledgeMap.get(rel); - EventGraph may = knowledge.getMaySet(); - EventGraph must = knowledge.getMustSet(); - EventGraph newDisabled = new EventGraph(); - may.apply((e1, e2) -> { - if (Tuple.isLoop(e1, e2) || must.contains(e2, e1)) { - newDisabled.add(e1, e2); - } - }); - Map> mustOut = new HashMap<>(); - must.apply((e1, e2) -> { - if (!Tuple.isLoop(e1, e2)) { - mustOut.computeIfAbsent(e1, x -> new ArrayList<>()).add(e2); - } - }); - EventGraph current = knowledge.getMustSet(); - while (true) { - EventGraph next = new EventGraph(); - current.apply((x, y) -> { - if (Tuple.isLoop(x, y)) { - boolean implied = exec.isImplied(x, y); - for (Event z : mustOut.getOrDefault(y, List.of())) { - if (!implied && !exec.isImplied(z, y) || exec.areMutuallyExclusive(x, z)) { - continue; - } - if (newDisabled.add(z, x)) { - next.add(x, z); - } - } - } - }); - if (next.isEmpty()) { - break; - } - current = next; - } - newDisabled.retainAll(knowledge.getMaySet()); - logger.debug("disabled {} edges in {}ms", newDisabled.size(), System.currentTimeMillis() - t0); - return Map.of(rel, new RelationAnalysis.ExtendedDelta(newDisabled, EventGraph.empty())); - } - - @Override - public Map computeIncrementalKnowledgeClosure( - Relation changed, - EventGraph disabled, - EventGraph enabled, - Map knowledgeMap, - Context analysisContext) { - checkArgument(changed == rel, - "misdirected knowledge propagation from relation %s to %s", changed, this); - long t0 = System.currentTimeMillis(); - ExecutionAnalysis exec = analysisContext.get(ExecutionAnalysis.class); - RelationAnalysis.Knowledge knowledge = knowledgeMap.get(rel); - EventGraph may = knowledge.getMaySet(); - EventGraph newDisabled = new EventGraph(); - enabled.apply((e1, e2) -> { - if (may.contains(e2, e1)) { - newDisabled.add(e2, e1); - } - }); - Map> mustIn = new HashMap<>(); - Map> mustOut = new HashMap<>(); - knowledge.getMustSet().apply((e1, e2) -> { - if (!Tuple.isLoop(e1, e2)) { - mustIn.computeIfAbsent(e2, x -> new ArrayList<>()).add(e1); - mustOut.computeIfAbsent(e1, x -> new ArrayList<>()).add(e2); - } - }); - - EventGraph current = enabled; - while (true) { - EventGraph next = new EventGraph(); - current.apply((x, y) -> { - if (!Tuple.isLoop(x, y)) { - boolean implies = exec.isImplied(x, y); - boolean implied = exec.isImplied(y, x); - for (Event w : mustIn.getOrDefault(x, List.of())) { - if (!implied && !exec.isImplied(w, x) || exec.areMutuallyExclusive(w, y)) { - continue; - } - if (newDisabled.add(y, w)) { - next.add(w, y); - } - } - for (Event z : mustOut.getOrDefault(y, List.of())) { - if (!implies && !exec.isImplied(z, y) || exec.areMutuallyExclusive(x, z)) { - continue; - } - if (newDisabled.add(z, x)) { - next.add(x, z); - } - } - } - }); - if (next.isEmpty()) { - break; - } - current = next; - } - newDisabled.retainAll(knowledge.getMaySet()); - logger.debug("Disabled {} edges in {}ms", newDisabled.size(), System.currentTimeMillis() - t0); - return Map.of(rel, new RelationAnalysis.ExtendedDelta(newDisabled, EventGraph.empty())); - } - @Override protected EventGraph getEncodeGraph(Context analysisContext) { ExecutionAnalysis exec = analysisContext.get(ExecutionAnalysis.class); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/axiom/Emptiness.java b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/axiom/Emptiness.java index 422db47580..0d6173b7d6 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/axiom/Emptiness.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/axiom/Emptiness.java @@ -22,13 +22,6 @@ public Emptiness(Relation rel) { super(rel, false, false); } - @Override - public Map computeInitialKnowledgeClosure( - Map knowledgeMap, - Context analysisContext) { - return Map.of(rel, new RelationAnalysis.ExtendedDelta(knowledgeMap.get(rel).getMaySet(), EventGraph.empty())); - } - @Override protected EventGraph getEncodeGraph(Context analysisContext) { final RelationAnalysis ra = analysisContext.get(RelationAnalysis.class); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/axiom/Irreflexivity.java b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/axiom/Irreflexivity.java index dfdd68b31c..17f59d2737 100755 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/axiom/Irreflexivity.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/axiom/Irreflexivity.java @@ -23,15 +23,6 @@ public Irreflexivity(Relation rel) { super(rel, false, false); } - @Override - public Map computeInitialKnowledgeClosure( - Map knowledgeMap, - Context analysisContext) { - RelationAnalysis.Knowledge k = knowledgeMap.get(rel); - EventGraph d = k.getMaySet().filter(Tuple::isLoop); - return Map.of(rel, new RelationAnalysis.ExtendedDelta(d, EventGraph.empty())); - } - @Override protected EventGraph getEncodeGraph(Context analysisContext) { final RelationAnalysis ra = analysisContext.get(RelationAnalysis.class); From eb15f40ac6697c5579229fc2862fd2584d5fea17 Mon Sep 17 00:00:00 2001 From: Dmitry Ivanov <32366373+DIvanov503@users.noreply.github.com> Date: Mon, 29 Jul 2024 15:39:25 +0200 Subject: [PATCH 20/28] Fix an incorrect term pattern in SyncWith (#706) Co-authored-by: Dmitry Ivanov --- .../main/java/com/dat3m/dartagnan/wmm/definition/SyncWith.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/definition/SyncWith.java b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/definition/SyncWith.java index b081ecf06f..6978d78e16 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/definition/SyncWith.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/definition/SyncWith.java @@ -11,7 +11,7 @@ public class SyncWith extends Definition { public SyncWith(Relation r) { - super(r, RelationNameRepository.SYNC_FENCE); + super(r, RelationNameRepository.SSW); } @Override public T accept(Visitor v) { From 6582d4aaa1279a9fe42173505b1fdfc162a05828 Mon Sep 17 00:00:00 2001 From: Hernan Ponce de Leon Date: Sat, 3 Aug 2024 20:21:48 +0200 Subject: [PATCH 21/28] Extend loop normalization (#705) Signed-off-by: Hernan Ponce de Leon Co-authored-by: Hernan Ponce de Leon Co-authored-by: Thomas Haas --- README.md | 1 - .../{c => }/miscellaneous/MP_atomic_bool.c | 0 benchmarks/{c => }/miscellaneous/SB-RMW.c | 0 .../miscellaneous/SB-asm-lwsync+sync.c | 0 .../{c => }/miscellaneous/SB-asm-mfences.c | 0 .../{c => }/miscellaneous/SB-asm-syncs.c | 0 benchmarks/{c => }/miscellaneous/ctlz.c | 0 benchmarks/{c => }/miscellaneous/cttz.c | 0 .../miscellaneous/funcPtrInStaticMemory.c | 0 .../{c => }/miscellaneous/idd_dynamic.c | 0 benchmarks/miscellaneous/jumpIntoLoop.c | 21 ++ benchmarks/{c => }/miscellaneous/memcpy_s.c | 0 .../{c => }/miscellaneous/multipleBackJumps.c | 0 .../{c => }/miscellaneous/nondet_loop.c | 0 benchmarks/{c => }/miscellaneous/offsetof.c | 0 .../miscellaneous/propagatableSideEffects.c | 0 benchmarks/{c => }/miscellaneous/pthread.c | 0 benchmarks/{c => }/miscellaneous/recursion.c | 0 .../{c => }/miscellaneous/staticLoops.c | 0 .../{c => }/miscellaneous/thread_chaining.c | 0 benchmarks/{c => }/miscellaneous/thread_id.c | 0 .../{c => }/miscellaneous/thread_inlining.c | 0 .../miscellaneous/thread_inlining_complex.c | 0 .../miscellaneous/thread_inlining_complex_2.c | 0 .../{c => }/miscellaneous/thread_local.c | 0 .../{c => }/miscellaneous/thread_loop.c | 0 benchmarks/{c => }/miscellaneous/uninitRead.c | 0 .../unsupported-loop-normalization.c | 58 +++++ .../{c => }/miscellaneous/verifierAssert.c | 0 .../program/processing/NormalizeLoops.java | 168 +++++++++++-- .../program/processing/ProcessingManager.java | 2 +- .../dat3m/dartagnan/c/MiscellaneousTest.java | 3 +- .../dartagnan/exceptions/ExceptionsTest.java | 11 + .../unsupported-loop-normalization.ll | 235 ++++++++++++++++++ .../resources/miscellaneous/jumpIntoLoop.ll | 180 ++++++++++++++ 35 files changed, 657 insertions(+), 22 deletions(-) rename benchmarks/{c => }/miscellaneous/MP_atomic_bool.c (100%) rename benchmarks/{c => }/miscellaneous/SB-RMW.c (100%) rename benchmarks/{c => }/miscellaneous/SB-asm-lwsync+sync.c (100%) rename benchmarks/{c => }/miscellaneous/SB-asm-mfences.c (100%) rename benchmarks/{c => }/miscellaneous/SB-asm-syncs.c (100%) rename benchmarks/{c => }/miscellaneous/ctlz.c (100%) rename benchmarks/{c => }/miscellaneous/cttz.c (100%) rename benchmarks/{c => }/miscellaneous/funcPtrInStaticMemory.c (100%) rename benchmarks/{c => }/miscellaneous/idd_dynamic.c (100%) create mode 100644 benchmarks/miscellaneous/jumpIntoLoop.c rename benchmarks/{c => }/miscellaneous/memcpy_s.c (100%) rename benchmarks/{c => }/miscellaneous/multipleBackJumps.c (100%) rename benchmarks/{c => }/miscellaneous/nondet_loop.c (100%) rename benchmarks/{c => }/miscellaneous/offsetof.c (100%) rename benchmarks/{c => }/miscellaneous/propagatableSideEffects.c (100%) rename benchmarks/{c => }/miscellaneous/pthread.c (100%) rename benchmarks/{c => }/miscellaneous/recursion.c (100%) rename benchmarks/{c => }/miscellaneous/staticLoops.c (100%) rename benchmarks/{c => }/miscellaneous/thread_chaining.c (100%) rename benchmarks/{c => }/miscellaneous/thread_id.c (100%) rename benchmarks/{c => }/miscellaneous/thread_inlining.c (100%) rename benchmarks/{c => }/miscellaneous/thread_inlining_complex.c (100%) rename benchmarks/{c => }/miscellaneous/thread_inlining_complex_2.c (100%) rename benchmarks/{c => }/miscellaneous/thread_local.c (100%) rename benchmarks/{c => }/miscellaneous/thread_loop.c (100%) rename benchmarks/{c => }/miscellaneous/uninitRead.c (100%) create mode 100644 benchmarks/miscellaneous/unsupported-loop-normalization.c rename benchmarks/{c => }/miscellaneous/verifierAssert.c (100%) create mode 100644 dartagnan/src/test/resources/exceptions/unsupported-loop-normalization.ll create mode 100644 dartagnan/src/test/resources/miscellaneous/jumpIntoLoop.ll diff --git a/README.md b/README.md index 1b79dc8236..131b1ff33e 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,6 @@ export DAT3M_OUTPUT=$DAT3M_HOME/output At least the following compiler flag needs to be set, further can be added (only to verify C programs) ``` export CFLAGS="-I$DAT3M_HOME/include" -export OPTFLAGS="-mem2reg -sroa -early-cse -indvars -loop-unroll -fix-irreducible -loop-simplify -simplifycfg -gvn" ``` If you are verifying C code, be sure `clang` is in your `PATH`. diff --git a/benchmarks/c/miscellaneous/MP_atomic_bool.c b/benchmarks/miscellaneous/MP_atomic_bool.c similarity index 100% rename from benchmarks/c/miscellaneous/MP_atomic_bool.c rename to benchmarks/miscellaneous/MP_atomic_bool.c diff --git a/benchmarks/c/miscellaneous/SB-RMW.c b/benchmarks/miscellaneous/SB-RMW.c similarity index 100% rename from benchmarks/c/miscellaneous/SB-RMW.c rename to benchmarks/miscellaneous/SB-RMW.c diff --git a/benchmarks/c/miscellaneous/SB-asm-lwsync+sync.c b/benchmarks/miscellaneous/SB-asm-lwsync+sync.c similarity index 100% rename from benchmarks/c/miscellaneous/SB-asm-lwsync+sync.c rename to benchmarks/miscellaneous/SB-asm-lwsync+sync.c diff --git a/benchmarks/c/miscellaneous/SB-asm-mfences.c b/benchmarks/miscellaneous/SB-asm-mfences.c similarity index 100% rename from benchmarks/c/miscellaneous/SB-asm-mfences.c rename to benchmarks/miscellaneous/SB-asm-mfences.c diff --git a/benchmarks/c/miscellaneous/SB-asm-syncs.c b/benchmarks/miscellaneous/SB-asm-syncs.c similarity index 100% rename from benchmarks/c/miscellaneous/SB-asm-syncs.c rename to benchmarks/miscellaneous/SB-asm-syncs.c diff --git a/benchmarks/c/miscellaneous/ctlz.c b/benchmarks/miscellaneous/ctlz.c similarity index 100% rename from benchmarks/c/miscellaneous/ctlz.c rename to benchmarks/miscellaneous/ctlz.c diff --git a/benchmarks/c/miscellaneous/cttz.c b/benchmarks/miscellaneous/cttz.c similarity index 100% rename from benchmarks/c/miscellaneous/cttz.c rename to benchmarks/miscellaneous/cttz.c diff --git a/benchmarks/c/miscellaneous/funcPtrInStaticMemory.c b/benchmarks/miscellaneous/funcPtrInStaticMemory.c similarity index 100% rename from benchmarks/c/miscellaneous/funcPtrInStaticMemory.c rename to benchmarks/miscellaneous/funcPtrInStaticMemory.c diff --git a/benchmarks/c/miscellaneous/idd_dynamic.c b/benchmarks/miscellaneous/idd_dynamic.c similarity index 100% rename from benchmarks/c/miscellaneous/idd_dynamic.c rename to benchmarks/miscellaneous/idd_dynamic.c diff --git a/benchmarks/miscellaneous/jumpIntoLoop.c b/benchmarks/miscellaneous/jumpIntoLoop.c new file mode 100644 index 0000000000..8434e68318 --- /dev/null +++ b/benchmarks/miscellaneous/jumpIntoLoop.c @@ -0,0 +1,21 @@ +#include +#include +#include + +volatile int32_t x = 0; + +int main() +{ + int i = 0; + int jumpIntoLoop = __VERIFIER_nondet_bool(); + if (jumpIntoLoop) goto L; + + __VERIFIER_loop_bound(6); + for (i = 1; i < 5; i++) { +L: + x++; + } + + assert ((jumpIntoLoop && x == 5) || (!jumpIntoLoop && x == 4)); + return 0; +} diff --git a/benchmarks/c/miscellaneous/memcpy_s.c b/benchmarks/miscellaneous/memcpy_s.c similarity index 100% rename from benchmarks/c/miscellaneous/memcpy_s.c rename to benchmarks/miscellaneous/memcpy_s.c diff --git a/benchmarks/c/miscellaneous/multipleBackJumps.c b/benchmarks/miscellaneous/multipleBackJumps.c similarity index 100% rename from benchmarks/c/miscellaneous/multipleBackJumps.c rename to benchmarks/miscellaneous/multipleBackJumps.c diff --git a/benchmarks/c/miscellaneous/nondet_loop.c b/benchmarks/miscellaneous/nondet_loop.c similarity index 100% rename from benchmarks/c/miscellaneous/nondet_loop.c rename to benchmarks/miscellaneous/nondet_loop.c diff --git a/benchmarks/c/miscellaneous/offsetof.c b/benchmarks/miscellaneous/offsetof.c similarity index 100% rename from benchmarks/c/miscellaneous/offsetof.c rename to benchmarks/miscellaneous/offsetof.c diff --git a/benchmarks/c/miscellaneous/propagatableSideEffects.c b/benchmarks/miscellaneous/propagatableSideEffects.c similarity index 100% rename from benchmarks/c/miscellaneous/propagatableSideEffects.c rename to benchmarks/miscellaneous/propagatableSideEffects.c diff --git a/benchmarks/c/miscellaneous/pthread.c b/benchmarks/miscellaneous/pthread.c similarity index 100% rename from benchmarks/c/miscellaneous/pthread.c rename to benchmarks/miscellaneous/pthread.c diff --git a/benchmarks/c/miscellaneous/recursion.c b/benchmarks/miscellaneous/recursion.c similarity index 100% rename from benchmarks/c/miscellaneous/recursion.c rename to benchmarks/miscellaneous/recursion.c diff --git a/benchmarks/c/miscellaneous/staticLoops.c b/benchmarks/miscellaneous/staticLoops.c similarity index 100% rename from benchmarks/c/miscellaneous/staticLoops.c rename to benchmarks/miscellaneous/staticLoops.c diff --git a/benchmarks/c/miscellaneous/thread_chaining.c b/benchmarks/miscellaneous/thread_chaining.c similarity index 100% rename from benchmarks/c/miscellaneous/thread_chaining.c rename to benchmarks/miscellaneous/thread_chaining.c diff --git a/benchmarks/c/miscellaneous/thread_id.c b/benchmarks/miscellaneous/thread_id.c similarity index 100% rename from benchmarks/c/miscellaneous/thread_id.c rename to benchmarks/miscellaneous/thread_id.c diff --git a/benchmarks/c/miscellaneous/thread_inlining.c b/benchmarks/miscellaneous/thread_inlining.c similarity index 100% rename from benchmarks/c/miscellaneous/thread_inlining.c rename to benchmarks/miscellaneous/thread_inlining.c diff --git a/benchmarks/c/miscellaneous/thread_inlining_complex.c b/benchmarks/miscellaneous/thread_inlining_complex.c similarity index 100% rename from benchmarks/c/miscellaneous/thread_inlining_complex.c rename to benchmarks/miscellaneous/thread_inlining_complex.c diff --git a/benchmarks/c/miscellaneous/thread_inlining_complex_2.c b/benchmarks/miscellaneous/thread_inlining_complex_2.c similarity index 100% rename from benchmarks/c/miscellaneous/thread_inlining_complex_2.c rename to benchmarks/miscellaneous/thread_inlining_complex_2.c diff --git a/benchmarks/c/miscellaneous/thread_local.c b/benchmarks/miscellaneous/thread_local.c similarity index 100% rename from benchmarks/c/miscellaneous/thread_local.c rename to benchmarks/miscellaneous/thread_local.c diff --git a/benchmarks/c/miscellaneous/thread_loop.c b/benchmarks/miscellaneous/thread_loop.c similarity index 100% rename from benchmarks/c/miscellaneous/thread_loop.c rename to benchmarks/miscellaneous/thread_loop.c diff --git a/benchmarks/c/miscellaneous/uninitRead.c b/benchmarks/miscellaneous/uninitRead.c similarity index 100% rename from benchmarks/c/miscellaneous/uninitRead.c rename to benchmarks/miscellaneous/uninitRead.c diff --git a/benchmarks/miscellaneous/unsupported-loop-normalization.c b/benchmarks/miscellaneous/unsupported-loop-normalization.c new file mode 100644 index 0000000000..c512ba2283 --- /dev/null +++ b/benchmarks/miscellaneous/unsupported-loop-normalization.c @@ -0,0 +1,58 @@ +#include +#include + +int main() +{ + unsigned int x = __VERIFIER_nondet_uint(); +A: + if (x >= 1) { + x = 4; + goto B; + } else { + goto C; + } +B: + // 3, 4, 5, 6 + if (x > 3) { + goto D; + } else { + goto E; + } +D: + // 3, 4, 5, 6 + x++; + + if (x > 5) { + goto Halt; + } else { + goto E; + } +E: + // 3, 4, 5 + if (x < 4) { + goto D; + } else { + goto F; + } +F: + // 4, 5 + if (x < 3) { + goto C; + } else { + goto G; + } +G: + // 0, 1, 2, 4, 5 + x++; + goto C; +C: + // 0, 1, 2, 3, 5, 6 + if (x > 2) { + goto B; + } else { + goto G; + } +Halt: + // 6, 7 + assert(x == 6); +} \ No newline at end of file diff --git a/benchmarks/c/miscellaneous/verifierAssert.c b/benchmarks/miscellaneous/verifierAssert.c similarity index 100% rename from benchmarks/c/miscellaneous/verifierAssert.c rename to benchmarks/miscellaneous/verifierAssert.c diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/NormalizeLoops.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/NormalizeLoops.java index 62e4b1ef18..0922e5013b 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/NormalizeLoops.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/NormalizeLoops.java @@ -1,46 +1,97 @@ package com.dat3m.dartagnan.program.processing; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.type.IntegerType; +import com.dat3m.dartagnan.expression.type.TypeFactory; import com.dat3m.dartagnan.program.Function; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.analysis.SyntacticContextAnalysis; +import com.dat3m.dartagnan.program.event.Event; import com.dat3m.dartagnan.program.event.EventFactory; import com.dat3m.dartagnan.program.event.core.CondJump; import com.dat3m.dartagnan.program.event.core.Label; +import com.dat3m.dartagnan.program.event.core.Local; +import java.util.ArrayList; import java.util.List; import java.util.Map; /* - This pass transforms loops to have a single backjump using forward jumping. - Given a loop of the form + This pass normalizes loops to have a single unconditional backjump and a single entry point. + It achieves this via two transformations. - L: - ... - if X goto L - ... - if Y goto L - More Code + (1) Given a loop of the form + + entry: + ... + goto C + ... + L: + ... + C: + ... + goto L it transforms it to - L: - ... - if X goto __repeatLoop_L - ... - if Y goto __repeatLoop_L - goto __breakLoop_L - __repeatLoop_L: - goto L - __breakLoop_L - More Code - ... + entry: + __loopEntryPoint_L <- 0 + ... + __loopEntryPoint_L <- 1 + goto L + ... + L: + __forwardTo_L <- __loopEntryPoint_L + __loopEntryPoint_L <- 0 + if __forwardTo_L == 1 goto C + ... + C: + ... + goto L + + (2) Given a loop of the form + + L: + ... + if X goto L + ... + if Y goto L + More Code + + it transforms it to + + L: + ... + if X goto __repeatLoop_L + ... + if Y goto __repeatLoop_L + goto __breakLoop_L + __repeatLoop_L: + goto L + __breakLoop_L + More Code + ... */ public class NormalizeLoops implements FunctionProcessor { + private final TypeFactory types = TypeFactory.getInstance(); + private final ExpressionFactory expressions = ExpressionFactory.getInstance(); + public static NormalizeLoops newInstance() { return new NormalizeLoops(); } @Override public void run(Function function) { + + guaranteeSingleEntry(function); + IdReassignment.newInstance().run(function); + guaranteeSingleUnconditionalBackjump(function); + + } + + private void guaranteeSingleUnconditionalBackjump(Function function) { int counter = 0; for (Label label : function.getEvents(Label.class)) { final List backJumps = label.getJumpSet().stream() @@ -70,4 +121,83 @@ public void run(Function function) { counter++; } } + + private void guaranteeSingleEntry(Function function) { + int loopCounter = 0; + for (Label loopBegin : function.getEvents(Label.class)) { + final List backJumps = loopBegin.getJumpSet().stream() + .filter(j -> j.getLocalId() > loopBegin.getLocalId()) + .sorted() + .toList(); + if (backJumps.isEmpty()) { + continue; + } + + final CondJump loopEnd = backJumps.get(backJumps.size() - 1); + final List
- + junit junit ${junit.version} test + + org.mockito + mockito-core + ${mockito.version} + test + diff --git a/dartagnan/src/main/antlr4/Spirv.g4 b/dartagnan/src/main/antlr4/Spirv.g4 index 49a2208f3b..c0abbd8c14 100644 --- a/dartagnan/src/main/antlr4/Spirv.g4 +++ b/dartagnan/src/main/antlr4/Spirv.g4 @@ -2,903 +2,62 @@ grammar Spirv; options { tokenVocab = SpirvLexer; } -spv : (op | opRet)* EOF; -opRet : idResult Equals opWithRet; - -// Annotation Operations -opDecorate : Op Decorate targetIdRef decoration; -opMemberDecorate : Op MemberDecorate structureType member decoration; -opDecorationGroup : (Op DecorationGroup | DecorationGroup); -opGroupDecorate : Op GroupDecorate decorationGroup targetsIdRef*; -opGroupMemberDecorate : Op GroupMemberDecorate decorationGroup targetsPairIdRefLiteralInteger*; -opDecorateId : Op DecorateId targetIdRef decoration; -opDecorateString : Op DecorateString targetIdRef decoration; -opDecorateStringGOOGLE : Op DecorateStringGOOGLE targetIdRef decoration; -opMemberDecorateString : Op MemberDecorateString structType member decoration; -opMemberDecorateStringGOOGLE : Op MemberDecorateStringGOOGLE structType member decoration; - -// Arithmetic Operations -opSNegate : (Op SNegate idResultType | SNegate) operand; -opFNegate : (Op FNegate idResultType | FNegate) operand; -opIAdd : (Op IAdd idResultType | IAdd) operand1 operand2; -opFAdd : (Op FAdd idResultType | FAdd) operand1 operand2; -opISub : (Op ISub idResultType | ISub) operand1 operand2; -opFSub : (Op FSub idResultType | FSub) operand1 operand2; -opIMul : (Op IMul idResultType | IMul) operand1 operand2; -opFMul : (Op FMul idResultType | FMul) operand1 operand2; -opUDiv : (Op UDiv idResultType | UDiv) operand1 operand2; -opSDiv : (Op SDiv idResultType | SDiv) operand1 operand2; -opFDiv : (Op FDiv idResultType | FDiv) operand1 operand2; -opUMod : (Op UMod idResultType | UMod) operand1 operand2; -opSRem : (Op SRem idResultType | SRem) operand1 operand2; -opSMod : (Op SMod idResultType | SMod) operand1 operand2; -opFRem : (Op FRem idResultType | FRem) operand1 operand2; -opFMod : (Op FMod idResultType | FMod) operand1 operand2; -opVectorTimesScalar : (Op VectorTimesScalar idResultType | VectorTimesScalar) vectorIdRef scalar; -opMatrixTimesScalar : (Op MatrixTimesScalar idResultType | MatrixTimesScalar) matrix scalar; -opVectorTimesMatrix : (Op VectorTimesMatrix idResultType | VectorTimesMatrix) vectorIdRef matrix; -opMatrixTimesVector : (Op MatrixTimesVector idResultType | MatrixTimesVector) matrix vectorIdRef; -opMatrixTimesMatrix : (Op MatrixTimesMatrix idResultType | MatrixTimesMatrix) leftMatrix rightMatrix; -opOuterProduct : (Op OuterProduct idResultType | OuterProduct) vector1 vector2; -opDot : (Op Dot idResultType | Dot) vector1 vector2; -opIAddCarry : (Op IAddCarry idResultType | IAddCarry) operand1 operand2; -opISubBorrow : (Op ISubBorrow idResultType | ISubBorrow) operand1 operand2; -opUMulExtended : (Op UMulExtended idResultType | UMulExtended) operand1 operand2; -opSMulExtended : (Op SMulExtended idResultType | SMulExtended) operand1 operand2; -opSDot : (Op SDot idResultType | SDot) vector1 vector2 packedVectorFormat?; -opSDotKHR : (Op SDotKHR idResultType | SDotKHR) vector1 vector2 packedVectorFormat?; -opUDot : (Op UDot idResultType | UDot) vector1 vector2 packedVectorFormat?; -opUDotKHR : (Op UDotKHR idResultType | UDotKHR) vector1 vector2 packedVectorFormat?; -opSUDot : (Op SUDot idResultType | SUDot) vector1 vector2 packedVectorFormat?; -opSUDotKHR : (Op SUDotKHR idResultType | SUDotKHR) vector1 vector2 packedVectorFormat?; -opSDotAccSat : (Op SDotAccSat idResultType | SDotAccSat) vector1 vector2 accumulator packedVectorFormat?; -opSDotAccSatKHR : (Op SDotAccSatKHR idResultType | SDotAccSatKHR) vector1 vector2 accumulator packedVectorFormat?; -opUDotAccSat : (Op UDotAccSat idResultType | UDotAccSat) vector1 vector2 accumulator packedVectorFormat?; -opUDotAccSatKHR : (Op UDotAccSatKHR idResultType | UDotAccSatKHR) vector1 vector2 accumulator packedVectorFormat?; -opSUDotAccSat : (Op SUDotAccSat idResultType | SUDotAccSat) vector1 vector2 accumulator packedVectorFormat?; -opSUDotAccSatKHR : (Op SUDotAccSatKHR idResultType | SUDotAccSatKHR) vector1 vector2 accumulator packedVectorFormat?; -opCooperativeMatrixMulAddKHR : (Op CooperativeMatrixMulAddKHR idResultType | CooperativeMatrixMulAddKHR) a b c cooperativeMatrixOperands?; - -// Atomic Operations -opAtomicLoad : (Op AtomicLoad idResultType | AtomicLoad) pointer memory semantics; -opAtomicStore : Op AtomicStore pointer memory semantics valueIdRef; -opAtomicExchange : (Op AtomicExchange idResultType | AtomicExchange) pointer memory semantics valueIdRef; -opAtomicCompareExchange : (Op AtomicCompareExchange idResultType | AtomicCompareExchange) pointer memory equal unequal valueIdRef comparator; -opAtomicCompareExchangeWeak : (Op AtomicCompareExchangeWeak idResultType | AtomicCompareExchangeWeak) pointer memory equal unequal valueIdRef comparator; -opAtomicIIncrement : (Op AtomicIIncrement idResultType | AtomicIIncrement) pointer memory semantics; -opAtomicIDecrement : (Op AtomicIDecrement idResultType | AtomicIDecrement) pointer memory semantics; -opAtomicIAdd : (Op AtomicIAdd idResultType | AtomicIAdd) pointer memory semantics valueIdRef; -opAtomicISub : (Op AtomicISub idResultType | AtomicISub) pointer memory semantics valueIdRef; -opAtomicSMin : (Op AtomicSMin idResultType | AtomicSMin) pointer memory semantics valueIdRef; -opAtomicUMin : (Op AtomicUMin idResultType | AtomicUMin) pointer memory semantics valueIdRef; -opAtomicSMax : (Op AtomicSMax idResultType | AtomicSMax) pointer memory semantics valueIdRef; -opAtomicUMax : (Op AtomicUMax idResultType | AtomicUMax) pointer memory semantics valueIdRef; -opAtomicAnd : (Op AtomicAnd idResultType | AtomicAnd) pointer memory semantics valueIdRef; -opAtomicOr : (Op AtomicOr idResultType | AtomicOr) pointer memory semantics valueIdRef; -opAtomicXor : (Op AtomicXor idResultType | AtomicXor) pointer memory semantics valueIdRef; -opAtomicFlagTestAndSet : (Op AtomicFlagTestAndSet idResultType | AtomicFlagTestAndSet) pointer memory semantics; -opAtomicFlagClear : Op AtomicFlagClear pointer memory semantics; -opAtomicFMinEXT : (Op AtomicFMinEXT idResultType | AtomicFMinEXT) pointer memory semantics valueIdRef; -opAtomicFMaxEXT : (Op AtomicFMaxEXT idResultType | AtomicFMaxEXT) pointer memory semantics valueIdRef; -opAtomicFAddEXT : (Op AtomicFAddEXT idResultType | AtomicFAddEXT) pointer memory semantics valueIdRef; - -// Barrier Operations -opControlBarrier : Op ControlBarrier execution memory semantics; -opMemoryBarrier : Op MemoryBarrier memory semantics; -opNamedBarrierInitialize : (Op NamedBarrierInitialize idResultType | NamedBarrierInitialize) subgroupCount; -opMemoryNamedBarrier : Op MemoryNamedBarrier namedBarrier memory semantics; -opControlBarrierArriveINTEL : Op ControlBarrierArriveINTEL execution memory semantics; -opControlBarrierWaitINTEL : Op ControlBarrierWaitINTEL execution memory semantics; - -// Bit Operations -opShiftRightLogical : (Op ShiftRightLogical idResultType | ShiftRightLogical) base shift; -opShiftRightArithmetic : (Op ShiftRightArithmetic idResultType | ShiftRightArithmetic) base shift; -opShiftLeftLogical : (Op ShiftLeftLogical idResultType | ShiftLeftLogical) base shift; -opBitwiseOr : (Op BitwiseOr idResultType | BitwiseOr) operand1 operand2; -opBitwiseXor : (Op BitwiseXor idResultType | BitwiseXor) operand1 operand2; -opBitwiseAnd : (Op BitwiseAnd idResultType | BitwiseAnd) operand1 operand2; -opNot : (Op Not idResultType | Not) operand; -opBitFieldInsert : (Op BitFieldInsert idResultType | BitFieldInsert) base insert offsetIdRef count; -opBitFieldSExtract : (Op BitFieldSExtract idResultType | BitFieldSExtract) base offsetIdRef count; -opBitFieldUExtract : (Op BitFieldUExtract idResultType | BitFieldUExtract) base offsetIdRef count; -opBitReverse : (Op BitReverse idResultType | BitReverse) base; -opBitCount : (Op BitCount idResultType | BitCount) base; - -// Composite Operations -opVectorExtractDynamic : (Op VectorExtractDynamic idResultType | VectorExtractDynamic) vectorIdRef indexIdRef; -opVectorInsertDynamic : (Op VectorInsertDynamic idResultType | VectorInsertDynamic) vectorIdRef componentIdRef indexIdRef; -opVectorShuffle : (Op VectorShuffle idResultType | VectorShuffle) vector1 vector2 components*; -opCompositeConstruct : (Op CompositeConstruct idResultType | CompositeConstruct) constituents*; -opCompositeExtract : (Op CompositeExtract idResultType | CompositeExtract) composite indexesLiteralInteger*; -opCompositeInsert : (Op CompositeInsert idResultType | CompositeInsert) object composite indexesLiteralInteger*; -opCopyObject : (Op CopyObject idResultType | CopyObject) operand; -opTranspose : (Op Transpose idResultType | Transpose) matrix; -opCopyLogical : (Op CopyLogical idResultType | CopyLogical) operand; -opCompositeConstructContinuedINTEL : (Op CompositeConstructContinuedINTEL idResultType | CompositeConstructContinuedINTEL) constituents*; - -// Constant-Creation Operations -opConstantTrue : (Op ConstantTrue idResultType | ConstantTrue); -opConstantFalse : (Op ConstantFalse idResultType | ConstantFalse); -opConstant : (Op Constant idResultType | Constant) valueLiteralContextDependentNumber; -opConstantComposite : (Op ConstantComposite idResultType | ConstantComposite) constituents*; -opConstantSampler : (Op ConstantSampler idResultType | ConstantSampler) samplerAddressingMode paramLiteralInteger samplerFilterMode; -opConstantNull : (Op ConstantNull idResultType | ConstantNull); -opSpecConstantTrue : (Op SpecConstantTrue idResultType | SpecConstantTrue); -opSpecConstantFalse : (Op SpecConstantFalse idResultType | SpecConstantFalse); -opSpecConstant : (Op SpecConstant idResultType | SpecConstant) valueLiteralContextDependentNumber; -opSpecConstantComposite : (Op SpecConstantComposite idResultType | SpecConstantComposite) constituents*; -opSpecConstantOp : (Op SpecConstantOp idResultType | SpecConstantOp) opcode; -opConstantCompositeContinuedINTEL : Op ConstantCompositeContinuedINTEL constituents*; -opSpecConstantCompositeContinuedINTEL : Op SpecConstantCompositeContinuedINTEL constituents*; - -// Control-Flow Operations -opPhi : (Op Phi idResultType | Phi) variable*; -opLoopMerge : Op LoopMerge mergeBlock continueTarget loopControl; -opSelectionMerge : Op SelectionMerge mergeBlock selectionControl; -opLabel : (Op Label | Label); -opBranch : Op Branch targetLabel; -opBranchConditional : Op BranchConditional condition trueLabel falseLabel branchWeights*; -opSwitch : Op Switch selector default targetPairLiteralIntegerIdRef*; -opKill : Op Kill; -opReturn : Op Return; -opReturnValue : Op ReturnValue valueIdRef; -opUnreachable : Op Unreachable; -opLifetimeStart : Op LifetimeStart pointer sizeLiteralInteger; -opLifetimeStop : Op LifetimeStop pointer sizeLiteralInteger; -opTerminateInvocation : Op TerminateInvocation; -opDemoteToHelperInvocation : Op DemoteToHelperInvocation; -opDemoteToHelperInvocationEXT : Op DemoteToHelperInvocationEXT; - -// Conversion Operations -opConvertFToU : (Op ConvertFToU idResultType | ConvertFToU) floatValue; -opConvertFToS : (Op ConvertFToS idResultType | ConvertFToS) floatValue; -opConvertSToF : (Op ConvertSToF idResultType | ConvertSToF) signedValue; -opConvertUToF : (Op ConvertUToF idResultType | ConvertUToF) unsignedValue; -opUConvert : (Op UConvert idResultType | UConvert) unsignedValue; -opSConvert : (Op SConvert idResultType | SConvert) signedValue; -opFConvert : (Op FConvert idResultType | FConvert) floatValue; -opQuantizeToF16 : (Op QuantizeToF16 idResultType | QuantizeToF16) valueIdRef; -opConvertPtrToU : (Op ConvertPtrToU idResultType | ConvertPtrToU) pointer; -opSatConvertSToU : (Op SatConvertSToU idResultType | SatConvertSToU) signedValue; -opSatConvertUToS : (Op SatConvertUToS idResultType | SatConvertUToS) unsignedValue; -opConvertUToPtr : (Op ConvertUToPtr idResultType | ConvertUToPtr) integerValue; -opPtrCastToGeneric : (Op PtrCastToGeneric idResultType | PtrCastToGeneric) pointer; -opGenericCastToPtr : (Op GenericCastToPtr idResultType | GenericCastToPtr) pointer; -opGenericCastToPtrExplicit : (Op GenericCastToPtrExplicit idResultType | GenericCastToPtrExplicit) pointer storage; -opBitcast : (Op Bitcast idResultType | Bitcast) operand; -opConvertFToBF16INTEL : (Op ConvertFToBF16INTEL idResultType | ConvertFToBF16INTEL) floatValue; -opConvertBF16ToFINTEL : (Op ConvertBF16ToFINTEL idResultType | ConvertBF16ToFINTEL) bFloat16Value; - -// Debug Operations -opSourceContinued : Op SourceContinued continuedSource; -opSource : Op Source sourceLanguage version file? sourceLiteralString?; -opSourceExtension : Op SourceExtension extension; -opName : Op Name targetIdRef nameLiteralString; -opMemberName : Op MemberName type member nameLiteralString; -opString : (Op String | String) string; -opLine : Op Line file line column; -opNoLine : Op NoLine; -opModuleProcessed : Op ModuleProcessed process; - -// Derivative Operations -opDPdx : (Op DPdx idResultType | DPdx) p; -opDPdy : (Op DPdy idResultType | DPdy) p; -opFwidth : (Op Fwidth idResultType | Fwidth) p; -opDPdxFine : (Op DPdxFine idResultType | DPdxFine) p; -opDPdyFine : (Op DPdyFine idResultType | DPdyFine) p; -opFwidthFine : (Op FwidthFine idResultType | FwidthFine) p; -opDPdxCoarse : (Op DPdxCoarse idResultType | DPdxCoarse) p; -opDPdyCoarse : (Op DPdyCoarse idResultType | DPdyCoarse) p; -opFwidthCoarse : (Op FwidthCoarse idResultType | FwidthCoarse) p; - -// Device-Side_Enqueue Operations -opEnqueueMarker : (Op EnqueueMarker idResultType | EnqueueMarker) queue numEvents waitEvents retEvent; -opEnqueueKernel : (Op EnqueueKernel idResultType | EnqueueKernel) queue flags nDRange numEvents waitEvents retEvent invoke paramIdRef paramSize paramAlign localSize*; -opGetKernelNDrangeSubGroupCount : (Op GetKernelNDrangeSubGroupCount idResultType | GetKernelNDrangeSubGroupCount) nDRange invoke paramIdRef paramSize paramAlign; -opGetKernelNDrangeMaxSubGroupSize : (Op GetKernelNDrangeMaxSubGroupSize idResultType | GetKernelNDrangeMaxSubGroupSize) nDRange invoke paramIdRef paramSize paramAlign; -opGetKernelWorkGroupSize : (Op GetKernelWorkGroupSize idResultType | GetKernelWorkGroupSize) invoke paramIdRef paramSize paramAlign; -opGetKernelPreferredWorkGroupSizeMultiple : (Op GetKernelPreferredWorkGroupSizeMultiple idResultType | GetKernelPreferredWorkGroupSizeMultiple) invoke paramIdRef paramSize paramAlign; -opRetainEvent : Op RetainEvent event; -opReleaseEvent : Op ReleaseEvent event; -opCreateUserEvent : (Op CreateUserEvent idResultType | CreateUserEvent); -opIsValidEvent : (Op IsValidEvent idResultType | IsValidEvent) event; -opSetUserEventStatus : Op SetUserEventStatus event status; -opCaptureEventProfilingInfo : Op CaptureEventProfilingInfo event profilingInfo valueIdRef; -opGetDefaultQueue : (Op GetDefaultQueue idResultType | GetDefaultQueue); -opBuildNDRange : (Op BuildNDRange idResultType | BuildNDRange) globalWorkSize localWorkSize globalWorkOffset; -opGetKernelLocalSizeForSubgroupCount : (Op GetKernelLocalSizeForSubgroupCount idResultType | GetKernelLocalSizeForSubgroupCount) subgroupCount invoke paramIdRef paramSize paramAlign; -opGetKernelMaxNumSubgroups : (Op GetKernelMaxNumSubgroups idResultType | GetKernelMaxNumSubgroups) invoke paramIdRef paramSize paramAlign; - -// Extension Operations -opExtension : Op Extension nameLiteralString; -opExtInstImport : (Op ExtInstImport | ExtInstImport) nameLiteralString; -opExtInst : (Op ExtInst idResultType | ExtInst) set instruction operand*; - -// Function Operations -opFunction : (Op Function idResultType | Function) functionControl functionType; -opFunctionParameter : (Op FunctionParameter idResultType | FunctionParameter); -opFunctionEnd : Op FunctionEnd; -opFunctionCall : (Op FunctionCall idResultType | FunctionCall) function argument*; - -// Group Operations -opGroupAsyncCopy : (Op GroupAsyncCopy idResultType | GroupAsyncCopy) execution destination sourceIdRef numElements stride event; -opGroupWaitEvents : Op GroupWaitEvents execution numEvents eventsList; -opGroupAll : (Op GroupAll idResultType | GroupAll) execution predicate; -opGroupAny : (Op GroupAny idResultType | GroupAny) execution predicate; -opGroupBroadcast : (Op GroupBroadcast idResultType | GroupBroadcast) execution valueIdRef localId; -opGroupIAdd : (Op GroupIAdd idResultType | GroupIAdd) execution operation x; -opGroupFAdd : (Op GroupFAdd idResultType | GroupFAdd) execution operation x; -opGroupFMin : (Op GroupFMin idResultType | GroupFMin) execution operation x; -opGroupUMin : (Op GroupUMin idResultType | GroupUMin) execution operation x; -opGroupSMin : (Op GroupSMin idResultType | GroupSMin) execution operation x; -opGroupFMax : (Op GroupFMax idResultType | GroupFMax) execution operation x; -opGroupUMax : (Op GroupUMax idResultType | GroupUMax) execution operation x; -opGroupSMax : (Op GroupSMax idResultType | GroupSMax) execution operation x; -opSubgroupBallotKHR : (Op SubgroupBallotKHR idResultType | SubgroupBallotKHR) predicate; -opSubgroupFirstInvocationKHR : (Op SubgroupFirstInvocationKHR idResultType | SubgroupFirstInvocationKHR) valueIdRef; -opSubgroupAllKHR : (Op SubgroupAllKHR idResultType | SubgroupAllKHR) predicate; -opSubgroupAnyKHR : (Op SubgroupAnyKHR idResultType | SubgroupAnyKHR) predicate; -opSubgroupAllEqualKHR : (Op SubgroupAllEqualKHR idResultType | SubgroupAllEqualKHR) predicate; -opGroupNonUniformRotateKHR : (Op GroupNonUniformRotateKHR idResultType | GroupNonUniformRotateKHR) execution valueIdRef delta clusterSize?; -opSubgroupReadInvocationKHR : (Op SubgroupReadInvocationKHR idResultType | SubgroupReadInvocationKHR) valueIdRef indexIdRef; -opGroupIAddNonUniformAMD : (Op GroupIAddNonUniformAMD idResultType | GroupIAddNonUniformAMD) execution operation x; -opGroupFAddNonUniformAMD : (Op GroupFAddNonUniformAMD idResultType | GroupFAddNonUniformAMD) execution operation x; -opGroupFMinNonUniformAMD : (Op GroupFMinNonUniformAMD idResultType | GroupFMinNonUniformAMD) execution operation x; -opGroupUMinNonUniformAMD : (Op GroupUMinNonUniformAMD idResultType | GroupUMinNonUniformAMD) execution operation x; -opGroupSMinNonUniformAMD : (Op GroupSMinNonUniformAMD idResultType | GroupSMinNonUniformAMD) execution operation x; -opGroupFMaxNonUniformAMD : (Op GroupFMaxNonUniformAMD idResultType | GroupFMaxNonUniformAMD) execution operation x; -opGroupUMaxNonUniformAMD : (Op GroupUMaxNonUniformAMD idResultType | GroupUMaxNonUniformAMD) execution operation x; -opGroupSMaxNonUniformAMD : (Op GroupSMaxNonUniformAMD idResultType | GroupSMaxNonUniformAMD) execution operation x; -opSubgroupShuffleINTEL : (Op SubgroupShuffleINTEL idResultType | SubgroupShuffleINTEL) data invocationId; -opSubgroupShuffleDownINTEL : (Op SubgroupShuffleDownINTEL idResultType | SubgroupShuffleDownINTEL) current next delta; -opSubgroupShuffleUpINTEL : (Op SubgroupShuffleUpINTEL idResultType | SubgroupShuffleUpINTEL) previous current delta; -opSubgroupShuffleXorINTEL : (Op SubgroupShuffleXorINTEL idResultType | SubgroupShuffleXorINTEL) data valueIdRef; -opSubgroupBlockReadINTEL : (Op SubgroupBlockReadINTEL idResultType | SubgroupBlockReadINTEL) ptr; -opSubgroupBlockWriteINTEL : Op SubgroupBlockWriteINTEL ptr data; -opSubgroupImageBlockReadINTEL : (Op SubgroupImageBlockReadINTEL idResultType | SubgroupImageBlockReadINTEL) image coordinate; -opSubgroupImageBlockWriteINTEL : Op SubgroupImageBlockWriteINTEL image coordinate data; -opSubgroupImageMediaBlockReadINTEL : (Op SubgroupImageMediaBlockReadINTEL idResultType | SubgroupImageMediaBlockReadINTEL) image coordinate widthIdRef height; -opSubgroupImageMediaBlockWriteINTEL : Op SubgroupImageMediaBlockWriteINTEL image coordinate widthIdRef height data; -opGroupIMulKHR : (Op GroupIMulKHR idResultType | GroupIMulKHR) execution operation x; -opGroupFMulKHR : (Op GroupFMulKHR idResultType | GroupFMulKHR) execution operation x; -opGroupBitwiseAndKHR : (Op GroupBitwiseAndKHR idResultType | GroupBitwiseAndKHR) execution operation x; -opGroupBitwiseOrKHR : (Op GroupBitwiseOrKHR idResultType | GroupBitwiseOrKHR) execution operation x; -opGroupBitwiseXorKHR : (Op GroupBitwiseXorKHR idResultType | GroupBitwiseXorKHR) execution operation x; -opGroupLogicalAndKHR : (Op GroupLogicalAndKHR idResultType | GroupLogicalAndKHR) execution operation x; -opGroupLogicalOrKHR : (Op GroupLogicalOrKHR idResultType | GroupLogicalOrKHR) execution operation x; -opGroupLogicalXorKHR : (Op GroupLogicalXorKHR idResultType | GroupLogicalXorKHR) execution operation x; - -// Image Operations -opSampledImage : (Op SampledImage idResultType | SampledImage) image sampler; -opImageSampleImplicitLod : (Op ImageSampleImplicitLod idResultType | ImageSampleImplicitLod) sampledImage coordinate imageOperands?; -opImageSampleExplicitLod : (Op ImageSampleExplicitLod idResultType | ImageSampleExplicitLod) sampledImage coordinate imageOperands; -opImageSampleDrefImplicitLod : (Op ImageSampleDrefImplicitLod idResultType | ImageSampleDrefImplicitLod) sampledImage coordinate d imageOperands?; -opImageSampleDrefExplicitLod : (Op ImageSampleDrefExplicitLod idResultType | ImageSampleDrefExplicitLod) sampledImage coordinate d imageOperands; -opImageSampleProjImplicitLod : (Op ImageSampleProjImplicitLod idResultType | ImageSampleProjImplicitLod) sampledImage coordinate imageOperands?; -opImageSampleProjExplicitLod : (Op ImageSampleProjExplicitLod idResultType | ImageSampleProjExplicitLod) sampledImage coordinate imageOperands; -opImageSampleProjDrefImplicitLod : (Op ImageSampleProjDrefImplicitLod idResultType | ImageSampleProjDrefImplicitLod) sampledImage coordinate d imageOperands?; -opImageSampleProjDrefExplicitLod : (Op ImageSampleProjDrefExplicitLod idResultType | ImageSampleProjDrefExplicitLod) sampledImage coordinate d imageOperands; -opImageFetch : (Op ImageFetch idResultType | ImageFetch) image coordinate imageOperands?; -opImageGather : (Op ImageGather idResultType | ImageGather) sampledImage coordinate componentIdRef imageOperands?; -opImageDrefGather : (Op ImageDrefGather idResultType | ImageDrefGather) sampledImage coordinate d imageOperands?; -opImageRead : (Op ImageRead idResultType | ImageRead) image coordinate imageOperands?; -opImageWrite : Op ImageWrite image coordinate texel imageOperands?; -opImage : (Op Image idResultType | Image) sampledImage; -opImageQueryFormat : (Op ImageQueryFormat idResultType | ImageQueryFormat) image; -opImageQueryOrder : (Op ImageQueryOrder idResultType | ImageQueryOrder) image; -opImageQuerySizeLod : (Op ImageQuerySizeLod idResultType | ImageQuerySizeLod) image levelOfDetail; -opImageQuerySize : (Op ImageQuerySize idResultType | ImageQuerySize) image; -opImageQueryLod : (Op ImageQueryLod idResultType | ImageQueryLod) sampledImage coordinate; -opImageQueryLevels : (Op ImageQueryLevels idResultType | ImageQueryLevels) image; -opImageQuerySamples : (Op ImageQuerySamples idResultType | ImageQuerySamples) image; -opImageSparseSampleImplicitLod : (Op ImageSparseSampleImplicitLod idResultType | ImageSparseSampleImplicitLod) sampledImage coordinate imageOperands?; -opImageSparseSampleExplicitLod : (Op ImageSparseSampleExplicitLod idResultType | ImageSparseSampleExplicitLod) sampledImage coordinate imageOperands; -opImageSparseSampleDrefImplicitLod : (Op ImageSparseSampleDrefImplicitLod idResultType | ImageSparseSampleDrefImplicitLod) sampledImage coordinate d imageOperands?; -opImageSparseSampleDrefExplicitLod : (Op ImageSparseSampleDrefExplicitLod idResultType | ImageSparseSampleDrefExplicitLod) sampledImage coordinate d imageOperands; -opImageSparseSampleProjImplicitLod : (Op ImageSparseSampleProjImplicitLod idResultType | ImageSparseSampleProjImplicitLod) sampledImage coordinate imageOperands?; -opImageSparseSampleProjExplicitLod : (Op ImageSparseSampleProjExplicitLod idResultType | ImageSparseSampleProjExplicitLod) sampledImage coordinate imageOperands; -opImageSparseSampleProjDrefImplicitLod : (Op ImageSparseSampleProjDrefImplicitLod idResultType | ImageSparseSampleProjDrefImplicitLod) sampledImage coordinate d imageOperands?; -opImageSparseSampleProjDrefExplicitLod : (Op ImageSparseSampleProjDrefExplicitLod idResultType | ImageSparseSampleProjDrefExplicitLod) sampledImage coordinate d imageOperands; -opImageSparseFetch : (Op ImageSparseFetch idResultType | ImageSparseFetch) image coordinate imageOperands?; -opImageSparseGather : (Op ImageSparseGather idResultType | ImageSparseGather) sampledImage coordinate componentIdRef imageOperands?; -opImageSparseDrefGather : (Op ImageSparseDrefGather idResultType | ImageSparseDrefGather) sampledImage coordinate d imageOperands?; -opImageSparseTexelsResident : (Op ImageSparseTexelsResident idResultType | ImageSparseTexelsResident) residentCode; -opImageSparseRead : (Op ImageSparseRead idResultType | ImageSparseRead) image coordinate imageOperands?; -opColorAttachmentReadEXT : (Op ColorAttachmentReadEXT idResultType | ColorAttachmentReadEXT) attachment sample?; -opDepthAttachmentReadEXT : (Op DepthAttachmentReadEXT idResultType | DepthAttachmentReadEXT) sample?; -opStencilAttachmentReadEXT : (Op StencilAttachmentReadEXT idResultType | StencilAttachmentReadEXT) sample?; -opImageSampleWeightedQCOM : (Op ImageSampleWeightedQCOM idResultType | ImageSampleWeightedQCOM) texture coordinates weights; -opImageBoxFilterQCOM : (Op ImageBoxFilterQCOM idResultType | ImageBoxFilterQCOM) texture coordinates boxSize; -opImageBlockMatchSSDQCOM : (Op ImageBlockMatchSSDQCOM idResultType | ImageBlockMatchSSDQCOM) targetIdRef targetCoordinates reference referenceCoordinates blockSize; -opImageBlockMatchSADQCOM : (Op ImageBlockMatchSADQCOM idResultType | ImageBlockMatchSADQCOM) targetIdRef targetCoordinates reference referenceCoordinates blockSize; -opImageSampleFootprintNV : (Op ImageSampleFootprintNV idResultType | ImageSampleFootprintNV) sampledImage coordinate granularity coarse imageOperands?; - -// Memory Operations -opVariable : (Op Variable idResultType | Variable) storageClass initializer?; -opImageTexelPointer : (Op ImageTexelPointer idResultType | ImageTexelPointer) image coordinate sample; -opLoad : (Op Load idResultType | Load) pointer memoryAccess?; -opStore : Op Store pointer object memoryAccess?; -opCopyMemory : Op CopyMemory targetIdRef sourceIdRef memoryAccess? memoryAccess?; -opCopyMemorySized : Op CopyMemorySized targetIdRef sourceIdRef sizeIdRef memoryAccess? memoryAccess?; -opAccessChain : (Op AccessChain idResultType | AccessChain) base indexesIdRef*; -opInBoundsAccessChain : (Op InBoundsAccessChain idResultType | InBoundsAccessChain) base indexesIdRef*; -opPtrAccessChain : (Op PtrAccessChain idResultType | PtrAccessChain) base element indexesIdRef*; -opArrayLength : (Op ArrayLength idResultType | ArrayLength) structure arrayMember; -opGenericPtrMemSemantics : (Op GenericPtrMemSemantics idResultType | GenericPtrMemSemantics) pointer; -opInBoundsPtrAccessChain : (Op InBoundsPtrAccessChain idResultType | InBoundsPtrAccessChain) base element indexesIdRef*; -opPtrEqual : (Op PtrEqual idResultType | PtrEqual) operand1 operand2; -opPtrNotEqual : (Op PtrNotEqual idResultType | PtrNotEqual) operand1 operand2; -opPtrDiff : (Op PtrDiff idResultType | PtrDiff) operand1 operand2; -opCooperativeMatrixLoadKHR : (Op CooperativeMatrixLoadKHR idResultType | CooperativeMatrixLoadKHR) pointer memoryLayout stride? memoryOperand?; -opCooperativeMatrixStoreKHR : Op CooperativeMatrixStoreKHR pointer object memoryLayout stride? memoryOperand?; -opMaskedGatherINTEL : (Op MaskedGatherINTEL idResultType | MaskedGatherINTEL) ptrVector alignmentLiteralInteger mask fillEmpty; -opMaskedScatterINTEL : Op MaskedScatterINTEL inputVector ptrVector alignmentLiteralInteger mask; - -// Miscellaneous Operations -opNop : Op Nop; -opUndef : (Op Undef idResultType | Undef); -opSizeOf : (Op SizeOf idResultType | SizeOf) pointer; -opCooperativeMatrixLengthKHR : (Op CooperativeMatrixLengthKHR idResultType | CooperativeMatrixLengthKHR) type; -opAssumeTrueKHR : Op AssumeTrueKHR condition; -opExpectKHR : (Op ExpectKHR idResultType | ExpectKHR) valueIdRef expectedValue; - -// Mode-Setting Operations -opMemoryModel : Op MemoryModel addressingModel memoryModel; -opEntryPoint : Op EntryPoint executionModel entryPoint nameLiteralString interface*; -opExecutionMode : Op ExecutionMode entryPoint modeExecutionMode; -opCapability : Op Capability capability; -opExecutionModeId : Op ExecutionModeId entryPoint modeExecutionMode; +spv : spvHeaders spvInstructions EOF; +spvInstructions : op*; + +// Header +spvHeaders : spvHeader*; +spvHeader + : inputHeader + | outputHeader + | configHeader + ; -// Non-Uniform Operations -opGroupNonUniformElect : (Op GroupNonUniformElect idResultType | GroupNonUniformElect) execution; -opGroupNonUniformAll : (Op GroupNonUniformAll idResultType | GroupNonUniformAll) execution predicate; -opGroupNonUniformAny : (Op GroupNonUniformAny idResultType | GroupNonUniformAny) execution predicate; -opGroupNonUniformAllEqual : (Op GroupNonUniformAllEqual idResultType | GroupNonUniformAllEqual) execution valueIdRef; -opGroupNonUniformBroadcast : (Op GroupNonUniformBroadcast idResultType | GroupNonUniformBroadcast) execution valueIdRef id; -opGroupNonUniformBroadcastFirst : (Op GroupNonUniformBroadcastFirst idResultType | GroupNonUniformBroadcastFirst) execution valueIdRef; -opGroupNonUniformBallot : (Op GroupNonUniformBallot idResultType | GroupNonUniformBallot) execution predicate; -opGroupNonUniformInverseBallot : (Op GroupNonUniformInverseBallot idResultType | GroupNonUniformInverseBallot) execution valueIdRef; -opGroupNonUniformBallotBitExtract : (Op GroupNonUniformBallotBitExtract idResultType | GroupNonUniformBallotBitExtract) execution valueIdRef indexIdRef; -opGroupNonUniformBallotBitCount : (Op GroupNonUniformBallotBitCount idResultType | GroupNonUniformBallotBitCount) execution operation valueIdRef; -opGroupNonUniformBallotFindLSB : (Op GroupNonUniformBallotFindLSB idResultType | GroupNonUniformBallotFindLSB) execution valueIdRef; -opGroupNonUniformBallotFindMSB : (Op GroupNonUniformBallotFindMSB idResultType | GroupNonUniformBallotFindMSB) execution valueIdRef; -opGroupNonUniformShuffle : (Op GroupNonUniformShuffle idResultType | GroupNonUniformShuffle) execution valueIdRef id; -opGroupNonUniformShuffleXor : (Op GroupNonUniformShuffleXor idResultType | GroupNonUniformShuffleXor) execution valueIdRef mask; -opGroupNonUniformShuffleUp : (Op GroupNonUniformShuffleUp idResultType | GroupNonUniformShuffleUp) execution valueIdRef delta; -opGroupNonUniformShuffleDown : (Op GroupNonUniformShuffleDown idResultType | GroupNonUniformShuffleDown) execution valueIdRef delta; -opGroupNonUniformIAdd : (Op GroupNonUniformIAdd idResultType | GroupNonUniformIAdd) execution operation valueIdRef clusterSize?; -opGroupNonUniformFAdd : (Op GroupNonUniformFAdd idResultType | GroupNonUniformFAdd) execution operation valueIdRef clusterSize?; -opGroupNonUniformIMul : (Op GroupNonUniformIMul idResultType | GroupNonUniformIMul) execution operation valueIdRef clusterSize?; -opGroupNonUniformFMul : (Op GroupNonUniformFMul idResultType | GroupNonUniformFMul) execution operation valueIdRef clusterSize?; -opGroupNonUniformSMin : (Op GroupNonUniformSMin idResultType | GroupNonUniformSMin) execution operation valueIdRef clusterSize?; -opGroupNonUniformUMin : (Op GroupNonUniformUMin idResultType | GroupNonUniformUMin) execution operation valueIdRef clusterSize?; -opGroupNonUniformFMin : (Op GroupNonUniformFMin idResultType | GroupNonUniformFMin) execution operation valueIdRef clusterSize?; -opGroupNonUniformSMax : (Op GroupNonUniformSMax idResultType | GroupNonUniformSMax) execution operation valueIdRef clusterSize?; -opGroupNonUniformUMax : (Op GroupNonUniformUMax idResultType | GroupNonUniformUMax) execution operation valueIdRef clusterSize?; -opGroupNonUniformFMax : (Op GroupNonUniformFMax idResultType | GroupNonUniformFMax) execution operation valueIdRef clusterSize?; -opGroupNonUniformBitwiseAnd : (Op GroupNonUniformBitwiseAnd idResultType | GroupNonUniformBitwiseAnd) execution operation valueIdRef clusterSize?; -opGroupNonUniformBitwiseOr : (Op GroupNonUniformBitwiseOr idResultType | GroupNonUniformBitwiseOr) execution operation valueIdRef clusterSize?; -opGroupNonUniformBitwiseXor : (Op GroupNonUniformBitwiseXor idResultType | GroupNonUniformBitwiseXor) execution operation valueIdRef clusterSize?; -opGroupNonUniformLogicalAnd : (Op GroupNonUniformLogicalAnd idResultType | GroupNonUniformLogicalAnd) execution operation valueIdRef clusterSize?; -opGroupNonUniformLogicalOr : (Op GroupNonUniformLogicalOr idResultType | GroupNonUniformLogicalOr) execution operation valueIdRef clusterSize?; -opGroupNonUniformLogicalXor : (Op GroupNonUniformLogicalXor idResultType | GroupNonUniformLogicalXor) execution operation valueIdRef clusterSize?; -opGroupNonUniformQuadBroadcast : (Op GroupNonUniformQuadBroadcast idResultType | GroupNonUniformQuadBroadcast) execution valueIdRef indexIdRef; -opGroupNonUniformQuadSwap : (Op GroupNonUniformQuadSwap idResultType | GroupNonUniformQuadSwap) execution valueIdRef direction; -opGroupNonUniformPartitionNV : (Op GroupNonUniformPartitionNV idResultType | GroupNonUniformPartitionNV) valueIdRef; +inputHeader : ModeHeader_Input ModeHeader_Colon initList; +outputHeader : ModeHeader_Output ModeHeader_Colon assertionList; +configHeader : ModeHeader_Config ModeHeader_Colon literanHeaderUnsignedInteger ModeHeader_Comma literanHeaderUnsignedInteger ModeHeader_Comma literanHeaderUnsignedInteger; +initList : init (ModeHeader_Comma init)*; +init : varName ModeHeader_Equal initValue; +initValue + : initCollectionValue + | initBaseValue + ; -// Pipe Operations -opReadPipe : (Op ReadPipe idResultType | ReadPipe) pipe pointer packetSizeIdRef packetAlignmentIdRef; -opWritePipe : (Op WritePipe idResultType | WritePipe) pipe pointer packetSizeIdRef packetAlignmentIdRef; -opReservedReadPipe : (Op ReservedReadPipe idResultType | ReservedReadPipe) pipe reserveId indexIdRef pointer packetSizeIdRef packetAlignmentIdRef; -opReservedWritePipe : (Op ReservedWritePipe idResultType | ReservedWritePipe) pipe reserveId indexIdRef pointer packetSizeIdRef packetAlignmentIdRef; -opReserveReadPipePackets : (Op ReserveReadPipePackets idResultType | ReserveReadPipePackets) pipe numPackets packetSizeIdRef packetAlignmentIdRef; -opReserveWritePipePackets : (Op ReserveWritePipePackets idResultType | ReserveWritePipePackets) pipe numPackets packetSizeIdRef packetAlignmentIdRef; -opCommitReadPipe : Op CommitReadPipe pipe reserveId packetSizeIdRef packetAlignmentIdRef; -opCommitWritePipe : Op CommitWritePipe pipe reserveId packetSizeIdRef packetAlignmentIdRef; -opIsValidReserveId : (Op IsValidReserveId idResultType | IsValidReserveId) reserveId; -opGetNumPipePackets : (Op GetNumPipePackets idResultType | GetNumPipePackets) pipe packetSizeIdRef packetAlignmentIdRef; -opGetMaxPipePackets : (Op GetMaxPipePackets idResultType | GetMaxPipePackets) pipe packetSizeIdRef packetAlignmentIdRef; -opGroupReserveReadPipePackets : (Op GroupReserveReadPipePackets idResultType | GroupReserveReadPipePackets) execution pipe numPackets packetSizeIdRef packetAlignmentIdRef; -opGroupReserveWritePipePackets : (Op GroupReserveWritePipePackets idResultType | GroupReserveWritePipePackets) execution pipe numPackets packetSizeIdRef packetAlignmentIdRef; -opGroupCommitReadPipe : Op GroupCommitReadPipe execution pipe reserveId packetSizeIdRef packetAlignmentIdRef; -opGroupCommitWritePipe : Op GroupCommitWritePipe execution pipe reserveId packetSizeIdRef packetAlignmentIdRef; -opConstantPipeStorage : (Op ConstantPipeStorage idResultType | ConstantPipeStorage) packetSizeLiteralInteger packetAlignmentLiteralInteger capacity; -opCreatePipeFromPipeStorage : (Op CreatePipeFromPipeStorage idResultType | CreatePipeFromPipeStorage) pipeStorage; -opReadPipeBlockingINTEL : (Op ReadPipeBlockingINTEL idResultType | ReadPipeBlockingINTEL) packetSizeIdRef packetAlignmentIdRef; -opWritePipeBlockingINTEL : (Op WritePipeBlockingINTEL idResultType | WritePipeBlockingINTEL) packetSizeIdRef packetAlignmentIdRef; +initCollectionValue : ModeHeader_LBrace initValues ModeHeader_RBrace; +initValues : initValue (ModeHeader_Comma initValue)*; +assertionList + : ModeHeader_AssertionExists assertion ModeHeader_Comma? + | ModeHeader_AssertionNot ModeHeader_AssertionExists assertion ModeHeader_Comma? + | ModeHeader_AssertionForall assertion ModeHeader_Comma? + ; -// Primitive Operations -opEmitVertex : Op EmitVertex; -opEndPrimitive : Op EndPrimitive; -opEmitStreamVertex : Op EmitStreamVertex stream; -opEndStreamPrimitive : Op EndStreamPrimitive stream; +assertion + : ModeHeader_LPar assertion ModeHeader_RPar # assertionParenthesis + | ModeHeader_AssertionNot assertion # assertionNot + | assertion ModeHeader_AssertionAnd assertion # assertionAnd + | assertion ModeHeader_AssertionOr assertion # assertionOr + | assertionValue assertionCompare assertionValue # assertionBasic + ; -// Relational_and_Logical Operations -opAny : (Op Any idResultType | Any) vectorIdRef; -opAll : (Op All idResultType | All) vectorIdRef; -opIsNan : (Op IsNan idResultType | IsNan) x; -opIsInf : (Op IsInf idResultType | IsInf) x; -opIsFinite : (Op IsFinite idResultType | IsFinite) x; -opIsNormal : (Op IsNormal idResultType | IsNormal) x; -opSignBitSet : (Op SignBitSet idResultType | SignBitSet) x; -opLessOrGreater : (Op LessOrGreater idResultType | LessOrGreater) x y; -opOrdered : (Op Ordered idResultType | Ordered) x y; -opUnordered : (Op Unordered idResultType | Unordered) x y; -opLogicalEqual : (Op LogicalEqual idResultType | LogicalEqual) operand1 operand2; -opLogicalNotEqual : (Op LogicalNotEqual idResultType | LogicalNotEqual) operand1 operand2; -opLogicalOr : (Op LogicalOr idResultType | LogicalOr) operand1 operand2; -opLogicalAnd : (Op LogicalAnd idResultType | LogicalAnd) operand1 operand2; -opLogicalNot : (Op LogicalNot idResultType | LogicalNot) operand; -opSelect : (Op Select idResultType | Select) condition object1 object2; -opIEqual : (Op IEqual idResultType | IEqual) operand1 operand2; -opINotEqual : (Op INotEqual idResultType | INotEqual) operand1 operand2; -opUGreaterThan : (Op UGreaterThan idResultType | UGreaterThan) operand1 operand2; -opSGreaterThan : (Op SGreaterThan idResultType | SGreaterThan) operand1 operand2; -opUGreaterThanEqual : (Op UGreaterThanEqual idResultType | UGreaterThanEqual) operand1 operand2; -opSGreaterThanEqual : (Op SGreaterThanEqual idResultType | SGreaterThanEqual) operand1 operand2; -opULessThan : (Op ULessThan idResultType | ULessThan) operand1 operand2; -opSLessThan : (Op SLessThan idResultType | SLessThan) operand1 operand2; -opULessThanEqual : (Op ULessThanEqual idResultType | ULessThanEqual) operand1 operand2; -opSLessThanEqual : (Op SLessThanEqual idResultType | SLessThanEqual) operand1 operand2; -opFOrdEqual : (Op FOrdEqual idResultType | FOrdEqual) operand1 operand2; -opFUnordEqual : (Op FUnordEqual idResultType | FUnordEqual) operand1 operand2; -opFOrdNotEqual : (Op FOrdNotEqual idResultType | FOrdNotEqual) operand1 operand2; -opFUnordNotEqual : (Op FUnordNotEqual idResultType | FUnordNotEqual) operand1 operand2; -opFOrdLessThan : (Op FOrdLessThan idResultType | FOrdLessThan) operand1 operand2; -opFUnordLessThan : (Op FUnordLessThan idResultType | FUnordLessThan) operand1 operand2; -opFOrdGreaterThan : (Op FOrdGreaterThan idResultType | FOrdGreaterThan) operand1 operand2; -opFUnordGreaterThan : (Op FUnordGreaterThan idResultType | FUnordGreaterThan) operand1 operand2; -opFOrdLessThanEqual : (Op FOrdLessThanEqual idResultType | FOrdLessThanEqual) operand1 operand2; -opFUnordLessThanEqual : (Op FUnordLessThanEqual idResultType | FUnordLessThanEqual) operand1 operand2; -opFOrdGreaterThanEqual : (Op FOrdGreaterThanEqual idResultType | FOrdGreaterThanEqual) operand1 operand2; -opFUnordGreaterThanEqual : (Op FUnordGreaterThanEqual idResultType | FUnordGreaterThanEqual) operand1 operand2; +assertionCompare + : ModeHeader_EqualEqual + | ModeHeader_NotEqual + | ModeHeader_GreaterEqual + | ModeHeader_LessEqual + | ModeHeader_Less + | ModeHeader_Greater + ; -// Reserved Operations -opTraceRayKHR : Op TraceRayKHR accel rayFlagsIdRef cullMask sBTOffset sBTStride missIndex rayOrigin rayTmin rayDirection rayTmax payload; -opExecuteCallableKHR : Op ExecuteCallableKHR sBTIndex callableData; -opConvertUToAccelerationStructureKHR : (Op ConvertUToAccelerationStructureKHR idResultType | ConvertUToAccelerationStructureKHR) accel; -opIgnoreIntersectionKHR : Op IgnoreIntersectionKHR; -opTerminateRayKHR : Op TerminateRayKHR; -opRayQueryInitializeKHR : Op RayQueryInitializeKHR rayQuery accel rayFlagsIdRef cullMask rayOrigin rayTmin rayDirection rayTmax; -opRayQueryTerminateKHR : Op RayQueryTerminateKHR rayQuery; -opRayQueryGenerateIntersectionKHR : Op RayQueryGenerateIntersectionKHR rayQuery hitT; -opRayQueryConfirmIntersectionKHR : Op RayQueryConfirmIntersectionKHR rayQuery; -opRayQueryProceedKHR : (Op RayQueryProceedKHR idResultType | RayQueryProceedKHR) rayQuery; -opRayQueryGetIntersectionTypeKHR : (Op RayQueryGetIntersectionTypeKHR idResultType | RayQueryGetIntersectionTypeKHR) rayQuery intersection; -opFragmentMaskFetchAMD : (Op FragmentMaskFetchAMD idResultType | FragmentMaskFetchAMD) image coordinate; -opFragmentFetchAMD : (Op FragmentFetchAMD idResultType | FragmentFetchAMD) image coordinate fragmentIndex; -opReadClockKHR : (Op ReadClockKHR idResultType | ReadClockKHR) scopeIdScope; -opFinalizeNodePayloadsAMDX : Op FinalizeNodePayloadsAMDX payloadArray; -opFinishWritingNodePayloadAMDX : (Op FinishWritingNodePayloadAMDX idResultType | FinishWritingNodePayloadAMDX) payload; -opInitializeNodePayloadsAMDX : Op InitializeNodePayloadsAMDX payloadArray visibility payloadCount nodeIndex; -opHitObjectRecordHitMotionNV : Op HitObjectRecordHitMotionNV hitObject accelerationStructure instanceId primitiveId geometryIndex hitKind sBTRecordOffset sBTRecordStride origin tMin direction tMax currentTime hitObjectAttributes; -opHitObjectRecordHitWithIndexMotionNV : Op HitObjectRecordHitWithIndexMotionNV hitObject accelerationStructure instanceId primitiveId geometryIndex hitKind sBTRecordIndex origin tMin direction tMax currentTime hitObjectAttributes; -opHitObjectRecordMissMotionNV : Op HitObjectRecordMissMotionNV hitObject sBTIndex origin tMin direction tMax currentTime; -opHitObjectGetWorldToObjectNV : (Op HitObjectGetWorldToObjectNV idResultType | HitObjectGetWorldToObjectNV) hitObject; -opHitObjectGetObjectToWorldNV : (Op HitObjectGetObjectToWorldNV idResultType | HitObjectGetObjectToWorldNV) hitObject; -opHitObjectGetObjectRayDirectionNV : (Op HitObjectGetObjectRayDirectionNV idResultType | HitObjectGetObjectRayDirectionNV) hitObject; -opHitObjectGetObjectRayOriginNV : (Op HitObjectGetObjectRayOriginNV idResultType | HitObjectGetObjectRayOriginNV) hitObject; -opHitObjectTraceRayMotionNV : Op HitObjectTraceRayMotionNV hitObject accelerationStructure rayFlagsIdRef cullMask sBTRecordOffset sBTRecordStride missIndex origin tMin direction tMax time payload; -opHitObjectGetShaderRecordBufferHandleNV : (Op HitObjectGetShaderRecordBufferHandleNV idResultType | HitObjectGetShaderRecordBufferHandleNV) hitObject; -opHitObjectGetShaderBindingTableRecordIndexNV : (Op HitObjectGetShaderBindingTableRecordIndexNV idResultType | HitObjectGetShaderBindingTableRecordIndexNV) hitObject; -opHitObjectRecordEmptyNV : Op HitObjectRecordEmptyNV hitObject; -opHitObjectTraceRayNV : Op HitObjectTraceRayNV hitObject accelerationStructure rayFlagsIdRef cullMask sBTRecordOffset sBTRecordStride missIndex origin tMin direction tMax payload; -opHitObjectRecordHitNV : Op HitObjectRecordHitNV hitObject accelerationStructure instanceId primitiveId geometryIndex hitKind sBTRecordOffset sBTRecordStride origin tMin direction tMax hitObjectAttributes; -opHitObjectRecordHitWithIndexNV : Op HitObjectRecordHitWithIndexNV hitObject accelerationStructure instanceId primitiveId geometryIndex hitKind sBTRecordIndex origin tMin direction tMax hitObjectAttributes; -opHitObjectRecordMissNV : Op HitObjectRecordMissNV hitObject sBTIndex origin tMin direction tMax; -opHitObjectExecuteShaderNV : Op HitObjectExecuteShaderNV hitObject payload; -opHitObjectGetCurrentTimeNV : (Op HitObjectGetCurrentTimeNV idResultType | HitObjectGetCurrentTimeNV) hitObject; -opHitObjectGetAttributesNV : Op HitObjectGetAttributesNV hitObject hitObjectAttribute; -opHitObjectGetHitKindNV : (Op HitObjectGetHitKindNV idResultType | HitObjectGetHitKindNV) hitObject; -opHitObjectGetPrimitiveIndexNV : (Op HitObjectGetPrimitiveIndexNV idResultType | HitObjectGetPrimitiveIndexNV) hitObject; -opHitObjectGetGeometryIndexNV : (Op HitObjectGetGeometryIndexNV idResultType | HitObjectGetGeometryIndexNV) hitObject; -opHitObjectGetInstanceIdNV : (Op HitObjectGetInstanceIdNV idResultType | HitObjectGetInstanceIdNV) hitObject; -opHitObjectGetInstanceCustomIndexNV : (Op HitObjectGetInstanceCustomIndexNV idResultType | HitObjectGetInstanceCustomIndexNV) hitObject; -opHitObjectGetWorldRayDirectionNV : (Op HitObjectGetWorldRayDirectionNV idResultType | HitObjectGetWorldRayDirectionNV) hitObject; -opHitObjectGetWorldRayOriginNV : (Op HitObjectGetWorldRayOriginNV idResultType | HitObjectGetWorldRayOriginNV) hitObject; -opHitObjectGetRayTMaxNV : (Op HitObjectGetRayTMaxNV idResultType | HitObjectGetRayTMaxNV) hitObject; -opHitObjectGetRayTMinNV : (Op HitObjectGetRayTMinNV idResultType | HitObjectGetRayTMinNV) hitObject; -opHitObjectIsEmptyNV : (Op HitObjectIsEmptyNV idResultType | HitObjectIsEmptyNV) hitObject; -opHitObjectIsHitNV : (Op HitObjectIsHitNV idResultType | HitObjectIsHitNV) hitObject; -opHitObjectIsMissNV : (Op HitObjectIsMissNV idResultType | HitObjectIsMissNV) hitObject; -opReorderThreadWithHitObjectNV : Op ReorderThreadWithHitObjectNV hitObject hint? bits?; -opReorderThreadWithHintNV : Op ReorderThreadWithHintNV hint bits; -opEmitMeshTasksEXT : Op EmitMeshTasksEXT groupCountX groupCountY groupCountZ payload?; -opSetMeshOutputsEXT : Op SetMeshOutputsEXT vertexCountIdRef primitiveCountIdRef; -opWritePackedPrimitiveIndices4x8NV : Op WritePackedPrimitiveIndices4x8NV indexOffset packedIndices; -opFetchMicroTriangleVertexPositionNV : (Op FetchMicroTriangleVertexPositionNV idResultType | FetchMicroTriangleVertexPositionNV) accel instanceId geometryIndex primitiveIndex barycentric; -opFetchMicroTriangleVertexBarycentricNV : (Op FetchMicroTriangleVertexBarycentricNV idResultType | FetchMicroTriangleVertexBarycentricNV) accel instanceId geometryIndex primitiveIndex barycentric; -opReportIntersectionNV : (Op ReportIntersectionNV idResultType | ReportIntersectionNV) hit hitKind; -opReportIntersectionKHR : (Op ReportIntersectionKHR idResultType | ReportIntersectionKHR) hit hitKind; -opIgnoreIntersectionNV : Op IgnoreIntersectionNV; -opTerminateRayNV : Op TerminateRayNV; -opTraceNV : Op TraceNV accel rayFlagsIdRef cullMask sBTOffset sBTStride missIndex rayOrigin rayTmin rayDirection rayTmax payloadId; -opTraceMotionNV : Op TraceMotionNV accel rayFlagsIdRef cullMask sBTOffset sBTStride missIndex rayOrigin rayTmin rayDirection rayTmax time payloadId; -opTraceRayMotionNV : Op TraceRayMotionNV accel rayFlagsIdRef cullMask sBTOffset sBTStride missIndex rayOrigin rayTmin rayDirection rayTmax time payload; -opRayQueryGetIntersectionTriangleVertexPositionsKHR : (Op RayQueryGetIntersectionTriangleVertexPositionsKHR idResultType | RayQueryGetIntersectionTriangleVertexPositionsKHR) rayQuery intersection; -opExecuteCallableNV : Op ExecuteCallableNV sBTIndex callableDataId; -opCooperativeMatrixLoadNV : (Op CooperativeMatrixLoadNV idResultType | CooperativeMatrixLoadNV) pointer stride columnMajor memoryAccess?; -opCooperativeMatrixStoreNV : Op CooperativeMatrixStoreNV pointer object stride columnMajor memoryAccess?; -opCooperativeMatrixMulAddNV : (Op CooperativeMatrixMulAddNV idResultType | CooperativeMatrixMulAddNV) a b c; -opCooperativeMatrixLengthNV : (Op CooperativeMatrixLengthNV idResultType | CooperativeMatrixLengthNV) type; -opBeginInvocationInterlockEXT : Op BeginInvocationInterlockEXT; -opEndInvocationInterlockEXT : Op EndInvocationInterlockEXT; -opIsHelperInvocationEXT : (Op IsHelperInvocationEXT idResultType | IsHelperInvocationEXT); -opConvertUToImageNV : (Op ConvertUToImageNV idResultType | ConvertUToImageNV) operand; -opConvertUToSamplerNV : (Op ConvertUToSamplerNV idResultType | ConvertUToSamplerNV) operand; -opConvertImageToUNV : (Op ConvertImageToUNV idResultType | ConvertImageToUNV) operand; -opConvertSamplerToUNV : (Op ConvertSamplerToUNV idResultType | ConvertSamplerToUNV) operand; -opConvertUToSampledImageNV : (Op ConvertUToSampledImageNV idResultType | ConvertUToSampledImageNV) operand; -opConvertSampledImageToUNV : (Op ConvertSampledImageToUNV idResultType | ConvertSampledImageToUNV) operand; -opSamplerImageAddressingModeNV : Op SamplerImageAddressingModeNV bitWidth; -opUCountLeadingZerosINTEL : (Op UCountLeadingZerosINTEL idResultType | UCountLeadingZerosINTEL) operand; -opUCountTrailingZerosINTEL : (Op UCountTrailingZerosINTEL idResultType | UCountTrailingZerosINTEL) operand; -opAbsISubINTEL : (Op AbsISubINTEL idResultType | AbsISubINTEL) operand1 operand2; -opAbsUSubINTEL : (Op AbsUSubINTEL idResultType | AbsUSubINTEL) operand1 operand2; -opIAddSatINTEL : (Op IAddSatINTEL idResultType | IAddSatINTEL) operand1 operand2; -opUAddSatINTEL : (Op UAddSatINTEL idResultType | UAddSatINTEL) operand1 operand2; -opIAverageINTEL : (Op IAverageINTEL idResultType | IAverageINTEL) operand1 operand2; -opUAverageINTEL : (Op UAverageINTEL idResultType | UAverageINTEL) operand1 operand2; -opIAverageRoundedINTEL : (Op IAverageRoundedINTEL idResultType | IAverageRoundedINTEL) operand1 operand2; -opUAverageRoundedINTEL : (Op UAverageRoundedINTEL idResultType | UAverageRoundedINTEL) operand1 operand2; -opISubSatINTEL : (Op ISubSatINTEL idResultType | ISubSatINTEL) operand1 operand2; -opUSubSatINTEL : (Op USubSatINTEL idResultType | USubSatINTEL) operand1 operand2; -opIMul32x16INTEL : (Op IMul32x16INTEL idResultType | IMul32x16INTEL) operand1 operand2; -opUMul32x16INTEL : (Op UMul32x16INTEL idResultType | UMul32x16INTEL) operand1 operand2; -opLoopControlINTEL : Op LoopControlINTEL loopControlParameters*; -opFPGARegINTEL : (Op FPGARegINTEL idResultType | FPGARegINTEL) result input; -opRayQueryGetRayTMinKHR : (Op RayQueryGetRayTMinKHR idResultType | RayQueryGetRayTMinKHR) rayQuery; -opRayQueryGetRayFlagsKHR : (Op RayQueryGetRayFlagsKHR idResultType | RayQueryGetRayFlagsKHR) rayQuery; -opRayQueryGetIntersectionTKHR : (Op RayQueryGetIntersectionTKHR idResultType | RayQueryGetIntersectionTKHR) rayQuery intersection; -opRayQueryGetIntersectionInstanceCustomIndexKHR : (Op RayQueryGetIntersectionInstanceCustomIndexKHR idResultType | RayQueryGetIntersectionInstanceCustomIndexKHR) rayQuery intersection; -opRayQueryGetIntersectionInstanceIdKHR : (Op RayQueryGetIntersectionInstanceIdKHR idResultType | RayQueryGetIntersectionInstanceIdKHR) rayQuery intersection; -opRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR : (Op RayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR idResultType | RayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR) rayQuery intersection; -opRayQueryGetIntersectionGeometryIndexKHR : (Op RayQueryGetIntersectionGeometryIndexKHR idResultType | RayQueryGetIntersectionGeometryIndexKHR) rayQuery intersection; -opRayQueryGetIntersectionPrimitiveIndexKHR : (Op RayQueryGetIntersectionPrimitiveIndexKHR idResultType | RayQueryGetIntersectionPrimitiveIndexKHR) rayQuery intersection; -opRayQueryGetIntersectionBarycentricsKHR : (Op RayQueryGetIntersectionBarycentricsKHR idResultType | RayQueryGetIntersectionBarycentricsKHR) rayQuery intersection; -opRayQueryGetIntersectionFrontFaceKHR : (Op RayQueryGetIntersectionFrontFaceKHR idResultType | RayQueryGetIntersectionFrontFaceKHR) rayQuery intersection; -opRayQueryGetIntersectionCandidateAABBOpaqueKHR : (Op RayQueryGetIntersectionCandidateAABBOpaqueKHR idResultType | RayQueryGetIntersectionCandidateAABBOpaqueKHR) rayQuery; -opRayQueryGetIntersectionObjectRayDirectionKHR : (Op RayQueryGetIntersectionObjectRayDirectionKHR idResultType | RayQueryGetIntersectionObjectRayDirectionKHR) rayQuery intersection; -opRayQueryGetIntersectionObjectRayOriginKHR : (Op RayQueryGetIntersectionObjectRayOriginKHR idResultType | RayQueryGetIntersectionObjectRayOriginKHR) rayQuery intersection; -opRayQueryGetWorldRayDirectionKHR : (Op RayQueryGetWorldRayDirectionKHR idResultType | RayQueryGetWorldRayDirectionKHR) rayQuery; -opRayQueryGetWorldRayOriginKHR : (Op RayQueryGetWorldRayOriginKHR idResultType | RayQueryGetWorldRayOriginKHR) rayQuery; -opRayQueryGetIntersectionObjectToWorldKHR : (Op RayQueryGetIntersectionObjectToWorldKHR idResultType | RayQueryGetIntersectionObjectToWorldKHR) rayQuery intersection; -opRayQueryGetIntersectionWorldToObjectKHR : (Op RayQueryGetIntersectionWorldToObjectKHR idResultType | RayQueryGetIntersectionWorldToObjectKHR) rayQuery intersection; +assertionValue + : varName indexValue* + | initBaseValue + ; -// Type-Declaration Operations -opTypeVoid : (Op TypeVoid | TypeVoid); -opTypeBool : (Op TypeBool | TypeBool); -opTypeInt : (Op TypeInt | TypeInt) widthLiteralInteger signedness; -opTypeFloat : (Op TypeFloat | TypeFloat) widthLiteralInteger; -opTypeVector : (Op TypeVector | TypeVector) componentType componentCount; -opTypeMatrix : (Op TypeMatrix | TypeMatrix) columnType columnCount; -opTypeImage : (Op TypeImage | TypeImage) sampledType dim depthLiteralInteger arrayed mS sampled imageFormat accessQualifier?; -opTypeSampler : (Op TypeSampler | TypeSampler); -opTypeSampledImage : (Op TypeSampledImage | TypeSampledImage) imageType; -opTypeArray : (Op TypeArray | TypeArray) elementType length; -opTypeRuntimeArray : (Op TypeRuntimeArray | TypeRuntimeArray) elementType; -opTypeStruct : (Op TypeStruct | TypeStruct) memberType*; -opTypeOpaque : (Op TypeOpaque | TypeOpaque) theNameOfTheOpaqueType; -opTypePointer : (Op TypePointer | TypePointer) storageClass type; -opTypeFunction : (Op TypeFunction | TypeFunction) returnType parameterType*; -opTypeEvent : (Op TypeEvent | TypeEvent); -opTypeDeviceEvent : (Op TypeDeviceEvent | TypeDeviceEvent); -opTypeReserveId : (Op TypeReserveId | TypeReserveId); -opTypeQueue : (Op TypeQueue | TypeQueue); -opTypePipe : (Op TypePipe | TypePipe) qualifier; -opTypeForwardPointer : Op TypeForwardPointer pointerType storageClass; -opTypePipeStorage : (Op TypePipeStorage | TypePipeStorage); -opTypeNamedBarrier : (Op TypeNamedBarrier | TypeNamedBarrier); -opTypeCooperativeMatrixKHR : (Op TypeCooperativeMatrixKHR | TypeCooperativeMatrixKHR) componentType scopeIdScope rows columns use; -opTypeRayQueryKHR : (Op TypeRayQueryKHR | TypeRayQueryKHR); -opTypeHitObjectNV : (Op TypeHitObjectNV | TypeHitObjectNV); -opTypeAccelerationStructureNV : (Op TypeAccelerationStructureNV | TypeAccelerationStructureNV); -opTypeAccelerationStructureKHR : (Op TypeAccelerationStructureKHR | TypeAccelerationStructureKHR); -opTypeCooperativeMatrixNV : (Op TypeCooperativeMatrixNV | TypeCooperativeMatrixNV) componentType execution rows columns; -opTypeBufferSurfaceINTEL : (Op TypeBufferSurfaceINTEL | TypeBufferSurfaceINTEL) accessQualifier; -opTypeStructContinuedINTEL : Op TypeStructContinuedINTEL memberType*; +indexValue : ModeHeader_LBracket ModeHeader_PositiveInteger ModeHeader_RBracket; +varName : idResult; -// exclude Operations -opConstantFunctionPointerINTEL : (Op ConstantFunctionPointerINTEL idResultType | ConstantFunctionPointerINTEL) function; -opFunctionPointerCallINTEL : (Op FunctionPointerCallINTEL idResultType | FunctionPointerCallINTEL) operand1*; -opAsmTargetINTEL : (Op AsmTargetINTEL idResultType | AsmTargetINTEL) asmTarget; -opAsmINTEL : (Op AsmINTEL idResultType | AsmINTEL) asmType targetIdRef asmInstructions constraints; -opAsmCallINTEL : (Op AsmCallINTEL idResultType | AsmCallINTEL) asm argument0*; -opVmeImageINTEL : (Op VmeImageINTEL idResultType | VmeImageINTEL) imageType sampler; -opTypeVmeImageINTEL : (Op TypeVmeImageINTEL | TypeVmeImageINTEL) imageType; -opTypeAvcImePayloadINTEL : (Op TypeAvcImePayloadINTEL | TypeAvcImePayloadINTEL); -opTypeAvcRefPayloadINTEL : (Op TypeAvcRefPayloadINTEL | TypeAvcRefPayloadINTEL); -opTypeAvcSicPayloadINTEL : (Op TypeAvcSicPayloadINTEL | TypeAvcSicPayloadINTEL); -opTypeAvcMcePayloadINTEL : (Op TypeAvcMcePayloadINTEL | TypeAvcMcePayloadINTEL); -opTypeAvcMceResultINTEL : (Op TypeAvcMceResultINTEL | TypeAvcMceResultINTEL); -opTypeAvcImeResultINTEL : (Op TypeAvcImeResultINTEL | TypeAvcImeResultINTEL); -opTypeAvcImeResultSingleReferenceStreamoutINTEL : (Op TypeAvcImeResultSingleReferenceStreamoutINTEL | TypeAvcImeResultSingleReferenceStreamoutINTEL); -opTypeAvcImeResultDualReferenceStreamoutINTEL : (Op TypeAvcImeResultDualReferenceStreamoutINTEL | TypeAvcImeResultDualReferenceStreamoutINTEL); -opTypeAvcImeSingleReferenceStreaminINTEL : (Op TypeAvcImeSingleReferenceStreaminINTEL | TypeAvcImeSingleReferenceStreaminINTEL); -opTypeAvcImeDualReferenceStreaminINTEL : (Op TypeAvcImeDualReferenceStreaminINTEL | TypeAvcImeDualReferenceStreaminINTEL); -opTypeAvcRefResultINTEL : (Op TypeAvcRefResultINTEL | TypeAvcRefResultINTEL); -opTypeAvcSicResultINTEL : (Op TypeAvcSicResultINTEL | TypeAvcSicResultINTEL); -opSubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL : (Op SubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL idResultType | SubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL) sliceType qp; -opSubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL : (Op SubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL idResultType | SubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL) referenceBasePenalty payload; -opSubgroupAvcMceGetDefaultInterShapePenaltyINTEL : (Op SubgroupAvcMceGetDefaultInterShapePenaltyINTEL idResultType | SubgroupAvcMceGetDefaultInterShapePenaltyINTEL) sliceType qp; -opSubgroupAvcMceSetInterShapePenaltyINTEL : (Op SubgroupAvcMceSetInterShapePenaltyINTEL idResultType | SubgroupAvcMceSetInterShapePenaltyINTEL) packedShapePenalty payload; -opSubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL : (Op SubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL idResultType | SubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL) sliceType qp; -opSubgroupAvcMceSetInterDirectionPenaltyINTEL : (Op SubgroupAvcMceSetInterDirectionPenaltyINTEL idResultType | SubgroupAvcMceSetInterDirectionPenaltyINTEL) directionCost payload; -opSubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL : (Op SubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL idResultType | SubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL) sliceType qp; -opSubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL : (Op SubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL idResultType | SubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL) sliceType qp; -opSubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL : (Op SubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL idResultType | SubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL); -opSubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL : (Op SubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL idResultType | SubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL); -opSubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL : (Op SubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL idResultType | SubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL); -opSubgroupAvcMceSetMotionVectorCostFunctionINTEL : (Op SubgroupAvcMceSetMotionVectorCostFunctionINTEL idResultType | SubgroupAvcMceSetMotionVectorCostFunctionINTEL) packedCostCenterDelta packedCostTable costPrecision payload; -opSubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL : (Op SubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL idResultType | SubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL) sliceType qp; -opSubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL : (Op SubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL idResultType | SubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL); -opSubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL : (Op SubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL idResultType | SubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL); -opSubgroupAvcMceSetAcOnlyHaarINTEL : (Op SubgroupAvcMceSetAcOnlyHaarINTEL idResultType | SubgroupAvcMceSetAcOnlyHaarINTEL) payload; -opSubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL : (Op SubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL idResultType | SubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL) sourceFieldPolarity payload; -opSubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL : (Op SubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL idResultType | SubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL) referenceFieldPolarity payload; -opSubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL : (Op SubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL idResultType | SubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL) forwardReferenceFieldPolarity backwardReferenceFieldPolarity payload; -opSubgroupAvcMceConvertToImePayloadINTEL : (Op SubgroupAvcMceConvertToImePayloadINTEL idResultType | SubgroupAvcMceConvertToImePayloadINTEL) payload; -opSubgroupAvcMceConvertToImeResultINTEL : (Op SubgroupAvcMceConvertToImeResultINTEL idResultType | SubgroupAvcMceConvertToImeResultINTEL) payload; -opSubgroupAvcMceConvertToRefPayloadINTEL : (Op SubgroupAvcMceConvertToRefPayloadINTEL idResultType | SubgroupAvcMceConvertToRefPayloadINTEL) payload; -opSubgroupAvcMceConvertToRefResultINTEL : (Op SubgroupAvcMceConvertToRefResultINTEL idResultType | SubgroupAvcMceConvertToRefResultINTEL) payload; -opSubgroupAvcMceConvertToSicPayloadINTEL : (Op SubgroupAvcMceConvertToSicPayloadINTEL idResultType | SubgroupAvcMceConvertToSicPayloadINTEL) payload; -opSubgroupAvcMceConvertToSicResultINTEL : (Op SubgroupAvcMceConvertToSicResultINTEL idResultType | SubgroupAvcMceConvertToSicResultINTEL) payload; -opSubgroupAvcMceGetMotionVectorsINTEL : (Op SubgroupAvcMceGetMotionVectorsINTEL idResultType | SubgroupAvcMceGetMotionVectorsINTEL) payload; -opSubgroupAvcMceGetInterDistortionsINTEL : (Op SubgroupAvcMceGetInterDistortionsINTEL idResultType | SubgroupAvcMceGetInterDistortionsINTEL) payload; -opSubgroupAvcMceGetBestInterDistortionsINTEL : (Op SubgroupAvcMceGetBestInterDistortionsINTEL idResultType | SubgroupAvcMceGetBestInterDistortionsINTEL) payload; -opSubgroupAvcMceGetInterMajorShapeINTEL : (Op SubgroupAvcMceGetInterMajorShapeINTEL idResultType | SubgroupAvcMceGetInterMajorShapeINTEL) payload; -opSubgroupAvcMceGetInterMinorShapeINTEL : (Op SubgroupAvcMceGetInterMinorShapeINTEL idResultType | SubgroupAvcMceGetInterMinorShapeINTEL) payload; -opSubgroupAvcMceGetInterDirectionsINTEL : (Op SubgroupAvcMceGetInterDirectionsINTEL idResultType | SubgroupAvcMceGetInterDirectionsINTEL) payload; -opSubgroupAvcMceGetInterMotionVectorCountINTEL : (Op SubgroupAvcMceGetInterMotionVectorCountINTEL idResultType | SubgroupAvcMceGetInterMotionVectorCountINTEL) payload; -opSubgroupAvcMceGetInterReferenceIdsINTEL : (Op SubgroupAvcMceGetInterReferenceIdsINTEL idResultType | SubgroupAvcMceGetInterReferenceIdsINTEL) payload; -opSubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL : (Op SubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL idResultType | SubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL) packedReferenceIds packedReferenceParameterFieldPolarities payload; -opSubgroupAvcImeInitializeINTEL : (Op SubgroupAvcImeInitializeINTEL idResultType | SubgroupAvcImeInitializeINTEL) srcCoord partitionMask sADAdjustment; -opSubgroupAvcImeSetSingleReferenceINTEL : (Op SubgroupAvcImeSetSingleReferenceINTEL idResultType | SubgroupAvcImeSetSingleReferenceINTEL) refOffset searchWindowConfig payload; -opSubgroupAvcImeSetDualReferenceINTEL : (Op SubgroupAvcImeSetDualReferenceINTEL idResultType | SubgroupAvcImeSetDualReferenceINTEL) fwdRefOffset bwdRefOffset id payload; -opSubgroupAvcImeRefWindowSizeINTEL : (Op SubgroupAvcImeRefWindowSizeINTEL idResultType | SubgroupAvcImeRefWindowSizeINTEL) searchWindowConfig dualRef; -opSubgroupAvcImeAdjustRefOffsetINTEL : (Op SubgroupAvcImeAdjustRefOffsetINTEL idResultType | SubgroupAvcImeAdjustRefOffsetINTEL) refOffset srcCoord refWindowSize imageSize; -opSubgroupAvcImeConvertToMcePayloadINTEL : (Op SubgroupAvcImeConvertToMcePayloadINTEL idResultType | SubgroupAvcImeConvertToMcePayloadINTEL) payload; -opSubgroupAvcImeSetMaxMotionVectorCountINTEL : (Op SubgroupAvcImeSetMaxMotionVectorCountINTEL idResultType | SubgroupAvcImeSetMaxMotionVectorCountINTEL) maxMotionVectorCount payload; -opSubgroupAvcImeSetUnidirectionalMixDisableINTEL : (Op SubgroupAvcImeSetUnidirectionalMixDisableINTEL idResultType | SubgroupAvcImeSetUnidirectionalMixDisableINTEL) payload; -opSubgroupAvcImeSetEarlySearchTerminationThresholdINTEL : (Op SubgroupAvcImeSetEarlySearchTerminationThresholdINTEL idResultType | SubgroupAvcImeSetEarlySearchTerminationThresholdINTEL) threshold payload; -opSubgroupAvcImeSetWeightedSadINTEL : (Op SubgroupAvcImeSetWeightedSadINTEL idResultType | SubgroupAvcImeSetWeightedSadINTEL) packedSadWeights payload; -opSubgroupAvcImeEvaluateWithSingleReferenceINTEL : (Op SubgroupAvcImeEvaluateWithSingleReferenceINTEL idResultType | SubgroupAvcImeEvaluateWithSingleReferenceINTEL) srcImage refImage payload; -opSubgroupAvcImeEvaluateWithDualReferenceINTEL : (Op SubgroupAvcImeEvaluateWithDualReferenceINTEL idResultType | SubgroupAvcImeEvaluateWithDualReferenceINTEL) srcImage fwdRefImage bwdRefImage payload; -opSubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL : (Op SubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL idResultType | SubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL) srcImage refImage payload streaminComponents; -opSubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL : (Op SubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL idResultType | SubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL) srcImage fwdRefImage bwdRefImage payload streaminComponents; -opSubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL : (Op SubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL idResultType | SubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL) srcImage refImage payload; -opSubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL : (Op SubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL idResultType | SubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL) srcImage fwdRefImage bwdRefImage payload; -opSubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL : (Op SubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL idResultType | SubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL) srcImage refImage payload streaminComponents; -opSubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL : (Op SubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL idResultType | SubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL) srcImage fwdRefImage bwdRefImage payload streaminComponents; -opSubgroupAvcImeConvertToMceResultINTEL : (Op SubgroupAvcImeConvertToMceResultINTEL idResultType | SubgroupAvcImeConvertToMceResultINTEL) payload; -opSubgroupAvcImeGetSingleReferenceStreaminINTEL : (Op SubgroupAvcImeGetSingleReferenceStreaminINTEL idResultType | SubgroupAvcImeGetSingleReferenceStreaminINTEL) payload; -opSubgroupAvcImeGetDualReferenceStreaminINTEL : (Op SubgroupAvcImeGetDualReferenceStreaminINTEL idResultType | SubgroupAvcImeGetDualReferenceStreaminINTEL) payload; -opSubgroupAvcImeStripSingleReferenceStreamoutINTEL : (Op SubgroupAvcImeStripSingleReferenceStreamoutINTEL idResultType | SubgroupAvcImeStripSingleReferenceStreamoutINTEL) payload; -opSubgroupAvcImeStripDualReferenceStreamoutINTEL : (Op SubgroupAvcImeStripDualReferenceStreamoutINTEL idResultType | SubgroupAvcImeStripDualReferenceStreamoutINTEL) payload; -opSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL : (Op SubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL idResultType | SubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL) payload majorShape; -opSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL : (Op SubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL idResultType | SubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL) payload majorShape; -opSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL : (Op SubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL idResultType | SubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL) payload majorShape; -opSubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL : (Op SubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL idResultType | SubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL) payload majorShape direction; -opSubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL : (Op SubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL idResultType | SubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL) payload majorShape direction; -opSubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL : (Op SubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL idResultType | SubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL) payload majorShape direction; -opSubgroupAvcImeGetBorderReachedINTEL : (Op SubgroupAvcImeGetBorderReachedINTEL idResultType | SubgroupAvcImeGetBorderReachedINTEL) imageSelect payload; -opSubgroupAvcImeGetTruncatedSearchIndicationINTEL : (Op SubgroupAvcImeGetTruncatedSearchIndicationINTEL idResultType | SubgroupAvcImeGetTruncatedSearchIndicationINTEL) payload; -opSubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL : (Op SubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL idResultType | SubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL) payload; -opSubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL : (Op SubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL idResultType | SubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL) payload; -opSubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL : (Op SubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL idResultType | SubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL) payload; -opSubgroupAvcFmeInitializeINTEL : (Op SubgroupAvcFmeInitializeINTEL idResultType | SubgroupAvcFmeInitializeINTEL) srcCoord motionVectors majorShapes minorShapes direction pixelResolution sADAdjustment; -opSubgroupAvcBmeInitializeINTEL : (Op SubgroupAvcBmeInitializeINTEL idResultType | SubgroupAvcBmeInitializeINTEL) srcCoord motionVectors majorShapes minorShapes direction pixelResolution bidirectionalWeight sADAdjustment; -opSubgroupAvcRefConvertToMcePayloadINTEL : (Op SubgroupAvcRefConvertToMcePayloadINTEL idResultType | SubgroupAvcRefConvertToMcePayloadINTEL) payload; -opSubgroupAvcRefSetBidirectionalMixDisableINTEL : (Op SubgroupAvcRefSetBidirectionalMixDisableINTEL idResultType | SubgroupAvcRefSetBidirectionalMixDisableINTEL) payload; -opSubgroupAvcRefSetBilinearFilterEnableINTEL : (Op SubgroupAvcRefSetBilinearFilterEnableINTEL idResultType | SubgroupAvcRefSetBilinearFilterEnableINTEL) payload; -opSubgroupAvcRefEvaluateWithSingleReferenceINTEL : (Op SubgroupAvcRefEvaluateWithSingleReferenceINTEL idResultType | SubgroupAvcRefEvaluateWithSingleReferenceINTEL) srcImage refImage payload; -opSubgroupAvcRefEvaluateWithDualReferenceINTEL : (Op SubgroupAvcRefEvaluateWithDualReferenceINTEL idResultType | SubgroupAvcRefEvaluateWithDualReferenceINTEL) srcImage fwdRefImage bwdRefImage payload; -opSubgroupAvcRefEvaluateWithMultiReferenceINTEL : (Op SubgroupAvcRefEvaluateWithMultiReferenceINTEL idResultType | SubgroupAvcRefEvaluateWithMultiReferenceINTEL) srcImage packedReferenceIds payload; -opSubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL : (Op SubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL idResultType | SubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL) srcImage packedReferenceIds packedReferenceFieldPolarities payload; -opSubgroupAvcRefConvertToMceResultINTEL : (Op SubgroupAvcRefConvertToMceResultINTEL idResultType | SubgroupAvcRefConvertToMceResultINTEL) payload; -opSubgroupAvcSicInitializeINTEL : (Op SubgroupAvcSicInitializeINTEL idResultType | SubgroupAvcSicInitializeINTEL) srcCoord; -opSubgroupAvcSicConfigureSkcINTEL : (Op SubgroupAvcSicConfigureSkcINTEL idResultType | SubgroupAvcSicConfigureSkcINTEL) skipBlockPartitionType skipMotionVectorMask motionVectors bidirectionalWeight sADAdjustment payload; -opSubgroupAvcSicConfigureIpeLumaINTEL : (Op SubgroupAvcSicConfigureIpeLumaINTEL idResultType | SubgroupAvcSicConfigureIpeLumaINTEL) lumaIntraPartitionMask intraNeighbourAvailabilty leftEdgeLumaPixels upperLeftCornerLumaPixel upperEdgeLumaPixels upperRightEdgeLumaPixels sADAdjustment payload; -opSubgroupAvcSicConfigureIpeLumaChromaINTEL : (Op SubgroupAvcSicConfigureIpeLumaChromaINTEL idResultType | SubgroupAvcSicConfigureIpeLumaChromaINTEL) lumaIntraPartitionMask intraNeighbourAvailabilty leftEdgeLumaPixels upperLeftCornerLumaPixel upperEdgeLumaPixels upperRightEdgeLumaPixels leftEdgeChromaPixels upperLeftCornerChromaPixel upperEdgeChromaPixels sADAdjustment payload; -opSubgroupAvcSicGetMotionVectorMaskINTEL : (Op SubgroupAvcSicGetMotionVectorMaskINTEL idResultType | SubgroupAvcSicGetMotionVectorMaskINTEL) skipBlockPartitionType direction; -opSubgroupAvcSicConvertToMcePayloadINTEL : (Op SubgroupAvcSicConvertToMcePayloadINTEL idResultType | SubgroupAvcSicConvertToMcePayloadINTEL) payload; -opSubgroupAvcSicSetIntraLumaShapePenaltyINTEL : (Op SubgroupAvcSicSetIntraLumaShapePenaltyINTEL idResultType | SubgroupAvcSicSetIntraLumaShapePenaltyINTEL) packedShapePenalty payload; -opSubgroupAvcSicSetIntraLumaModeCostFunctionINTEL : (Op SubgroupAvcSicSetIntraLumaModeCostFunctionINTEL idResultType | SubgroupAvcSicSetIntraLumaModeCostFunctionINTEL) lumaModePenalty lumaPackedNeighborModes lumaPackedNonDcPenalty payload; -opSubgroupAvcSicSetIntraChromaModeCostFunctionINTEL : (Op SubgroupAvcSicSetIntraChromaModeCostFunctionINTEL idResultType | SubgroupAvcSicSetIntraChromaModeCostFunctionINTEL) chromaModeBasePenalty payload; -opSubgroupAvcSicSetBilinearFilterEnableINTEL : (Op SubgroupAvcSicSetBilinearFilterEnableINTEL idResultType | SubgroupAvcSicSetBilinearFilterEnableINTEL) payload; -opSubgroupAvcSicSetSkcForwardTransformEnableINTEL : (Op SubgroupAvcSicSetSkcForwardTransformEnableINTEL idResultType | SubgroupAvcSicSetSkcForwardTransformEnableINTEL) packedSadCoefficients payload; -opSubgroupAvcSicSetBlockBasedRawSkipSadINTEL : (Op SubgroupAvcSicSetBlockBasedRawSkipSadINTEL idResultType | SubgroupAvcSicSetBlockBasedRawSkipSadINTEL) blockBasedSkipType payload; -opSubgroupAvcSicEvaluateIpeINTEL : (Op SubgroupAvcSicEvaluateIpeINTEL idResultType | SubgroupAvcSicEvaluateIpeINTEL) srcImage payload; -opSubgroupAvcSicEvaluateWithSingleReferenceINTEL : (Op SubgroupAvcSicEvaluateWithSingleReferenceINTEL idResultType | SubgroupAvcSicEvaluateWithSingleReferenceINTEL) srcImage refImage payload; -opSubgroupAvcSicEvaluateWithDualReferenceINTEL : (Op SubgroupAvcSicEvaluateWithDualReferenceINTEL idResultType | SubgroupAvcSicEvaluateWithDualReferenceINTEL) srcImage fwdRefImage bwdRefImage payload; -opSubgroupAvcSicEvaluateWithMultiReferenceINTEL : (Op SubgroupAvcSicEvaluateWithMultiReferenceINTEL idResultType | SubgroupAvcSicEvaluateWithMultiReferenceINTEL) srcImage packedReferenceIds payload; -opSubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL : (Op SubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL idResultType | SubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL) srcImage packedReferenceIds packedReferenceFieldPolarities payload; -opSubgroupAvcSicConvertToMceResultINTEL : (Op SubgroupAvcSicConvertToMceResultINTEL idResultType | SubgroupAvcSicConvertToMceResultINTEL) payload; -opSubgroupAvcSicGetIpeLumaShapeINTEL : (Op SubgroupAvcSicGetIpeLumaShapeINTEL idResultType | SubgroupAvcSicGetIpeLumaShapeINTEL) payload; -opSubgroupAvcSicGetBestIpeLumaDistortionINTEL : (Op SubgroupAvcSicGetBestIpeLumaDistortionINTEL idResultType | SubgroupAvcSicGetBestIpeLumaDistortionINTEL) payload; -opSubgroupAvcSicGetBestIpeChromaDistortionINTEL : (Op SubgroupAvcSicGetBestIpeChromaDistortionINTEL idResultType | SubgroupAvcSicGetBestIpeChromaDistortionINTEL) payload; -opSubgroupAvcSicGetPackedIpeLumaModesINTEL : (Op SubgroupAvcSicGetPackedIpeLumaModesINTEL idResultType | SubgroupAvcSicGetPackedIpeLumaModesINTEL) payload; -opSubgroupAvcSicGetIpeChromaModeINTEL : (Op SubgroupAvcSicGetIpeChromaModeINTEL idResultType | SubgroupAvcSicGetIpeChromaModeINTEL) payload; -opSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL : (Op SubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL idResultType | SubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL) payload; -opSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL : (Op SubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL idResultType | SubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL) payload; -opSubgroupAvcSicGetInterRawSadsINTEL : (Op SubgroupAvcSicGetInterRawSadsINTEL idResultType | SubgroupAvcSicGetInterRawSadsINTEL) payload; -opVariableLengthArrayINTEL : (Op VariableLengthArrayINTEL idResultType | VariableLengthArrayINTEL) lenght; -opSaveMemoryINTEL : (Op SaveMemoryINTEL idResultType | SaveMemoryINTEL); -opRestoreMemoryINTEL : Op RestoreMemoryINTEL ptr; -opArbitraryFloatSinCosPiINTEL : (Op ArbitraryFloatSinCosPiINTEL idResultType | ArbitraryFloatSinCosPiINTEL) a m1 mout fromSign enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatCastINTEL : (Op ArbitraryFloatCastINTEL idResultType | ArbitraryFloatCastINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatCastFromIntINTEL : (Op ArbitraryFloatCastFromIntINTEL idResultType | ArbitraryFloatCastFromIntINTEL) a mout fromSign enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatCastToIntINTEL : (Op ArbitraryFloatCastToIntINTEL idResultType | ArbitraryFloatCastToIntINTEL) a m1 enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatAddINTEL : (Op ArbitraryFloatAddINTEL idResultType | ArbitraryFloatAddINTEL) a m1 b m2 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatSubINTEL : (Op ArbitraryFloatSubINTEL idResultType | ArbitraryFloatSubINTEL) a m1 b m2 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatMulINTEL : (Op ArbitraryFloatMulINTEL idResultType | ArbitraryFloatMulINTEL) a m1 b m2 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatDivINTEL : (Op ArbitraryFloatDivINTEL idResultType | ArbitraryFloatDivINTEL) a m1 b m2 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatGTINTEL : (Op ArbitraryFloatGTINTEL idResultType | ArbitraryFloatGTINTEL) a m1 b m2; -opArbitraryFloatGEINTEL : (Op ArbitraryFloatGEINTEL idResultType | ArbitraryFloatGEINTEL) a m1 b m2; -opArbitraryFloatLTINTEL : (Op ArbitraryFloatLTINTEL idResultType | ArbitraryFloatLTINTEL) a m1 b m2; -opArbitraryFloatLEINTEL : (Op ArbitraryFloatLEINTEL idResultType | ArbitraryFloatLEINTEL) a m1 b m2; -opArbitraryFloatEQINTEL : (Op ArbitraryFloatEQINTEL idResultType | ArbitraryFloatEQINTEL) a m1 b m2; -opArbitraryFloatRecipINTEL : (Op ArbitraryFloatRecipINTEL idResultType | ArbitraryFloatRecipINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatRSqrtINTEL : (Op ArbitraryFloatRSqrtINTEL idResultType | ArbitraryFloatRSqrtINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatCbrtINTEL : (Op ArbitraryFloatCbrtINTEL idResultType | ArbitraryFloatCbrtINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatHypotINTEL : (Op ArbitraryFloatHypotINTEL idResultType | ArbitraryFloatHypotINTEL) a m1 b m2 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatSqrtINTEL : (Op ArbitraryFloatSqrtINTEL idResultType | ArbitraryFloatSqrtINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatLogINTEL : (Op ArbitraryFloatLogINTEL idResultType | ArbitraryFloatLogINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatLog2INTEL : (Op ArbitraryFloatLog2INTEL idResultType | ArbitraryFloatLog2INTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatLog10INTEL : (Op ArbitraryFloatLog10INTEL idResultType | ArbitraryFloatLog10INTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatLog1pINTEL : (Op ArbitraryFloatLog1pINTEL idResultType | ArbitraryFloatLog1pINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatExpINTEL : (Op ArbitraryFloatExpINTEL idResultType | ArbitraryFloatExpINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatExp2INTEL : (Op ArbitraryFloatExp2INTEL idResultType | ArbitraryFloatExp2INTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatExp10INTEL : (Op ArbitraryFloatExp10INTEL idResultType | ArbitraryFloatExp10INTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatExpm1INTEL : (Op ArbitraryFloatExpm1INTEL idResultType | ArbitraryFloatExpm1INTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatSinINTEL : (Op ArbitraryFloatSinINTEL idResultType | ArbitraryFloatSinINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatCosINTEL : (Op ArbitraryFloatCosINTEL idResultType | ArbitraryFloatCosINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatSinCosINTEL : (Op ArbitraryFloatSinCosINTEL idResultType | ArbitraryFloatSinCosINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatSinPiINTEL : (Op ArbitraryFloatSinPiINTEL idResultType | ArbitraryFloatSinPiINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatCosPiINTEL : (Op ArbitraryFloatCosPiINTEL idResultType | ArbitraryFloatCosPiINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatASinINTEL : (Op ArbitraryFloatASinINTEL idResultType | ArbitraryFloatASinINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatASinPiINTEL : (Op ArbitraryFloatASinPiINTEL idResultType | ArbitraryFloatASinPiINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatACosINTEL : (Op ArbitraryFloatACosINTEL idResultType | ArbitraryFloatACosINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatACosPiINTEL : (Op ArbitraryFloatACosPiINTEL idResultType | ArbitraryFloatACosPiINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatATanINTEL : (Op ArbitraryFloatATanINTEL idResultType | ArbitraryFloatATanINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatATanPiINTEL : (Op ArbitraryFloatATanPiINTEL idResultType | ArbitraryFloatATanPiINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatATan2INTEL : (Op ArbitraryFloatATan2INTEL idResultType | ArbitraryFloatATan2INTEL) a m1 b m2 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatPowINTEL : (Op ArbitraryFloatPowINTEL idResultType | ArbitraryFloatPowINTEL) a m1 b m2 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatPowRINTEL : (Op ArbitraryFloatPowRINTEL idResultType | ArbitraryFloatPowRINTEL) a m1 b m2 mout enableSubnormals roundingMode roundingAccuracy; -opArbitraryFloatPowNINTEL : (Op ArbitraryFloatPowNINTEL idResultType | ArbitraryFloatPowNINTEL) a m1 b mout enableSubnormals roundingMode roundingAccuracy; -opAliasDomainDeclINTEL : (Op AliasDomainDeclINTEL | AliasDomainDeclINTEL) nameIdRef?; -opAliasScopeDeclINTEL : (Op AliasScopeDeclINTEL | AliasScopeDeclINTEL) aliasDomain nameIdRef?; -opAliasScopeListDeclINTEL : (Op AliasScopeListDeclINTEL | AliasScopeListDeclINTEL) aliasScope*; -opFixedSqrtINTEL : (Op FixedSqrtINTEL idResultType | FixedSqrtINTEL) inputType input s i rI q o; -opFixedRecipINTEL : (Op FixedRecipINTEL idResultType | FixedRecipINTEL) inputType input s i rI q o; -opFixedRsqrtINTEL : (Op FixedRsqrtINTEL idResultType | FixedRsqrtINTEL) inputType input s i rI q o; -opFixedSinINTEL : (Op FixedSinINTEL idResultType | FixedSinINTEL) inputType input s i rI q o; -opFixedCosINTEL : (Op FixedCosINTEL idResultType | FixedCosINTEL) inputType input s i rI q o; -opFixedSinCosINTEL : (Op FixedSinCosINTEL idResultType | FixedSinCosINTEL) inputType input s i rI q o; -opFixedSinPiINTEL : (Op FixedSinPiINTEL idResultType | FixedSinPiINTEL) inputType input s i rI q o; -opFixedCosPiINTEL : (Op FixedCosPiINTEL idResultType | FixedCosPiINTEL) inputType input s i rI q o; -opFixedSinCosPiINTEL : (Op FixedSinCosPiINTEL idResultType | FixedSinCosPiINTEL) inputType input s i rI q o; -opFixedLogINTEL : (Op FixedLogINTEL idResultType | FixedLogINTEL) inputType input s i rI q o; -opFixedExpINTEL : (Op FixedExpINTEL idResultType | FixedExpINTEL) inputType input s i rI q o; -opPtrCastToCrossWorkgroupINTEL : (Op PtrCastToCrossWorkgroupINTEL idResultType | PtrCastToCrossWorkgroupINTEL) pointer; -opCrossWorkgroupCastToPtrINTEL : (Op CrossWorkgroupCastToPtrINTEL idResultType | CrossWorkgroupCastToPtrINTEL) pointer; - -// Operation groups +// Operations op - : opAssumeTrueKHR - | opAtomicFlagClear - | opAtomicStore - | opBeginInvocationInterlockEXT - | opBranch - | opBranchConditional - | opCapability - | opCaptureEventProfilingInfo - | opCommitReadPipe - | opCommitWritePipe - | opConstantCompositeContinuedINTEL - | opControlBarrier - | opControlBarrierArriveINTEL - | opControlBarrierWaitINTEL - | opCooperativeMatrixStoreKHR - | opCooperativeMatrixStoreNV - | opCopyMemory - | opCopyMemorySized - | opDecorate - | opDecorateId - | opDecorateString - | opDecorateStringGOOGLE - | opDemoteToHelperInvocation - | opDemoteToHelperInvocationEXT - | opEmitMeshTasksEXT - | opEmitStreamVertex - | opEmitVertex - | opEndInvocationInterlockEXT - | opEndPrimitive - | opEndStreamPrimitive - | opEntryPoint - | opExecuteCallableKHR - | opExecuteCallableNV - | opExecutionMode - | opExecutionModeId - | opExtension - | opFinalizeNodePayloadsAMDX - | opFunctionEnd - | opGroupCommitReadPipe - | opGroupCommitWritePipe - | opGroupDecorate - | opGroupMemberDecorate - | opGroupWaitEvents - | opHitObjectExecuteShaderNV - | opHitObjectGetAttributesNV - | opHitObjectRecordEmptyNV - | opHitObjectRecordHitMotionNV - | opHitObjectRecordHitNV - | opHitObjectRecordHitWithIndexMotionNV - | opHitObjectRecordHitWithIndexNV - | opHitObjectRecordMissMotionNV - | opHitObjectRecordMissNV - | opHitObjectTraceRayMotionNV - | opHitObjectTraceRayNV - | opIgnoreIntersectionKHR - | opIgnoreIntersectionNV - | opImageWrite - | opInitializeNodePayloadsAMDX - | opKill - | opLifetimeStart - | opLifetimeStop - | opLine - | opLoopControlINTEL - | opLoopMerge - | opMaskedScatterINTEL - | opMemberDecorate - | opMemberDecorateString - | opMemberDecorateStringGOOGLE - | opMemberName - | opMemoryBarrier - | opMemoryModel - | opMemoryNamedBarrier - | opModuleProcessed - | opName - | opNoLine - | opNop - | opRayQueryConfirmIntersectionKHR - | opRayQueryGenerateIntersectionKHR - | opRayQueryInitializeKHR - | opRayQueryTerminateKHR - | opReleaseEvent - | opReorderThreadWithHintNV - | opReorderThreadWithHitObjectNV - | opRestoreMemoryINTEL - | opRetainEvent - | opReturn - | opReturnValue - | opSamplerImageAddressingModeNV - | opSelectionMerge - | opSetMeshOutputsEXT - | opSetUserEventStatus - | opSource - | opSourceContinued - | opSourceExtension - | opSpecConstantCompositeContinuedINTEL - | opStore - | opSubgroupBlockWriteINTEL - | opSubgroupImageBlockWriteINTEL - | opSubgroupImageMediaBlockWriteINTEL - | opSwitch - | opTerminateInvocation - | opTerminateRayKHR - | opTerminateRayNV - | opTraceMotionNV - | opTraceNV - | opTraceRayKHR - | opTraceRayMotionNV - | opTypeForwardPointer - | opTypeStructContinuedINTEL - | opUnreachable - | opWritePackedPrimitiveIndices4x8NV - ; - -opWithRet : opAbsISubINTEL | opAbsUSubINTEL | opAccessChain @@ -952,6 +111,7 @@ opWithRet | opAsmCallINTEL | opAsmINTEL | opAsmTargetINTEL + | opAssumeTrueKHR | opAtomicAnd | opAtomicCompareExchange | opAtomicCompareExchangeWeak @@ -959,6 +119,7 @@ opWithRet | opAtomicFAddEXT | opAtomicFMaxEXT | opAtomicFMinEXT + | opAtomicFlagClear | opAtomicFlagTestAndSet | opAtomicIAdd | opAtomicIDecrement @@ -968,9 +129,11 @@ opWithRet | opAtomicOr | opAtomicSMax | opAtomicSMin + | opAtomicStore | opAtomicUMax | opAtomicUMin | opAtomicXor + | opBeginInvocationInterlockEXT | opBitCount | opBitFieldInsert | opBitFieldSExtract @@ -980,20 +143,30 @@ opWithRet | opBitwiseAnd | opBitwiseOr | opBitwiseXor + | opBranch + | opBranchConditional | opBuildNDRange + | opCapability + | opCaptureEventProfilingInfo | opColorAttachmentReadEXT + | opCommitReadPipe + | opCommitWritePipe | opCompositeConstruct | opCompositeConstructContinuedINTEL | opCompositeExtract | opCompositeInsert | opConstant | opConstantComposite + | opConstantCompositeContinuedINTEL | opConstantFalse | opConstantFunctionPointerINTEL | opConstantNull | opConstantPipeStorage | opConstantSampler | opConstantTrue + | opControlBarrier + | opControlBarrierArriveINTEL + | opControlBarrierWaitINTEL | opConvertBF16ToFINTEL | opConvertFToBF16INTEL | opConvertFToS @@ -1015,7 +188,11 @@ opWithRet | opCooperativeMatrixLoadNV | opCooperativeMatrixMulAddKHR | opCooperativeMatrixMulAddNV + | opCooperativeMatrixStoreKHR + | opCooperativeMatrixStoreNV | opCopyLogical + | opCopyMemory + | opCopyMemorySized | opCopyObject | opCreatePipeFromPipeStorage | opCreateUserEvent @@ -1026,14 +203,32 @@ opWithRet | opDPdy | opDPdyCoarse | opDPdyFine + | opDecorate + | opDecorateId + | opDecorateString + | opDecorateStringGOOGLE | opDecorationGroup + | opDemoteToHelperInvocation + | opDemoteToHelperInvocationEXT | opDepthAttachmentReadEXT | opDot + | opEmitMeshTasksEXT + | opEmitStreamVertex + | opEmitVertex + | opEndInvocationInterlockEXT + | opEndPrimitive + | opEndStreamPrimitive | opEnqueueKernel | opEnqueueMarker + | opEntryPoint + | opExecuteCallableKHR + | opExecuteCallableNV + | opExecutionMode + | opExecutionModeId | opExpectKHR | opExtInst | opExtInstImport + | opExtension | opFAdd | opFConvert | opFDiv @@ -1057,6 +252,7 @@ opWithRet | opFUnordNotEqual | opFetchMicroTriangleVertexBarycentricNV | opFetchMicroTriangleVertexPositionNV + | opFinalizeNodePayloadsAMDX | opFinishWritingNodePayloadAMDX | opFixedCosINTEL | opFixedCosPiINTEL @@ -1073,6 +269,7 @@ opWithRet | opFragmentMaskFetchAMD | opFunction | opFunctionCall + | opFunctionEnd | opFunctionParameter | opFunctionPointerCallINTEL | opFwidth @@ -1097,6 +294,9 @@ opWithRet | opGroupBitwiseOrKHR | opGroupBitwiseXorKHR | opGroupBroadcast + | opGroupCommitReadPipe + | opGroupCommitWritePipe + | opGroupDecorate | opGroupFAdd | opGroupFAddNonUniformAMD | opGroupFMax @@ -1110,6 +310,7 @@ opWithRet | opGroupLogicalAndKHR | opGroupLogicalOrKHR | opGroupLogicalXorKHR + | opGroupMemberDecorate | opGroupNonUniformAll | opGroupNonUniformAllEqual | opGroupNonUniformAny @@ -1156,6 +357,9 @@ opWithRet | opGroupUMaxNonUniformAMD | opGroupUMin | opGroupUMinNonUniformAMD + | opGroupWaitEvents + | opHitObjectExecuteShaderNV + | opHitObjectGetAttributesNV | opHitObjectGetCurrentTimeNV | opHitObjectGetGeometryIndexNV | opHitObjectGetHitKindNV @@ -1175,6 +379,15 @@ opWithRet | opHitObjectIsEmptyNV | opHitObjectIsHitNV | opHitObjectIsMissNV + | opHitObjectRecordEmptyNV + | opHitObjectRecordHitMotionNV + | opHitObjectRecordHitNV + | opHitObjectRecordHitWithIndexMotionNV + | opHitObjectRecordHitWithIndexNV + | opHitObjectRecordMissMotionNV + | opHitObjectRecordMissNV + | opHitObjectTraceRayMotionNV + | opHitObjectTraceRayNV | opIAdd | opIAddCarry | opIAddSatINTEL @@ -1187,6 +400,8 @@ opWithRet | opISub | opISubBorrow | opISubSatINTEL + | opIgnoreIntersectionKHR + | opIgnoreIntersectionNV | opImage | opImageBlockMatchSADQCOM | opImageBlockMatchSSDQCOM @@ -1226,8 +441,10 @@ opWithRet | opImageSparseSampleProjImplicitLod | opImageSparseTexelsResident | opImageTexelPointer + | opImageWrite | opInBoundsAccessChain | opInBoundsPtrAccessChain + | opInitializeNodePayloadsAMDX | opIsFinite | opIsHelperInvocationEXT | opIsInf @@ -1235,19 +452,37 @@ opWithRet | opIsNormal | opIsValidEvent | opIsValidReserveId + | opKill | opLabel | opLessOrGreater + | opLifetimeStart + | opLifetimeStop + | opLine | opLoad | opLogicalAnd | opLogicalEqual | opLogicalNot | opLogicalNotEqual | opLogicalOr + | opLoopControlINTEL + | opLoopMerge | opMaskedGatherINTEL + | opMaskedScatterINTEL | opMatrixTimesMatrix | opMatrixTimesScalar | opMatrixTimesVector + | opMemberDecorate + | opMemberDecorateString + | opMemberDecorateStringGOOGLE + | opMemberName + | opMemoryBarrier + | opMemoryModel + | opMemoryNamedBarrier + | opModuleProcessed + | opName | opNamedBarrierInitialize + | opNoLine + | opNop | opNot | opOrdered | opOuterProduct @@ -1259,6 +494,8 @@ opWithRet | opPtrEqual | opPtrNotEqual | opQuantizeToF16 + | opRayQueryConfirmIntersectionKHR + | opRayQueryGenerateIntersectionKHR | opRayQueryGetIntersectionBarycentricsKHR | opRayQueryGetIntersectionCandidateAABBOpaqueKHR | opRayQueryGetIntersectionFrontFaceKHR @@ -1278,16 +515,25 @@ opWithRet | opRayQueryGetRayTMinKHR | opRayQueryGetWorldRayDirectionKHR | opRayQueryGetWorldRayOriginKHR + | opRayQueryInitializeKHR | opRayQueryProceedKHR + | opRayQueryTerminateKHR | opReadClockKHR | opReadPipe | opReadPipeBlockingINTEL + | opReleaseEvent + | opReorderThreadWithHintNV + | opReorderThreadWithHitObjectNV | opReportIntersectionKHR | opReportIntersectionNV | opReserveReadPipePackets | opReserveWritePipePackets | opReservedReadPipe | opReservedWritePipe + | opRestoreMemoryINTEL + | opRetainEvent + | opReturn + | opReturnValue | opSConvert | opSDiv | opSDot @@ -1307,21 +553,29 @@ opWithRet | opSUDotAccSatKHR | opSUDotKHR | opSampledImage + | opSamplerImageAddressingModeNV | opSatConvertSToU | opSatConvertUToS | opSaveMemoryINTEL | opSelect + | opSelectionMerge + | opSetMeshOutputsEXT + | opSetUserEventStatus | opShiftLeftLogical | opShiftRightArithmetic | opShiftRightLogical | opSignBitSet | opSizeOf + | opSource + | opSourceContinued + | opSourceExtension | opSpecConstant | opSpecConstantComposite + | opSpecConstantCompositeContinuedINTEL | opSpecConstantFalse - | opSpecConstantOp | opSpecConstantTrue | opStencilAttachmentReadEXT + | opStore | opString | opSubgroupAllEqualKHR | opSubgroupAllKHR @@ -1432,14 +686,25 @@ opWithRet | opSubgroupAvcSicSetSkcForwardTransformEnableINTEL | opSubgroupBallotKHR | opSubgroupBlockReadINTEL + | opSubgroupBlockWriteINTEL | opSubgroupFirstInvocationKHR | opSubgroupImageBlockReadINTEL + | opSubgroupImageBlockWriteINTEL | opSubgroupImageMediaBlockReadINTEL + | opSubgroupImageMediaBlockWriteINTEL | opSubgroupReadInvocationKHR | opSubgroupShuffleDownINTEL | opSubgroupShuffleINTEL | opSubgroupShuffleUpINTEL | opSubgroupShuffleXorINTEL + | opSwitch + | opTerminateInvocation + | opTerminateRayKHR + | opTerminateRayNV + | opTraceMotionNV + | opTraceNV + | opTraceRayKHR + | opTraceRayMotionNV | opTranspose | opTypeAccelerationStructureKHR | opTypeAccelerationStructureNV @@ -1463,6 +728,7 @@ opWithRet | opTypeDeviceEvent | opTypeEvent | opTypeFloat + | opTypeForwardPointer | opTypeFunction | opTypeHitObjectNV | opTypeImage @@ -1480,6 +746,7 @@ opWithRet | opTypeSampledImage | opTypeSampler | opTypeStruct + | opTypeStructContinuedINTEL | opTypeVector | opTypeVmeImageINTEL | opTypeVoid @@ -1504,6 +771,7 @@ opWithRet | opUSubSatINTEL | opUndef | opUnordered + | opUnreachable | opVariable | opVariableLengthArrayINTEL | opVectorExtractDynamic @@ -1512,24 +780,1068 @@ opWithRet | opVectorTimesMatrix | opVectorTimesScalar | opVmeImageINTEL + | opWritePackedPrimitiveIndices4x8NV | opWritePipe | opWritePipeBlockingINTEL ; +// Annotation Operations +opDecorate : Op Decorate targetIdRef decoration; +opMemberDecorate : Op MemberDecorate structureType member decoration; +opDecorationGroup : idResult Equals Op (DecorationGroup | SpecConstantOp DecorationGroup); +opGroupDecorate : Op GroupDecorate decorationGroup targetsIdRef*; +opGroupMemberDecorate : Op GroupMemberDecorate decorationGroup targetsPairIdRefLiteralInteger*; +opDecorateId : Op DecorateId targetIdRef decoration; +opDecorateString : Op DecorateString targetIdRef decoration; +opDecorateStringGOOGLE : Op DecorateStringGOOGLE targetIdRef decoration; +opMemberDecorateString : Op MemberDecorateString structType member decoration; +opMemberDecorateStringGOOGLE : Op MemberDecorateStringGOOGLE structType member decoration; + +// Arithmetic Operations +opSNegate : idResult Equals Op (SNegate idResultType | SpecConstantOp idResultType SNegate) operand; +opFNegate : idResult Equals Op (FNegate idResultType | SpecConstantOp idResultType FNegate) operand; +opIAdd : idResult Equals Op (IAdd idResultType | SpecConstantOp idResultType IAdd) operand1 operand2; +opFAdd : idResult Equals Op (FAdd idResultType | SpecConstantOp idResultType FAdd) operand1 operand2; +opISub : idResult Equals Op (ISub idResultType | SpecConstantOp idResultType ISub) operand1 operand2; +opFSub : idResult Equals Op (FSub idResultType | SpecConstantOp idResultType FSub) operand1 operand2; +opIMul : idResult Equals Op (IMul idResultType | SpecConstantOp idResultType IMul) operand1 operand2; +opFMul : idResult Equals Op (FMul idResultType | SpecConstantOp idResultType FMul) operand1 operand2; +opUDiv : idResult Equals Op (UDiv idResultType | SpecConstantOp idResultType UDiv) operand1 operand2; +opSDiv : idResult Equals Op (SDiv idResultType | SpecConstantOp idResultType SDiv) operand1 operand2; +opFDiv : idResult Equals Op (FDiv idResultType | SpecConstantOp idResultType FDiv) operand1 operand2; +opUMod : idResult Equals Op (UMod idResultType | SpecConstantOp idResultType UMod) operand1 operand2; +opSRem : idResult Equals Op (SRem idResultType | SpecConstantOp idResultType SRem) operand1 operand2; +opSMod : idResult Equals Op (SMod idResultType | SpecConstantOp idResultType SMod) operand1 operand2; +opFRem : idResult Equals Op (FRem idResultType | SpecConstantOp idResultType FRem) operand1 operand2; +opFMod : idResult Equals Op (FMod idResultType | SpecConstantOp idResultType FMod) operand1 operand2; +opVectorTimesScalar : idResult Equals Op (VectorTimesScalar idResultType | SpecConstantOp idResultType VectorTimesScalar) vectorIdRef scalar; +opMatrixTimesScalar : idResult Equals Op (MatrixTimesScalar idResultType | SpecConstantOp idResultType MatrixTimesScalar) matrix scalar; +opVectorTimesMatrix : idResult Equals Op (VectorTimesMatrix idResultType | SpecConstantOp idResultType VectorTimesMatrix) vectorIdRef matrix; +opMatrixTimesVector : idResult Equals Op (MatrixTimesVector idResultType | SpecConstantOp idResultType MatrixTimesVector) matrix vectorIdRef; +opMatrixTimesMatrix : idResult Equals Op (MatrixTimesMatrix idResultType | SpecConstantOp idResultType MatrixTimesMatrix) leftMatrix rightMatrix; +opOuterProduct : idResult Equals Op (OuterProduct idResultType | SpecConstantOp idResultType OuterProduct) vector1 vector2; +opDot : idResult Equals Op (Dot idResultType | SpecConstantOp idResultType Dot) vector1 vector2; +opIAddCarry : idResult Equals Op (IAddCarry idResultType | SpecConstantOp idResultType IAddCarry) operand1 operand2; +opISubBorrow : idResult Equals Op (ISubBorrow idResultType | SpecConstantOp idResultType ISubBorrow) operand1 operand2; +opUMulExtended : idResult Equals Op (UMulExtended idResultType | SpecConstantOp idResultType UMulExtended) operand1 operand2; +opSMulExtended : idResult Equals Op (SMulExtended idResultType | SpecConstantOp idResultType SMulExtended) operand1 operand2; +opSDot : idResult Equals Op (SDot idResultType | SpecConstantOp idResultType SDot) vector1 vector2 packedVectorFormat?; +opSDotKHR : idResult Equals Op (SDotKHR idResultType | SpecConstantOp idResultType SDotKHR) vector1 vector2 packedVectorFormat?; +opUDot : idResult Equals Op (UDot idResultType | SpecConstantOp idResultType UDot) vector1 vector2 packedVectorFormat?; +opUDotKHR : idResult Equals Op (UDotKHR idResultType | SpecConstantOp idResultType UDotKHR) vector1 vector2 packedVectorFormat?; +opSUDot : idResult Equals Op (SUDot idResultType | SpecConstantOp idResultType SUDot) vector1 vector2 packedVectorFormat?; +opSUDotKHR : idResult Equals Op (SUDotKHR idResultType | SpecConstantOp idResultType SUDotKHR) vector1 vector2 packedVectorFormat?; +opSDotAccSat : idResult Equals Op (SDotAccSat idResultType | SpecConstantOp idResultType SDotAccSat) vector1 vector2 accumulator packedVectorFormat?; +opSDotAccSatKHR : idResult Equals Op (SDotAccSatKHR idResultType | SpecConstantOp idResultType SDotAccSatKHR) vector1 vector2 accumulator packedVectorFormat?; +opUDotAccSat : idResult Equals Op (UDotAccSat idResultType | SpecConstantOp idResultType UDotAccSat) vector1 vector2 accumulator packedVectorFormat?; +opUDotAccSatKHR : idResult Equals Op (UDotAccSatKHR idResultType | SpecConstantOp idResultType UDotAccSatKHR) vector1 vector2 accumulator packedVectorFormat?; +opSUDotAccSat : idResult Equals Op (SUDotAccSat idResultType | SpecConstantOp idResultType SUDotAccSat) vector1 vector2 accumulator packedVectorFormat?; +opSUDotAccSatKHR : idResult Equals Op (SUDotAccSatKHR idResultType | SpecConstantOp idResultType SUDotAccSatKHR) vector1 vector2 accumulator packedVectorFormat?; +opCooperativeMatrixMulAddKHR : idResult Equals Op (CooperativeMatrixMulAddKHR idResultType | SpecConstantOp idResultType CooperativeMatrixMulAddKHR) a b c cooperativeMatrixOperands?; + +// Atomic Operations +opAtomicLoad : idResult Equals Op (AtomicLoad idResultType | SpecConstantOp idResultType AtomicLoad) pointer memory semantics; +opAtomicStore : Op AtomicStore pointer memory semantics valueIdRef; +opAtomicExchange : idResult Equals Op (AtomicExchange idResultType | SpecConstantOp idResultType AtomicExchange) pointer memory semantics valueIdRef; +opAtomicCompareExchange : idResult Equals Op (AtomicCompareExchange idResultType | SpecConstantOp idResultType AtomicCompareExchange) pointer memory equal unequal valueIdRef comparator; +opAtomicCompareExchangeWeak : idResult Equals Op (AtomicCompareExchangeWeak idResultType | SpecConstantOp idResultType AtomicCompareExchangeWeak) pointer memory equal unequal valueIdRef comparator; +opAtomicIIncrement : idResult Equals Op (AtomicIIncrement idResultType | SpecConstantOp idResultType AtomicIIncrement) pointer memory semantics; +opAtomicIDecrement : idResult Equals Op (AtomicIDecrement idResultType | SpecConstantOp idResultType AtomicIDecrement) pointer memory semantics; +opAtomicIAdd : idResult Equals Op (AtomicIAdd idResultType | SpecConstantOp idResultType AtomicIAdd) pointer memory semantics valueIdRef; +opAtomicISub : idResult Equals Op (AtomicISub idResultType | SpecConstantOp idResultType AtomicISub) pointer memory semantics valueIdRef; +opAtomicSMin : idResult Equals Op (AtomicSMin idResultType | SpecConstantOp idResultType AtomicSMin) pointer memory semantics valueIdRef; +opAtomicUMin : idResult Equals Op (AtomicUMin idResultType | SpecConstantOp idResultType AtomicUMin) pointer memory semantics valueIdRef; +opAtomicSMax : idResult Equals Op (AtomicSMax idResultType | SpecConstantOp idResultType AtomicSMax) pointer memory semantics valueIdRef; +opAtomicUMax : idResult Equals Op (AtomicUMax idResultType | SpecConstantOp idResultType AtomicUMax) pointer memory semantics valueIdRef; +opAtomicAnd : idResult Equals Op (AtomicAnd idResultType | SpecConstantOp idResultType AtomicAnd) pointer memory semantics valueIdRef; +opAtomicOr : idResult Equals Op (AtomicOr idResultType | SpecConstantOp idResultType AtomicOr) pointer memory semantics valueIdRef; +opAtomicXor : idResult Equals Op (AtomicXor idResultType | SpecConstantOp idResultType AtomicXor) pointer memory semantics valueIdRef; +opAtomicFlagTestAndSet : idResult Equals Op (AtomicFlagTestAndSet idResultType | SpecConstantOp idResultType AtomicFlagTestAndSet) pointer memory semantics; +opAtomicFlagClear : Op AtomicFlagClear pointer memory semantics; +opAtomicFMinEXT : idResult Equals Op (AtomicFMinEXT idResultType | SpecConstantOp idResultType AtomicFMinEXT) pointer memory semantics valueIdRef; +opAtomicFMaxEXT : idResult Equals Op (AtomicFMaxEXT idResultType | SpecConstantOp idResultType AtomicFMaxEXT) pointer memory semantics valueIdRef; +opAtomicFAddEXT : idResult Equals Op (AtomicFAddEXT idResultType | SpecConstantOp idResultType AtomicFAddEXT) pointer memory semantics valueIdRef; + +// Barrier Operations +opControlBarrier : Op ControlBarrier execution memory semantics; +opMemoryBarrier : Op MemoryBarrier memory semantics; +opNamedBarrierInitialize : idResult Equals Op (NamedBarrierInitialize idResultType | SpecConstantOp idResultType NamedBarrierInitialize) subgroupCount; +opMemoryNamedBarrier : Op MemoryNamedBarrier namedBarrier memory semantics; +opControlBarrierArriveINTEL : Op ControlBarrierArriveINTEL execution memory semantics; +opControlBarrierWaitINTEL : Op ControlBarrierWaitINTEL execution memory semantics; + +// Bit Operations +opShiftRightLogical : idResult Equals Op (ShiftRightLogical idResultType | SpecConstantOp idResultType ShiftRightLogical) base shift; +opShiftRightArithmetic : idResult Equals Op (ShiftRightArithmetic idResultType | SpecConstantOp idResultType ShiftRightArithmetic) base shift; +opShiftLeftLogical : idResult Equals Op (ShiftLeftLogical idResultType | SpecConstantOp idResultType ShiftLeftLogical) base shift; +opBitwiseOr : idResult Equals Op (BitwiseOr idResultType | SpecConstantOp idResultType BitwiseOr) operand1 operand2; +opBitwiseXor : idResult Equals Op (BitwiseXor idResultType | SpecConstantOp idResultType BitwiseXor) operand1 operand2; +opBitwiseAnd : idResult Equals Op (BitwiseAnd idResultType | SpecConstantOp idResultType BitwiseAnd) operand1 operand2; +opNot : idResult Equals Op (Not idResultType | SpecConstantOp idResultType Not) operand; +opBitFieldInsert : idResult Equals Op (BitFieldInsert idResultType | SpecConstantOp idResultType BitFieldInsert) base insert offsetIdRef count; +opBitFieldSExtract : idResult Equals Op (BitFieldSExtract idResultType | SpecConstantOp idResultType BitFieldSExtract) base offsetIdRef count; +opBitFieldUExtract : idResult Equals Op (BitFieldUExtract idResultType | SpecConstantOp idResultType BitFieldUExtract) base offsetIdRef count; +opBitReverse : idResult Equals Op (BitReverse idResultType | SpecConstantOp idResultType BitReverse) base; +opBitCount : idResult Equals Op (BitCount idResultType | SpecConstantOp idResultType BitCount) base; + +// Composite Operations +opVectorExtractDynamic : idResult Equals Op (VectorExtractDynamic idResultType | SpecConstantOp idResultType VectorExtractDynamic) vectorIdRef indexIdRef; +opVectorInsertDynamic : idResult Equals Op (VectorInsertDynamic idResultType | SpecConstantOp idResultType VectorInsertDynamic) vectorIdRef componentIdRef indexIdRef; +opVectorShuffle : idResult Equals Op (VectorShuffle idResultType | SpecConstantOp idResultType VectorShuffle) vector1 vector2 components*; +opCompositeConstruct : idResult Equals Op (CompositeConstruct idResultType | SpecConstantOp idResultType CompositeConstruct) constituents*; +opCompositeExtract : idResult Equals Op (CompositeExtract idResultType | SpecConstantOp idResultType CompositeExtract) composite indexesLiteralInteger*; +opCompositeInsert : idResult Equals Op (CompositeInsert idResultType | SpecConstantOp idResultType CompositeInsert) object composite indexesLiteralInteger*; +opCopyObject : idResult Equals Op (CopyObject idResultType | SpecConstantOp idResultType CopyObject) operand; +opTranspose : idResult Equals Op (Transpose idResultType | SpecConstantOp idResultType Transpose) matrix; +opCopyLogical : idResult Equals Op (CopyLogical idResultType | SpecConstantOp idResultType CopyLogical) operand; +opCompositeConstructContinuedINTEL : idResult Equals Op (CompositeConstructContinuedINTEL idResultType | SpecConstantOp idResultType CompositeConstructContinuedINTEL) constituents*; + +// Constant-Creation Operations +opConstantTrue : idResult Equals Op (ConstantTrue idResultType | SpecConstantOp idResultType ConstantTrue); +opConstantFalse : idResult Equals Op (ConstantFalse idResultType | SpecConstantOp idResultType ConstantFalse); +opConstant : idResult Equals Op (Constant idResultType | SpecConstantOp idResultType Constant) valueLiteralContextDependentNumber; +opConstantComposite : idResult Equals Op (ConstantComposite idResultType | SpecConstantOp idResultType ConstantComposite) constituents*; +opConstantSampler : idResult Equals Op (ConstantSampler idResultType | SpecConstantOp idResultType ConstantSampler) samplerAddressingMode paramLiteralInteger samplerFilterMode; +opConstantNull : idResult Equals Op (ConstantNull idResultType | SpecConstantOp idResultType ConstantNull); +opSpecConstantTrue : idResult Equals Op (SpecConstantTrue idResultType | SpecConstantOp idResultType SpecConstantTrue); +opSpecConstantFalse : idResult Equals Op (SpecConstantFalse idResultType | SpecConstantOp idResultType SpecConstantFalse); +opSpecConstant : idResult Equals Op (SpecConstant idResultType | SpecConstantOp idResultType SpecConstant) valueLiteralContextDependentNumber; +opSpecConstantComposite : idResult Equals Op (SpecConstantComposite idResultType | SpecConstantOp idResultType SpecConstantComposite) constituents*; +opConstantCompositeContinuedINTEL : Op ConstantCompositeContinuedINTEL constituents*; +opSpecConstantCompositeContinuedINTEL : Op SpecConstantCompositeContinuedINTEL constituents*; + +// Control-Flow Operations +opPhi : idResult Equals Op (Phi idResultType | SpecConstantOp idResultType Phi) variable*; +opLoopMerge : Op LoopMerge mergeBlock continueTarget loopControl; +opSelectionMerge : Op SelectionMerge mergeBlock selectionControl; +opLabel : idResult Equals Op (Label | SpecConstantOp Label); +opBranch : Op Branch targetLabel; +opBranchConditional : Op BranchConditional condition trueLabel falseLabel branchWeights*; +opSwitch : Op Switch selector default targetPairLiteralIntegerIdRef*; +opKill : Op Kill; +opReturn : Op Return; +opReturnValue : Op ReturnValue valueIdRef; +opUnreachable : Op Unreachable; +opLifetimeStart : Op LifetimeStart pointer sizeLiteralInteger; +opLifetimeStop : Op LifetimeStop pointer sizeLiteralInteger; +opTerminateInvocation : Op TerminateInvocation; +opDemoteToHelperInvocation : Op DemoteToHelperInvocation; +opDemoteToHelperInvocationEXT : Op DemoteToHelperInvocationEXT; + +// Conversion Operations +opConvertFToU : idResult Equals Op (ConvertFToU idResultType | SpecConstantOp idResultType ConvertFToU) floatValue; +opConvertFToS : idResult Equals Op (ConvertFToS idResultType | SpecConstantOp idResultType ConvertFToS) floatValue; +opConvertSToF : idResult Equals Op (ConvertSToF idResultType | SpecConstantOp idResultType ConvertSToF) signedValue; +opConvertUToF : idResult Equals Op (ConvertUToF idResultType | SpecConstantOp idResultType ConvertUToF) unsignedValue; +opUConvert : idResult Equals Op (UConvert idResultType | SpecConstantOp idResultType UConvert) unsignedValue; +opSConvert : idResult Equals Op (SConvert idResultType | SpecConstantOp idResultType SConvert) signedValue; +opFConvert : idResult Equals Op (FConvert idResultType | SpecConstantOp idResultType FConvert) floatValue; +opQuantizeToF16 : idResult Equals Op (QuantizeToF16 idResultType | SpecConstantOp idResultType QuantizeToF16) valueIdRef; +opConvertPtrToU : idResult Equals Op (ConvertPtrToU idResultType | SpecConstantOp idResultType ConvertPtrToU) pointer; +opSatConvertSToU : idResult Equals Op (SatConvertSToU idResultType | SpecConstantOp idResultType SatConvertSToU) signedValue; +opSatConvertUToS : idResult Equals Op (SatConvertUToS idResultType | SpecConstantOp idResultType SatConvertUToS) unsignedValue; +opConvertUToPtr : idResult Equals Op (ConvertUToPtr idResultType | SpecConstantOp idResultType ConvertUToPtr) integerValue; +opPtrCastToGeneric : idResult Equals Op (PtrCastToGeneric idResultType | SpecConstantOp idResultType PtrCastToGeneric) pointer; +opGenericCastToPtr : idResult Equals Op (GenericCastToPtr idResultType | SpecConstantOp idResultType GenericCastToPtr) pointer; +opGenericCastToPtrExplicit : idResult Equals Op (GenericCastToPtrExplicit idResultType | SpecConstantOp idResultType GenericCastToPtrExplicit) pointer storage; +opBitcast : idResult Equals Op (Bitcast idResultType | SpecConstantOp idResultType Bitcast) operand; +opConvertFToBF16INTEL : idResult Equals Op (ConvertFToBF16INTEL idResultType | SpecConstantOp idResultType ConvertFToBF16INTEL) floatValue; +opConvertBF16ToFINTEL : idResult Equals Op (ConvertBF16ToFINTEL idResultType | SpecConstantOp idResultType ConvertBF16ToFINTEL) bFloat16Value; + +// Debug Operations +opSourceContinued : Op SourceContinued continuedSource; +opSource : Op Source sourceLanguage version file? sourceLiteralString?; +opSourceExtension : Op SourceExtension extension; +opName : Op Name targetIdRef nameLiteralString; +opMemberName : Op MemberName type member nameLiteralString; +opString : idResult Equals Op (String | SpecConstantOp String) string; +opLine : Op Line file line column; +opNoLine : Op NoLine; +opModuleProcessed : Op ModuleProcessed process; + +// Derivative Operations +opDPdx : idResult Equals Op (DPdx idResultType | SpecConstantOp idResultType DPdx) p; +opDPdy : idResult Equals Op (DPdy idResultType | SpecConstantOp idResultType DPdy) p; +opFwidth : idResult Equals Op (Fwidth idResultType | SpecConstantOp idResultType Fwidth) p; +opDPdxFine : idResult Equals Op (DPdxFine idResultType | SpecConstantOp idResultType DPdxFine) p; +opDPdyFine : idResult Equals Op (DPdyFine idResultType | SpecConstantOp idResultType DPdyFine) p; +opFwidthFine : idResult Equals Op (FwidthFine idResultType | SpecConstantOp idResultType FwidthFine) p; +opDPdxCoarse : idResult Equals Op (DPdxCoarse idResultType | SpecConstantOp idResultType DPdxCoarse) p; +opDPdyCoarse : idResult Equals Op (DPdyCoarse idResultType | SpecConstantOp idResultType DPdyCoarse) p; +opFwidthCoarse : idResult Equals Op (FwidthCoarse idResultType | SpecConstantOp idResultType FwidthCoarse) p; + +// Device-Side_Enqueue Operations +opEnqueueMarker : idResult Equals Op (EnqueueMarker idResultType | SpecConstantOp idResultType EnqueueMarker) queue numEvents waitEvents retEvent; +opEnqueueKernel : idResult Equals Op (EnqueueKernel idResultType | SpecConstantOp idResultType EnqueueKernel) queue flags nDRange numEvents waitEvents retEvent invoke paramIdRef paramSize paramAlign localSize*; +opGetKernelNDrangeSubGroupCount : idResult Equals Op (GetKernelNDrangeSubGroupCount idResultType | SpecConstantOp idResultType GetKernelNDrangeSubGroupCount) nDRange invoke paramIdRef paramSize paramAlign; +opGetKernelNDrangeMaxSubGroupSize : idResult Equals Op (GetKernelNDrangeMaxSubGroupSize idResultType | SpecConstantOp idResultType GetKernelNDrangeMaxSubGroupSize) nDRange invoke paramIdRef paramSize paramAlign; +opGetKernelWorkGroupSize : idResult Equals Op (GetKernelWorkGroupSize idResultType | SpecConstantOp idResultType GetKernelWorkGroupSize) invoke paramIdRef paramSize paramAlign; +opGetKernelPreferredWorkGroupSizeMultiple : idResult Equals Op (GetKernelPreferredWorkGroupSizeMultiple idResultType | SpecConstantOp idResultType GetKernelPreferredWorkGroupSizeMultiple) invoke paramIdRef paramSize paramAlign; +opRetainEvent : Op RetainEvent event; +opReleaseEvent : Op ReleaseEvent event; +opCreateUserEvent : idResult Equals Op (CreateUserEvent idResultType | SpecConstantOp idResultType CreateUserEvent); +opIsValidEvent : idResult Equals Op (IsValidEvent idResultType | SpecConstantOp idResultType IsValidEvent) event; +opSetUserEventStatus : Op SetUserEventStatus event status; +opCaptureEventProfilingInfo : Op CaptureEventProfilingInfo event profilingInfo valueIdRef; +opGetDefaultQueue : idResult Equals Op (GetDefaultQueue idResultType | SpecConstantOp idResultType GetDefaultQueue); +opBuildNDRange : idResult Equals Op (BuildNDRange idResultType | SpecConstantOp idResultType BuildNDRange) globalWorkSize localWorkSize globalWorkOffset; +opGetKernelLocalSizeForSubgroupCount : idResult Equals Op (GetKernelLocalSizeForSubgroupCount idResultType | SpecConstantOp idResultType GetKernelLocalSizeForSubgroupCount) subgroupCount invoke paramIdRef paramSize paramAlign; +opGetKernelMaxNumSubgroups : idResult Equals Op (GetKernelMaxNumSubgroups idResultType | SpecConstantOp idResultType GetKernelMaxNumSubgroups) invoke paramIdRef paramSize paramAlign; + +// Extension Operations +opExtension : Op Extension nameLiteralString; +opExtInstImport : idResult Equals Op (ExtInstImport | SpecConstantOp ExtInstImport) nameLiteralString; +opExtInst : idResult Equals Op (ExtInst idResultType | SpecConstantOp idResultType ExtInst) set instruction; + +// Function Operations +opFunction : idResult Equals Op (Function idResultType | SpecConstantOp idResultType Function) functionControl (Pipe functionControl)* functionType; +opFunctionParameter : idResult Equals Op (FunctionParameter idResultType | SpecConstantOp idResultType FunctionParameter); +opFunctionEnd : Op FunctionEnd; +opFunctionCall : idResult Equals Op (FunctionCall idResultType | SpecConstantOp idResultType FunctionCall) function argument*; + +// Group Operations +opGroupAsyncCopy : idResult Equals Op (GroupAsyncCopy idResultType | SpecConstantOp idResultType GroupAsyncCopy) execution destination sourceIdRef numElements stride event; +opGroupWaitEvents : Op GroupWaitEvents execution numEvents eventsList; +opGroupAll : idResult Equals Op (GroupAll idResultType | SpecConstantOp idResultType GroupAll) execution predicate; +opGroupAny : idResult Equals Op (GroupAny idResultType | SpecConstantOp idResultType GroupAny) execution predicate; +opGroupBroadcast : idResult Equals Op (GroupBroadcast idResultType | SpecConstantOp idResultType GroupBroadcast) execution valueIdRef localId; +opGroupIAdd : idResult Equals Op (GroupIAdd idResultType | SpecConstantOp idResultType GroupIAdd) execution operation x; +opGroupFAdd : idResult Equals Op (GroupFAdd idResultType | SpecConstantOp idResultType GroupFAdd) execution operation x; +opGroupFMin : idResult Equals Op (GroupFMin idResultType | SpecConstantOp idResultType GroupFMin) execution operation x; +opGroupUMin : idResult Equals Op (GroupUMin idResultType | SpecConstantOp idResultType GroupUMin) execution operation x; +opGroupSMin : idResult Equals Op (GroupSMin idResultType | SpecConstantOp idResultType GroupSMin) execution operation x; +opGroupFMax : idResult Equals Op (GroupFMax idResultType | SpecConstantOp idResultType GroupFMax) execution operation x; +opGroupUMax : idResult Equals Op (GroupUMax idResultType | SpecConstantOp idResultType GroupUMax) execution operation x; +opGroupSMax : idResult Equals Op (GroupSMax idResultType | SpecConstantOp idResultType GroupSMax) execution operation x; +opSubgroupBallotKHR : idResult Equals Op (SubgroupBallotKHR idResultType | SpecConstantOp idResultType SubgroupBallotKHR) predicate; +opSubgroupFirstInvocationKHR : idResult Equals Op (SubgroupFirstInvocationKHR idResultType | SpecConstantOp idResultType SubgroupFirstInvocationKHR) valueIdRef; +opSubgroupAllKHR : idResult Equals Op (SubgroupAllKHR idResultType | SpecConstantOp idResultType SubgroupAllKHR) predicate; +opSubgroupAnyKHR : idResult Equals Op (SubgroupAnyKHR idResultType | SpecConstantOp idResultType SubgroupAnyKHR) predicate; +opSubgroupAllEqualKHR : idResult Equals Op (SubgroupAllEqualKHR idResultType | SpecConstantOp idResultType SubgroupAllEqualKHR) predicate; +opGroupNonUniformRotateKHR : idResult Equals Op (GroupNonUniformRotateKHR idResultType | SpecConstantOp idResultType GroupNonUniformRotateKHR) execution valueIdRef delta clusterSize?; +opSubgroupReadInvocationKHR : idResult Equals Op (SubgroupReadInvocationKHR idResultType | SpecConstantOp idResultType SubgroupReadInvocationKHR) valueIdRef indexIdRef; +opGroupIAddNonUniformAMD : idResult Equals Op (GroupIAddNonUniformAMD idResultType | SpecConstantOp idResultType GroupIAddNonUniformAMD) execution operation x; +opGroupFAddNonUniformAMD : idResult Equals Op (GroupFAddNonUniformAMD idResultType | SpecConstantOp idResultType GroupFAddNonUniformAMD) execution operation x; +opGroupFMinNonUniformAMD : idResult Equals Op (GroupFMinNonUniformAMD idResultType | SpecConstantOp idResultType GroupFMinNonUniformAMD) execution operation x; +opGroupUMinNonUniformAMD : idResult Equals Op (GroupUMinNonUniformAMD idResultType | SpecConstantOp idResultType GroupUMinNonUniformAMD) execution operation x; +opGroupSMinNonUniformAMD : idResult Equals Op (GroupSMinNonUniformAMD idResultType | SpecConstantOp idResultType GroupSMinNonUniformAMD) execution operation x; +opGroupFMaxNonUniformAMD : idResult Equals Op (GroupFMaxNonUniformAMD idResultType | SpecConstantOp idResultType GroupFMaxNonUniformAMD) execution operation x; +opGroupUMaxNonUniformAMD : idResult Equals Op (GroupUMaxNonUniformAMD idResultType | SpecConstantOp idResultType GroupUMaxNonUniformAMD) execution operation x; +opGroupSMaxNonUniformAMD : idResult Equals Op (GroupSMaxNonUniformAMD idResultType | SpecConstantOp idResultType GroupSMaxNonUniformAMD) execution operation x; +opSubgroupShuffleINTEL : idResult Equals Op (SubgroupShuffleINTEL idResultType | SpecConstantOp idResultType SubgroupShuffleINTEL) data invocationId; +opSubgroupShuffleDownINTEL : idResult Equals Op (SubgroupShuffleDownINTEL idResultType | SpecConstantOp idResultType SubgroupShuffleDownINTEL) current next delta; +opSubgroupShuffleUpINTEL : idResult Equals Op (SubgroupShuffleUpINTEL idResultType | SpecConstantOp idResultType SubgroupShuffleUpINTEL) previous current delta; +opSubgroupShuffleXorINTEL : idResult Equals Op (SubgroupShuffleXorINTEL idResultType | SpecConstantOp idResultType SubgroupShuffleXorINTEL) data valueIdRef; +opSubgroupBlockReadINTEL : idResult Equals Op (SubgroupBlockReadINTEL idResultType | SpecConstantOp idResultType SubgroupBlockReadINTEL) ptr; +opSubgroupBlockWriteINTEL : Op SubgroupBlockWriteINTEL ptr data; +opSubgroupImageBlockReadINTEL : idResult Equals Op (SubgroupImageBlockReadINTEL idResultType | SpecConstantOp idResultType SubgroupImageBlockReadINTEL) image coordinate; +opSubgroupImageBlockWriteINTEL : Op SubgroupImageBlockWriteINTEL image coordinate data; +opSubgroupImageMediaBlockReadINTEL : idResult Equals Op (SubgroupImageMediaBlockReadINTEL idResultType | SpecConstantOp idResultType SubgroupImageMediaBlockReadINTEL) image coordinate widthIdRef height; +opSubgroupImageMediaBlockWriteINTEL : Op SubgroupImageMediaBlockWriteINTEL image coordinate widthIdRef height data; +opGroupIMulKHR : idResult Equals Op (GroupIMulKHR idResultType | SpecConstantOp idResultType GroupIMulKHR) execution operation x; +opGroupFMulKHR : idResult Equals Op (GroupFMulKHR idResultType | SpecConstantOp idResultType GroupFMulKHR) execution operation x; +opGroupBitwiseAndKHR : idResult Equals Op (GroupBitwiseAndKHR idResultType | SpecConstantOp idResultType GroupBitwiseAndKHR) execution operation x; +opGroupBitwiseOrKHR : idResult Equals Op (GroupBitwiseOrKHR idResultType | SpecConstantOp idResultType GroupBitwiseOrKHR) execution operation x; +opGroupBitwiseXorKHR : idResult Equals Op (GroupBitwiseXorKHR idResultType | SpecConstantOp idResultType GroupBitwiseXorKHR) execution operation x; +opGroupLogicalAndKHR : idResult Equals Op (GroupLogicalAndKHR idResultType | SpecConstantOp idResultType GroupLogicalAndKHR) execution operation x; +opGroupLogicalOrKHR : idResult Equals Op (GroupLogicalOrKHR idResultType | SpecConstantOp idResultType GroupLogicalOrKHR) execution operation x; +opGroupLogicalXorKHR : idResult Equals Op (GroupLogicalXorKHR idResultType | SpecConstantOp idResultType GroupLogicalXorKHR) execution operation x; + +// Image Operations +opSampledImage : idResult Equals Op (SampledImage idResultType | SpecConstantOp idResultType SampledImage) image sampler; +opImageSampleImplicitLod : idResult Equals Op (ImageSampleImplicitLod idResultType | SpecConstantOp idResultType ImageSampleImplicitLod) sampledImage coordinate imageOperands?; +opImageSampleExplicitLod : idResult Equals Op (ImageSampleExplicitLod idResultType | SpecConstantOp idResultType ImageSampleExplicitLod) sampledImage coordinate imageOperands; +opImageSampleDrefImplicitLod : idResult Equals Op (ImageSampleDrefImplicitLod idResultType | SpecConstantOp idResultType ImageSampleDrefImplicitLod) sampledImage coordinate d imageOperands?; +opImageSampleDrefExplicitLod : idResult Equals Op (ImageSampleDrefExplicitLod idResultType | SpecConstantOp idResultType ImageSampleDrefExplicitLod) sampledImage coordinate d imageOperands; +opImageSampleProjImplicitLod : idResult Equals Op (ImageSampleProjImplicitLod idResultType | SpecConstantOp idResultType ImageSampleProjImplicitLod) sampledImage coordinate imageOperands?; +opImageSampleProjExplicitLod : idResult Equals Op (ImageSampleProjExplicitLod idResultType | SpecConstantOp idResultType ImageSampleProjExplicitLod) sampledImage coordinate imageOperands; +opImageSampleProjDrefImplicitLod : idResult Equals Op (ImageSampleProjDrefImplicitLod idResultType | SpecConstantOp idResultType ImageSampleProjDrefImplicitLod) sampledImage coordinate d imageOperands?; +opImageSampleProjDrefExplicitLod : idResult Equals Op (ImageSampleProjDrefExplicitLod idResultType | SpecConstantOp idResultType ImageSampleProjDrefExplicitLod) sampledImage coordinate d imageOperands; +opImageFetch : idResult Equals Op (ImageFetch idResultType | SpecConstantOp idResultType ImageFetch) image coordinate imageOperands?; +opImageGather : idResult Equals Op (ImageGather idResultType | SpecConstantOp idResultType ImageGather) sampledImage coordinate componentIdRef imageOperands?; +opImageDrefGather : idResult Equals Op (ImageDrefGather idResultType | SpecConstantOp idResultType ImageDrefGather) sampledImage coordinate d imageOperands?; +opImageRead : idResult Equals Op (ImageRead idResultType | SpecConstantOp idResultType ImageRead) image coordinate imageOperands?; +opImageWrite : Op ImageWrite image coordinate texel imageOperands?; +opImage : idResult Equals Op (Image idResultType | SpecConstantOp idResultType Image) sampledImage; +opImageQueryFormat : idResult Equals Op (ImageQueryFormat idResultType | SpecConstantOp idResultType ImageQueryFormat) image; +opImageQueryOrder : idResult Equals Op (ImageQueryOrder idResultType | SpecConstantOp idResultType ImageQueryOrder) image; +opImageQuerySizeLod : idResult Equals Op (ImageQuerySizeLod idResultType | SpecConstantOp idResultType ImageQuerySizeLod) image levelOfDetail; +opImageQuerySize : idResult Equals Op (ImageQuerySize idResultType | SpecConstantOp idResultType ImageQuerySize) image; +opImageQueryLod : idResult Equals Op (ImageQueryLod idResultType | SpecConstantOp idResultType ImageQueryLod) sampledImage coordinate; +opImageQueryLevels : idResult Equals Op (ImageQueryLevels idResultType | SpecConstantOp idResultType ImageQueryLevels) image; +opImageQuerySamples : idResult Equals Op (ImageQuerySamples idResultType | SpecConstantOp idResultType ImageQuerySamples) image; +opImageSparseSampleImplicitLod : idResult Equals Op (ImageSparseSampleImplicitLod idResultType | SpecConstantOp idResultType ImageSparseSampleImplicitLod) sampledImage coordinate imageOperands?; +opImageSparseSampleExplicitLod : idResult Equals Op (ImageSparseSampleExplicitLod idResultType | SpecConstantOp idResultType ImageSparseSampleExplicitLod) sampledImage coordinate imageOperands; +opImageSparseSampleDrefImplicitLod : idResult Equals Op (ImageSparseSampleDrefImplicitLod idResultType | SpecConstantOp idResultType ImageSparseSampleDrefImplicitLod) sampledImage coordinate d imageOperands?; +opImageSparseSampleDrefExplicitLod : idResult Equals Op (ImageSparseSampleDrefExplicitLod idResultType | SpecConstantOp idResultType ImageSparseSampleDrefExplicitLod) sampledImage coordinate d imageOperands; +opImageSparseSampleProjImplicitLod : idResult Equals Op (ImageSparseSampleProjImplicitLod idResultType | SpecConstantOp idResultType ImageSparseSampleProjImplicitLod) sampledImage coordinate imageOperands?; +opImageSparseSampleProjExplicitLod : idResult Equals Op (ImageSparseSampleProjExplicitLod idResultType | SpecConstantOp idResultType ImageSparseSampleProjExplicitLod) sampledImage coordinate imageOperands; +opImageSparseSampleProjDrefImplicitLod : idResult Equals Op (ImageSparseSampleProjDrefImplicitLod idResultType | SpecConstantOp idResultType ImageSparseSampleProjDrefImplicitLod) sampledImage coordinate d imageOperands?; +opImageSparseSampleProjDrefExplicitLod : idResult Equals Op (ImageSparseSampleProjDrefExplicitLod idResultType | SpecConstantOp idResultType ImageSparseSampleProjDrefExplicitLod) sampledImage coordinate d imageOperands; +opImageSparseFetch : idResult Equals Op (ImageSparseFetch idResultType | SpecConstantOp idResultType ImageSparseFetch) image coordinate imageOperands?; +opImageSparseGather : idResult Equals Op (ImageSparseGather idResultType | SpecConstantOp idResultType ImageSparseGather) sampledImage coordinate componentIdRef imageOperands?; +opImageSparseDrefGather : idResult Equals Op (ImageSparseDrefGather idResultType | SpecConstantOp idResultType ImageSparseDrefGather) sampledImage coordinate d imageOperands?; +opImageSparseTexelsResident : idResult Equals Op (ImageSparseTexelsResident idResultType | SpecConstantOp idResultType ImageSparseTexelsResident) residentCode; +opImageSparseRead : idResult Equals Op (ImageSparseRead idResultType | SpecConstantOp idResultType ImageSparseRead) image coordinate imageOperands?; +opColorAttachmentReadEXT : idResult Equals Op (ColorAttachmentReadEXT idResultType | SpecConstantOp idResultType ColorAttachmentReadEXT) attachment sample?; +opDepthAttachmentReadEXT : idResult Equals Op (DepthAttachmentReadEXT idResultType | SpecConstantOp idResultType DepthAttachmentReadEXT) sample?; +opStencilAttachmentReadEXT : idResult Equals Op (StencilAttachmentReadEXT idResultType | SpecConstantOp idResultType StencilAttachmentReadEXT) sample?; +opImageSampleWeightedQCOM : idResult Equals Op (ImageSampleWeightedQCOM idResultType | SpecConstantOp idResultType ImageSampleWeightedQCOM) texture coordinates weights; +opImageBoxFilterQCOM : idResult Equals Op (ImageBoxFilterQCOM idResultType | SpecConstantOp idResultType ImageBoxFilterQCOM) texture coordinates boxSize; +opImageBlockMatchSSDQCOM : idResult Equals Op (ImageBlockMatchSSDQCOM idResultType | SpecConstantOp idResultType ImageBlockMatchSSDQCOM) targetIdRef targetCoordinates reference referenceCoordinates blockSize; +opImageBlockMatchSADQCOM : idResult Equals Op (ImageBlockMatchSADQCOM idResultType | SpecConstantOp idResultType ImageBlockMatchSADQCOM) targetIdRef targetCoordinates reference referenceCoordinates blockSize; +opImageSampleFootprintNV : idResult Equals Op (ImageSampleFootprintNV idResultType | SpecConstantOp idResultType ImageSampleFootprintNV) sampledImage coordinate granularity coarse imageOperands?; + +// Memory Operations +opVariable : idResult Equals Op (Variable idResultType | SpecConstantOp idResultType Variable) storageClass initializer?; +opImageTexelPointer : idResult Equals Op (ImageTexelPointer idResultType | SpecConstantOp idResultType ImageTexelPointer) image coordinate sample; +opLoad : idResult Equals Op (Load idResultType | SpecConstantOp idResultType Load) pointer memoryAccess?; +opStore : Op Store pointer object memoryAccess?; +opCopyMemory : Op CopyMemory targetIdRef sourceIdRef (memoryAccess memoryAccess?)?; +opCopyMemorySized : Op CopyMemorySized targetIdRef sourceIdRef sizeIdRef (memoryAccess memoryAccess?)?; +opAccessChain : idResult Equals Op (AccessChain idResultType | SpecConstantOp idResultType AccessChain) base indexesIdRef*; +opInBoundsAccessChain : idResult Equals Op (InBoundsAccessChain idResultType | SpecConstantOp idResultType InBoundsAccessChain) base indexesIdRef*; +opPtrAccessChain : idResult Equals Op (PtrAccessChain idResultType | SpecConstantOp idResultType PtrAccessChain) base element indexesIdRef*; +opArrayLength : idResult Equals Op (ArrayLength idResultType | SpecConstantOp idResultType ArrayLength) structure arrayMember; +opGenericPtrMemSemantics : idResult Equals Op (GenericPtrMemSemantics idResultType | SpecConstantOp idResultType GenericPtrMemSemantics) pointer; +opInBoundsPtrAccessChain : idResult Equals Op (InBoundsPtrAccessChain idResultType | SpecConstantOp idResultType InBoundsPtrAccessChain) base element indexesIdRef*; +opPtrEqual : idResult Equals Op (PtrEqual idResultType | SpecConstantOp idResultType PtrEqual) operand1 operand2; +opPtrNotEqual : idResult Equals Op (PtrNotEqual idResultType | SpecConstantOp idResultType PtrNotEqual) operand1 operand2; +opPtrDiff : idResult Equals Op (PtrDiff idResultType | SpecConstantOp idResultType PtrDiff) operand1 operand2; +opCooperativeMatrixLoadKHR : idResult Equals Op (CooperativeMatrixLoadKHR idResultType | SpecConstantOp idResultType CooperativeMatrixLoadKHR) pointer memoryLayout stride? memoryOperand?; +opCooperativeMatrixStoreKHR : Op CooperativeMatrixStoreKHR pointer object memoryLayout stride? memoryOperand?; +opMaskedGatherINTEL : idResult Equals Op (MaskedGatherINTEL idResultType | SpecConstantOp idResultType MaskedGatherINTEL) ptrVector alignmentLiteralInteger mask fillEmpty; +opMaskedScatterINTEL : Op MaskedScatterINTEL inputVector ptrVector alignmentLiteralInteger mask; + +// Miscellaneous Operations +opNop : Op Nop; +opUndef : idResult Equals Op (Undef idResultType | SpecConstantOp idResultType Undef); +opSizeOf : idResult Equals Op (SizeOf idResultType | SpecConstantOp idResultType SizeOf) pointer; +opCooperativeMatrixLengthKHR : idResult Equals Op (CooperativeMatrixLengthKHR idResultType | SpecConstantOp idResultType CooperativeMatrixLengthKHR) type; +opAssumeTrueKHR : Op AssumeTrueKHR condition; +opExpectKHR : idResult Equals Op (ExpectKHR idResultType | SpecConstantOp idResultType ExpectKHR) valueIdRef expectedValue; + +// Mode-Setting Operations +opMemoryModel : Op MemoryModel addressingModel memoryModel; +opEntryPoint : Op EntryPoint executionModel entryPoint nameLiteralString interface*; +opExecutionMode : Op ExecutionMode entryPoint modeExecutionMode; +opCapability : Op Capability capability; +opExecutionModeId : Op ExecutionModeId entryPoint modeExecutionMode; + +// Non-Uniform Operations +opGroupNonUniformElect : idResult Equals Op (GroupNonUniformElect idResultType | SpecConstantOp idResultType GroupNonUniformElect) execution; +opGroupNonUniformAll : idResult Equals Op (GroupNonUniformAll idResultType | SpecConstantOp idResultType GroupNonUniformAll) execution predicate; +opGroupNonUniformAny : idResult Equals Op (GroupNonUniformAny idResultType | SpecConstantOp idResultType GroupNonUniformAny) execution predicate; +opGroupNonUniformAllEqual : idResult Equals Op (GroupNonUniformAllEqual idResultType | SpecConstantOp idResultType GroupNonUniformAllEqual) execution valueIdRef; +opGroupNonUniformBroadcast : idResult Equals Op (GroupNonUniformBroadcast idResultType | SpecConstantOp idResultType GroupNonUniformBroadcast) execution valueIdRef id; +opGroupNonUniformBroadcastFirst : idResult Equals Op (GroupNonUniformBroadcastFirst idResultType | SpecConstantOp idResultType GroupNonUniformBroadcastFirst) execution valueIdRef; +opGroupNonUniformBallot : idResult Equals Op (GroupNonUniformBallot idResultType | SpecConstantOp idResultType GroupNonUniformBallot) execution predicate; +opGroupNonUniformInverseBallot : idResult Equals Op (GroupNonUniformInverseBallot idResultType | SpecConstantOp idResultType GroupNonUniformInverseBallot) execution valueIdRef; +opGroupNonUniformBallotBitExtract : idResult Equals Op (GroupNonUniformBallotBitExtract idResultType | SpecConstantOp idResultType GroupNonUniformBallotBitExtract) execution valueIdRef indexIdRef; +opGroupNonUniformBallotBitCount : idResult Equals Op (GroupNonUniformBallotBitCount idResultType | SpecConstantOp idResultType GroupNonUniformBallotBitCount) execution operation valueIdRef; +opGroupNonUniformBallotFindLSB : idResult Equals Op (GroupNonUniformBallotFindLSB idResultType | SpecConstantOp idResultType GroupNonUniformBallotFindLSB) execution valueIdRef; +opGroupNonUniformBallotFindMSB : idResult Equals Op (GroupNonUniformBallotFindMSB idResultType | SpecConstantOp idResultType GroupNonUniformBallotFindMSB) execution valueIdRef; +opGroupNonUniformShuffle : idResult Equals Op (GroupNonUniformShuffle idResultType | SpecConstantOp idResultType GroupNonUniformShuffle) execution valueIdRef id; +opGroupNonUniformShuffleXor : idResult Equals Op (GroupNonUniformShuffleXor idResultType | SpecConstantOp idResultType GroupNonUniformShuffleXor) execution valueIdRef mask; +opGroupNonUniformShuffleUp : idResult Equals Op (GroupNonUniformShuffleUp idResultType | SpecConstantOp idResultType GroupNonUniformShuffleUp) execution valueIdRef delta; +opGroupNonUniformShuffleDown : idResult Equals Op (GroupNonUniformShuffleDown idResultType | SpecConstantOp idResultType GroupNonUniformShuffleDown) execution valueIdRef delta; +opGroupNonUniformIAdd : idResult Equals Op (GroupNonUniformIAdd idResultType | SpecConstantOp idResultType GroupNonUniformIAdd) execution operation valueIdRef clusterSize?; +opGroupNonUniformFAdd : idResult Equals Op (GroupNonUniformFAdd idResultType | SpecConstantOp idResultType GroupNonUniformFAdd) execution operation valueIdRef clusterSize?; +opGroupNonUniformIMul : idResult Equals Op (GroupNonUniformIMul idResultType | SpecConstantOp idResultType GroupNonUniformIMul) execution operation valueIdRef clusterSize?; +opGroupNonUniformFMul : idResult Equals Op (GroupNonUniformFMul idResultType | SpecConstantOp idResultType GroupNonUniformFMul) execution operation valueIdRef clusterSize?; +opGroupNonUniformSMin : idResult Equals Op (GroupNonUniformSMin idResultType | SpecConstantOp idResultType GroupNonUniformSMin) execution operation valueIdRef clusterSize?; +opGroupNonUniformUMin : idResult Equals Op (GroupNonUniformUMin idResultType | SpecConstantOp idResultType GroupNonUniformUMin) execution operation valueIdRef clusterSize?; +opGroupNonUniformFMin : idResult Equals Op (GroupNonUniformFMin idResultType | SpecConstantOp idResultType GroupNonUniformFMin) execution operation valueIdRef clusterSize?; +opGroupNonUniformSMax : idResult Equals Op (GroupNonUniformSMax idResultType | SpecConstantOp idResultType GroupNonUniformSMax) execution operation valueIdRef clusterSize?; +opGroupNonUniformUMax : idResult Equals Op (GroupNonUniformUMax idResultType | SpecConstantOp idResultType GroupNonUniformUMax) execution operation valueIdRef clusterSize?; +opGroupNonUniformFMax : idResult Equals Op (GroupNonUniformFMax idResultType | SpecConstantOp idResultType GroupNonUniformFMax) execution operation valueIdRef clusterSize?; +opGroupNonUniformBitwiseAnd : idResult Equals Op (GroupNonUniformBitwiseAnd idResultType | SpecConstantOp idResultType GroupNonUniformBitwiseAnd) execution operation valueIdRef clusterSize?; +opGroupNonUniformBitwiseOr : idResult Equals Op (GroupNonUniformBitwiseOr idResultType | SpecConstantOp idResultType GroupNonUniformBitwiseOr) execution operation valueIdRef clusterSize?; +opGroupNonUniformBitwiseXor : idResult Equals Op (GroupNonUniformBitwiseXor idResultType | SpecConstantOp idResultType GroupNonUniformBitwiseXor) execution operation valueIdRef clusterSize?; +opGroupNonUniformLogicalAnd : idResult Equals Op (GroupNonUniformLogicalAnd idResultType | SpecConstantOp idResultType GroupNonUniformLogicalAnd) execution operation valueIdRef clusterSize?; +opGroupNonUniformLogicalOr : idResult Equals Op (GroupNonUniformLogicalOr idResultType | SpecConstantOp idResultType GroupNonUniformLogicalOr) execution operation valueIdRef clusterSize?; +opGroupNonUniformLogicalXor : idResult Equals Op (GroupNonUniformLogicalXor idResultType | SpecConstantOp idResultType GroupNonUniformLogicalXor) execution operation valueIdRef clusterSize?; +opGroupNonUniformQuadBroadcast : idResult Equals Op (GroupNonUniformQuadBroadcast idResultType | SpecConstantOp idResultType GroupNonUniformQuadBroadcast) execution valueIdRef indexIdRef; +opGroupNonUniformQuadSwap : idResult Equals Op (GroupNonUniformQuadSwap idResultType | SpecConstantOp idResultType GroupNonUniformQuadSwap) execution valueIdRef direction; +opGroupNonUniformPartitionNV : idResult Equals Op (GroupNonUniformPartitionNV idResultType | SpecConstantOp idResultType GroupNonUniformPartitionNV) valueIdRef; + +// Pipe Operations +opReadPipe : idResult Equals Op (ReadPipe idResultType | SpecConstantOp idResultType ReadPipe) pipe pointer packetSizeIdRef packetAlignmentIdRef; +opWritePipe : idResult Equals Op (WritePipe idResultType | SpecConstantOp idResultType WritePipe) pipe pointer packetSizeIdRef packetAlignmentIdRef; +opReservedReadPipe : idResult Equals Op (ReservedReadPipe idResultType | SpecConstantOp idResultType ReservedReadPipe) pipe reserveId indexIdRef pointer packetSizeIdRef packetAlignmentIdRef; +opReservedWritePipe : idResult Equals Op (ReservedWritePipe idResultType | SpecConstantOp idResultType ReservedWritePipe) pipe reserveId indexIdRef pointer packetSizeIdRef packetAlignmentIdRef; +opReserveReadPipePackets : idResult Equals Op (ReserveReadPipePackets idResultType | SpecConstantOp idResultType ReserveReadPipePackets) pipe numPackets packetSizeIdRef packetAlignmentIdRef; +opReserveWritePipePackets : idResult Equals Op (ReserveWritePipePackets idResultType | SpecConstantOp idResultType ReserveWritePipePackets) pipe numPackets packetSizeIdRef packetAlignmentIdRef; +opCommitReadPipe : Op CommitReadPipe pipe reserveId packetSizeIdRef packetAlignmentIdRef; +opCommitWritePipe : Op CommitWritePipe pipe reserveId packetSizeIdRef packetAlignmentIdRef; +opIsValidReserveId : idResult Equals Op (IsValidReserveId idResultType | SpecConstantOp idResultType IsValidReserveId) reserveId; +opGetNumPipePackets : idResult Equals Op (GetNumPipePackets idResultType | SpecConstantOp idResultType GetNumPipePackets) pipe packetSizeIdRef packetAlignmentIdRef; +opGetMaxPipePackets : idResult Equals Op (GetMaxPipePackets idResultType | SpecConstantOp idResultType GetMaxPipePackets) pipe packetSizeIdRef packetAlignmentIdRef; +opGroupReserveReadPipePackets : idResult Equals Op (GroupReserveReadPipePackets idResultType | SpecConstantOp idResultType GroupReserveReadPipePackets) execution pipe numPackets packetSizeIdRef packetAlignmentIdRef; +opGroupReserveWritePipePackets : idResult Equals Op (GroupReserveWritePipePackets idResultType | SpecConstantOp idResultType GroupReserveWritePipePackets) execution pipe numPackets packetSizeIdRef packetAlignmentIdRef; +opGroupCommitReadPipe : Op GroupCommitReadPipe execution pipe reserveId packetSizeIdRef packetAlignmentIdRef; +opGroupCommitWritePipe : Op GroupCommitWritePipe execution pipe reserveId packetSizeIdRef packetAlignmentIdRef; +opConstantPipeStorage : idResult Equals Op (ConstantPipeStorage idResultType | SpecConstantOp idResultType ConstantPipeStorage) packetSizeLiteralInteger packetAlignmentLiteralInteger capacity; +opCreatePipeFromPipeStorage : idResult Equals Op (CreatePipeFromPipeStorage idResultType | SpecConstantOp idResultType CreatePipeFromPipeStorage) pipeStorage; +opReadPipeBlockingINTEL : idResult Equals Op (ReadPipeBlockingINTEL idResultType | SpecConstantOp idResultType ReadPipeBlockingINTEL) packetSizeIdRef packetAlignmentIdRef; +opWritePipeBlockingINTEL : idResult Equals Op (WritePipeBlockingINTEL idResultType | SpecConstantOp idResultType WritePipeBlockingINTEL) packetSizeIdRef packetAlignmentIdRef; + +// Primitive Operations +opEmitVertex : Op EmitVertex; +opEndPrimitive : Op EndPrimitive; +opEmitStreamVertex : Op EmitStreamVertex stream; +opEndStreamPrimitive : Op EndStreamPrimitive stream; + +// Relational_and_Logical Operations +opAny : idResult Equals Op (Any idResultType | SpecConstantOp idResultType Any) vectorIdRef; +opAll : idResult Equals Op (All idResultType | SpecConstantOp idResultType All) vectorIdRef; +opIsNan : idResult Equals Op (IsNan idResultType | SpecConstantOp idResultType IsNan) x; +opIsInf : idResult Equals Op (IsInf idResultType | SpecConstantOp idResultType IsInf) x; +opIsFinite : idResult Equals Op (IsFinite idResultType | SpecConstantOp idResultType IsFinite) x; +opIsNormal : idResult Equals Op (IsNormal idResultType | SpecConstantOp idResultType IsNormal) x; +opSignBitSet : idResult Equals Op (SignBitSet idResultType | SpecConstantOp idResultType SignBitSet) x; +opLessOrGreater : idResult Equals Op (LessOrGreater idResultType | SpecConstantOp idResultType LessOrGreater) x y; +opOrdered : idResult Equals Op (Ordered idResultType | SpecConstantOp idResultType Ordered) x y; +opUnordered : idResult Equals Op (Unordered idResultType | SpecConstantOp idResultType Unordered) x y; +opLogicalEqual : idResult Equals Op (LogicalEqual idResultType | SpecConstantOp idResultType LogicalEqual) operand1 operand2; +opLogicalNotEqual : idResult Equals Op (LogicalNotEqual idResultType | SpecConstantOp idResultType LogicalNotEqual) operand1 operand2; +opLogicalOr : idResult Equals Op (LogicalOr idResultType | SpecConstantOp idResultType LogicalOr) operand1 operand2; +opLogicalAnd : idResult Equals Op (LogicalAnd idResultType | SpecConstantOp idResultType LogicalAnd) operand1 operand2; +opLogicalNot : idResult Equals Op (LogicalNot idResultType | SpecConstantOp idResultType LogicalNot) operand; +opSelect : idResult Equals Op (Select idResultType | SpecConstantOp idResultType Select) condition object1 object2; +opIEqual : idResult Equals Op (IEqual idResultType | SpecConstantOp idResultType IEqual) operand1 operand2; +opINotEqual : idResult Equals Op (INotEqual idResultType | SpecConstantOp idResultType INotEqual) operand1 operand2; +opUGreaterThan : idResult Equals Op (UGreaterThan idResultType | SpecConstantOp idResultType UGreaterThan) operand1 operand2; +opSGreaterThan : idResult Equals Op (SGreaterThan idResultType | SpecConstantOp idResultType SGreaterThan) operand1 operand2; +opUGreaterThanEqual : idResult Equals Op (UGreaterThanEqual idResultType | SpecConstantOp idResultType UGreaterThanEqual) operand1 operand2; +opSGreaterThanEqual : idResult Equals Op (SGreaterThanEqual idResultType | SpecConstantOp idResultType SGreaterThanEqual) operand1 operand2; +opULessThan : idResult Equals Op (ULessThan idResultType | SpecConstantOp idResultType ULessThan) operand1 operand2; +opSLessThan : idResult Equals Op (SLessThan idResultType | SpecConstantOp idResultType SLessThan) operand1 operand2; +opULessThanEqual : idResult Equals Op (ULessThanEqual idResultType | SpecConstantOp idResultType ULessThanEqual) operand1 operand2; +opSLessThanEqual : idResult Equals Op (SLessThanEqual idResultType | SpecConstantOp idResultType SLessThanEqual) operand1 operand2; +opFOrdEqual : idResult Equals Op (FOrdEqual idResultType | SpecConstantOp idResultType FOrdEqual) operand1 operand2; +opFUnordEqual : idResult Equals Op (FUnordEqual idResultType | SpecConstantOp idResultType FUnordEqual) operand1 operand2; +opFOrdNotEqual : idResult Equals Op (FOrdNotEqual idResultType | SpecConstantOp idResultType FOrdNotEqual) operand1 operand2; +opFUnordNotEqual : idResult Equals Op (FUnordNotEqual idResultType | SpecConstantOp idResultType FUnordNotEqual) operand1 operand2; +opFOrdLessThan : idResult Equals Op (FOrdLessThan idResultType | SpecConstantOp idResultType FOrdLessThan) operand1 operand2; +opFUnordLessThan : idResult Equals Op (FUnordLessThan idResultType | SpecConstantOp idResultType FUnordLessThan) operand1 operand2; +opFOrdGreaterThan : idResult Equals Op (FOrdGreaterThan idResultType | SpecConstantOp idResultType FOrdGreaterThan) operand1 operand2; +opFUnordGreaterThan : idResult Equals Op (FUnordGreaterThan idResultType | SpecConstantOp idResultType FUnordGreaterThan) operand1 operand2; +opFOrdLessThanEqual : idResult Equals Op (FOrdLessThanEqual idResultType | SpecConstantOp idResultType FOrdLessThanEqual) operand1 operand2; +opFUnordLessThanEqual : idResult Equals Op (FUnordLessThanEqual idResultType | SpecConstantOp idResultType FUnordLessThanEqual) operand1 operand2; +opFOrdGreaterThanEqual : idResult Equals Op (FOrdGreaterThanEqual idResultType | SpecConstantOp idResultType FOrdGreaterThanEqual) operand1 operand2; +opFUnordGreaterThanEqual : idResult Equals Op (FUnordGreaterThanEqual idResultType | SpecConstantOp idResultType FUnordGreaterThanEqual) operand1 operand2; + +// Reserved Operations +opTraceRayKHR : Op TraceRayKHR accel rayFlagsIdRef cullMask sBTOffset sBTStride missIndex rayOrigin rayTmin rayDirection rayTmax payload; +opExecuteCallableKHR : Op ExecuteCallableKHR sBTIndex callableData; +opConvertUToAccelerationStructureKHR : idResult Equals Op (ConvertUToAccelerationStructureKHR idResultType | SpecConstantOp idResultType ConvertUToAccelerationStructureKHR) accel; +opIgnoreIntersectionKHR : Op IgnoreIntersectionKHR; +opTerminateRayKHR : Op TerminateRayKHR; +opRayQueryInitializeKHR : Op RayQueryInitializeKHR rayQuery accel rayFlagsIdRef cullMask rayOrigin rayTmin rayDirection rayTmax; +opRayQueryTerminateKHR : Op RayQueryTerminateKHR rayQuery; +opRayQueryGenerateIntersectionKHR : Op RayQueryGenerateIntersectionKHR rayQuery hitT; +opRayQueryConfirmIntersectionKHR : Op RayQueryConfirmIntersectionKHR rayQuery; +opRayQueryProceedKHR : idResult Equals Op (RayQueryProceedKHR idResultType | SpecConstantOp idResultType RayQueryProceedKHR) rayQuery; +opRayQueryGetIntersectionTypeKHR : idResult Equals Op (RayQueryGetIntersectionTypeKHR idResultType | SpecConstantOp idResultType RayQueryGetIntersectionTypeKHR) rayQuery intersection; +opFragmentMaskFetchAMD : idResult Equals Op (FragmentMaskFetchAMD idResultType | SpecConstantOp idResultType FragmentMaskFetchAMD) image coordinate; +opFragmentFetchAMD : idResult Equals Op (FragmentFetchAMD idResultType | SpecConstantOp idResultType FragmentFetchAMD) image coordinate fragmentIndex; +opReadClockKHR : idResult Equals Op (ReadClockKHR idResultType | SpecConstantOp idResultType ReadClockKHR) scopeIdScope; +opFinalizeNodePayloadsAMDX : Op FinalizeNodePayloadsAMDX payloadArray; +opFinishWritingNodePayloadAMDX : idResult Equals Op (FinishWritingNodePayloadAMDX idResultType | SpecConstantOp idResultType FinishWritingNodePayloadAMDX) payload; +opInitializeNodePayloadsAMDX : Op InitializeNodePayloadsAMDX payloadArray visibility payloadCount nodeIndex; +opHitObjectRecordHitMotionNV : Op HitObjectRecordHitMotionNV hitObject accelerationStructure instanceId primitiveId geometryIndex hitKind sBTRecordOffset sBTRecordStride origin tMin direction tMax currentTime hitObjectAttributes; +opHitObjectRecordHitWithIndexMotionNV : Op HitObjectRecordHitWithIndexMotionNV hitObject accelerationStructure instanceId primitiveId geometryIndex hitKind sBTRecordIndex origin tMin direction tMax currentTime hitObjectAttributes; +opHitObjectRecordMissMotionNV : Op HitObjectRecordMissMotionNV hitObject sBTIndex origin tMin direction tMax currentTime; +opHitObjectGetWorldToObjectNV : idResult Equals Op (HitObjectGetWorldToObjectNV idResultType | SpecConstantOp idResultType HitObjectGetWorldToObjectNV) hitObject; +opHitObjectGetObjectToWorldNV : idResult Equals Op (HitObjectGetObjectToWorldNV idResultType | SpecConstantOp idResultType HitObjectGetObjectToWorldNV) hitObject; +opHitObjectGetObjectRayDirectionNV : idResult Equals Op (HitObjectGetObjectRayDirectionNV idResultType | SpecConstantOp idResultType HitObjectGetObjectRayDirectionNV) hitObject; +opHitObjectGetObjectRayOriginNV : idResult Equals Op (HitObjectGetObjectRayOriginNV idResultType | SpecConstantOp idResultType HitObjectGetObjectRayOriginNV) hitObject; +opHitObjectTraceRayMotionNV : Op HitObjectTraceRayMotionNV hitObject accelerationStructure rayFlagsIdRef cullMask sBTRecordOffset sBTRecordStride missIndex origin tMin direction tMax time payload; +opHitObjectGetShaderRecordBufferHandleNV : idResult Equals Op (HitObjectGetShaderRecordBufferHandleNV idResultType | SpecConstantOp idResultType HitObjectGetShaderRecordBufferHandleNV) hitObject; +opHitObjectGetShaderBindingTableRecordIndexNV : idResult Equals Op (HitObjectGetShaderBindingTableRecordIndexNV idResultType | SpecConstantOp idResultType HitObjectGetShaderBindingTableRecordIndexNV) hitObject; +opHitObjectRecordEmptyNV : Op HitObjectRecordEmptyNV hitObject; +opHitObjectTraceRayNV : Op HitObjectTraceRayNV hitObject accelerationStructure rayFlagsIdRef cullMask sBTRecordOffset sBTRecordStride missIndex origin tMin direction tMax payload; +opHitObjectRecordHitNV : Op HitObjectRecordHitNV hitObject accelerationStructure instanceId primitiveId geometryIndex hitKind sBTRecordOffset sBTRecordStride origin tMin direction tMax hitObjectAttributes; +opHitObjectRecordHitWithIndexNV : Op HitObjectRecordHitWithIndexNV hitObject accelerationStructure instanceId primitiveId geometryIndex hitKind sBTRecordIndex origin tMin direction tMax hitObjectAttributes; +opHitObjectRecordMissNV : Op HitObjectRecordMissNV hitObject sBTIndex origin tMin direction tMax; +opHitObjectExecuteShaderNV : Op HitObjectExecuteShaderNV hitObject payload; +opHitObjectGetCurrentTimeNV : idResult Equals Op (HitObjectGetCurrentTimeNV idResultType | SpecConstantOp idResultType HitObjectGetCurrentTimeNV) hitObject; +opHitObjectGetAttributesNV : Op HitObjectGetAttributesNV hitObject hitObjectAttribute; +opHitObjectGetHitKindNV : idResult Equals Op (HitObjectGetHitKindNV idResultType | SpecConstantOp idResultType HitObjectGetHitKindNV) hitObject; +opHitObjectGetPrimitiveIndexNV : idResult Equals Op (HitObjectGetPrimitiveIndexNV idResultType | SpecConstantOp idResultType HitObjectGetPrimitiveIndexNV) hitObject; +opHitObjectGetGeometryIndexNV : idResult Equals Op (HitObjectGetGeometryIndexNV idResultType | SpecConstantOp idResultType HitObjectGetGeometryIndexNV) hitObject; +opHitObjectGetInstanceIdNV : idResult Equals Op (HitObjectGetInstanceIdNV idResultType | SpecConstantOp idResultType HitObjectGetInstanceIdNV) hitObject; +opHitObjectGetInstanceCustomIndexNV : idResult Equals Op (HitObjectGetInstanceCustomIndexNV idResultType | SpecConstantOp idResultType HitObjectGetInstanceCustomIndexNV) hitObject; +opHitObjectGetWorldRayDirectionNV : idResult Equals Op (HitObjectGetWorldRayDirectionNV idResultType | SpecConstantOp idResultType HitObjectGetWorldRayDirectionNV) hitObject; +opHitObjectGetWorldRayOriginNV : idResult Equals Op (HitObjectGetWorldRayOriginNV idResultType | SpecConstantOp idResultType HitObjectGetWorldRayOriginNV) hitObject; +opHitObjectGetRayTMaxNV : idResult Equals Op (HitObjectGetRayTMaxNV idResultType | SpecConstantOp idResultType HitObjectGetRayTMaxNV) hitObject; +opHitObjectGetRayTMinNV : idResult Equals Op (HitObjectGetRayTMinNV idResultType | SpecConstantOp idResultType HitObjectGetRayTMinNV) hitObject; +opHitObjectIsEmptyNV : idResult Equals Op (HitObjectIsEmptyNV idResultType | SpecConstantOp idResultType HitObjectIsEmptyNV) hitObject; +opHitObjectIsHitNV : idResult Equals Op (HitObjectIsHitNV idResultType | SpecConstantOp idResultType HitObjectIsHitNV) hitObject; +opHitObjectIsMissNV : idResult Equals Op (HitObjectIsMissNV idResultType | SpecConstantOp idResultType HitObjectIsMissNV) hitObject; +opReorderThreadWithHitObjectNV : Op ReorderThreadWithHitObjectNV hitObject (hint bits?)?; +opReorderThreadWithHintNV : Op ReorderThreadWithHintNV hint bits; +opEmitMeshTasksEXT : Op EmitMeshTasksEXT groupCountX groupCountY groupCountZ payload?; +opSetMeshOutputsEXT : Op SetMeshOutputsEXT vertexCountIdRef primitiveCountIdRef; +opWritePackedPrimitiveIndices4x8NV : Op WritePackedPrimitiveIndices4x8NV indexOffset packedIndices; +opFetchMicroTriangleVertexPositionNV : idResult Equals Op (FetchMicroTriangleVertexPositionNV idResultType | SpecConstantOp idResultType FetchMicroTriangleVertexPositionNV) accel instanceId geometryIndex primitiveIndex barycentric; +opFetchMicroTriangleVertexBarycentricNV : idResult Equals Op (FetchMicroTriangleVertexBarycentricNV idResultType | SpecConstantOp idResultType FetchMicroTriangleVertexBarycentricNV) accel instanceId geometryIndex primitiveIndex barycentric; +opReportIntersectionNV : idResult Equals Op (ReportIntersectionNV idResultType | SpecConstantOp idResultType ReportIntersectionNV) hit hitKind; +opReportIntersectionKHR : idResult Equals Op (ReportIntersectionKHR idResultType | SpecConstantOp idResultType ReportIntersectionKHR) hit hitKind; +opIgnoreIntersectionNV : Op IgnoreIntersectionNV; +opTerminateRayNV : Op TerminateRayNV; +opTraceNV : Op TraceNV accel rayFlagsIdRef cullMask sBTOffset sBTStride missIndex rayOrigin rayTmin rayDirection rayTmax payloadId; +opTraceMotionNV : Op TraceMotionNV accel rayFlagsIdRef cullMask sBTOffset sBTStride missIndex rayOrigin rayTmin rayDirection rayTmax time payloadId; +opTraceRayMotionNV : Op TraceRayMotionNV accel rayFlagsIdRef cullMask sBTOffset sBTStride missIndex rayOrigin rayTmin rayDirection rayTmax time payload; +opRayQueryGetIntersectionTriangleVertexPositionsKHR : idResult Equals Op (RayQueryGetIntersectionTriangleVertexPositionsKHR idResultType | SpecConstantOp idResultType RayQueryGetIntersectionTriangleVertexPositionsKHR) rayQuery intersection; +opExecuteCallableNV : Op ExecuteCallableNV sBTIndex callableDataId; +opCooperativeMatrixLoadNV : idResult Equals Op (CooperativeMatrixLoadNV idResultType | SpecConstantOp idResultType CooperativeMatrixLoadNV) pointer stride columnMajor memoryAccess?; +opCooperativeMatrixStoreNV : Op CooperativeMatrixStoreNV pointer object stride columnMajor memoryAccess?; +opCooperativeMatrixMulAddNV : idResult Equals Op (CooperativeMatrixMulAddNV idResultType | SpecConstantOp idResultType CooperativeMatrixMulAddNV) a b c; +opCooperativeMatrixLengthNV : idResult Equals Op (CooperativeMatrixLengthNV idResultType | SpecConstantOp idResultType CooperativeMatrixLengthNV) type; +opBeginInvocationInterlockEXT : Op BeginInvocationInterlockEXT; +opEndInvocationInterlockEXT : Op EndInvocationInterlockEXT; +opIsHelperInvocationEXT : idResult Equals Op (IsHelperInvocationEXT idResultType | SpecConstantOp idResultType IsHelperInvocationEXT); +opConvertUToImageNV : idResult Equals Op (ConvertUToImageNV idResultType | SpecConstantOp idResultType ConvertUToImageNV) operand; +opConvertUToSamplerNV : idResult Equals Op (ConvertUToSamplerNV idResultType | SpecConstantOp idResultType ConvertUToSamplerNV) operand; +opConvertImageToUNV : idResult Equals Op (ConvertImageToUNV idResultType | SpecConstantOp idResultType ConvertImageToUNV) operand; +opConvertSamplerToUNV : idResult Equals Op (ConvertSamplerToUNV idResultType | SpecConstantOp idResultType ConvertSamplerToUNV) operand; +opConvertUToSampledImageNV : idResult Equals Op (ConvertUToSampledImageNV idResultType | SpecConstantOp idResultType ConvertUToSampledImageNV) operand; +opConvertSampledImageToUNV : idResult Equals Op (ConvertSampledImageToUNV idResultType | SpecConstantOp idResultType ConvertSampledImageToUNV) operand; +opSamplerImageAddressingModeNV : Op SamplerImageAddressingModeNV bitWidth; +opUCountLeadingZerosINTEL : idResult Equals Op (UCountLeadingZerosINTEL idResultType | SpecConstantOp idResultType UCountLeadingZerosINTEL) operand; +opUCountTrailingZerosINTEL : idResult Equals Op (UCountTrailingZerosINTEL idResultType | SpecConstantOp idResultType UCountTrailingZerosINTEL) operand; +opAbsISubINTEL : idResult Equals Op (AbsISubINTEL idResultType | SpecConstantOp idResultType AbsISubINTEL) operand1 operand2; +opAbsUSubINTEL : idResult Equals Op (AbsUSubINTEL idResultType | SpecConstantOp idResultType AbsUSubINTEL) operand1 operand2; +opIAddSatINTEL : idResult Equals Op (IAddSatINTEL idResultType | SpecConstantOp idResultType IAddSatINTEL) operand1 operand2; +opUAddSatINTEL : idResult Equals Op (UAddSatINTEL idResultType | SpecConstantOp idResultType UAddSatINTEL) operand1 operand2; +opIAverageINTEL : idResult Equals Op (IAverageINTEL idResultType | SpecConstantOp idResultType IAverageINTEL) operand1 operand2; +opUAverageINTEL : idResult Equals Op (UAverageINTEL idResultType | SpecConstantOp idResultType UAverageINTEL) operand1 operand2; +opIAverageRoundedINTEL : idResult Equals Op (IAverageRoundedINTEL idResultType | SpecConstantOp idResultType IAverageRoundedINTEL) operand1 operand2; +opUAverageRoundedINTEL : idResult Equals Op (UAverageRoundedINTEL idResultType | SpecConstantOp idResultType UAverageRoundedINTEL) operand1 operand2; +opISubSatINTEL : idResult Equals Op (ISubSatINTEL idResultType | SpecConstantOp idResultType ISubSatINTEL) operand1 operand2; +opUSubSatINTEL : idResult Equals Op (USubSatINTEL idResultType | SpecConstantOp idResultType USubSatINTEL) operand1 operand2; +opIMul32x16INTEL : idResult Equals Op (IMul32x16INTEL idResultType | SpecConstantOp idResultType IMul32x16INTEL) operand1 operand2; +opUMul32x16INTEL : idResult Equals Op (UMul32x16INTEL idResultType | SpecConstantOp idResultType UMul32x16INTEL) operand1 operand2; +opLoopControlINTEL : Op LoopControlINTEL loopControlParameters*; +opFPGARegINTEL : idResult Equals Op (FPGARegINTEL idResultType | SpecConstantOp idResultType FPGARegINTEL) result input; +opRayQueryGetRayTMinKHR : idResult Equals Op (RayQueryGetRayTMinKHR idResultType | SpecConstantOp idResultType RayQueryGetRayTMinKHR) rayQuery; +opRayQueryGetRayFlagsKHR : idResult Equals Op (RayQueryGetRayFlagsKHR idResultType | SpecConstantOp idResultType RayQueryGetRayFlagsKHR) rayQuery; +opRayQueryGetIntersectionTKHR : idResult Equals Op (RayQueryGetIntersectionTKHR idResultType | SpecConstantOp idResultType RayQueryGetIntersectionTKHR) rayQuery intersection; +opRayQueryGetIntersectionInstanceCustomIndexKHR : idResult Equals Op (RayQueryGetIntersectionInstanceCustomIndexKHR idResultType | SpecConstantOp idResultType RayQueryGetIntersectionInstanceCustomIndexKHR) rayQuery intersection; +opRayQueryGetIntersectionInstanceIdKHR : idResult Equals Op (RayQueryGetIntersectionInstanceIdKHR idResultType | SpecConstantOp idResultType RayQueryGetIntersectionInstanceIdKHR) rayQuery intersection; +opRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR : idResult Equals Op (RayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR idResultType | SpecConstantOp idResultType RayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR) rayQuery intersection; +opRayQueryGetIntersectionGeometryIndexKHR : idResult Equals Op (RayQueryGetIntersectionGeometryIndexKHR idResultType | SpecConstantOp idResultType RayQueryGetIntersectionGeometryIndexKHR) rayQuery intersection; +opRayQueryGetIntersectionPrimitiveIndexKHR : idResult Equals Op (RayQueryGetIntersectionPrimitiveIndexKHR idResultType | SpecConstantOp idResultType RayQueryGetIntersectionPrimitiveIndexKHR) rayQuery intersection; +opRayQueryGetIntersectionBarycentricsKHR : idResult Equals Op (RayQueryGetIntersectionBarycentricsKHR idResultType | SpecConstantOp idResultType RayQueryGetIntersectionBarycentricsKHR) rayQuery intersection; +opRayQueryGetIntersectionFrontFaceKHR : idResult Equals Op (RayQueryGetIntersectionFrontFaceKHR idResultType | SpecConstantOp idResultType RayQueryGetIntersectionFrontFaceKHR) rayQuery intersection; +opRayQueryGetIntersectionCandidateAABBOpaqueKHR : idResult Equals Op (RayQueryGetIntersectionCandidateAABBOpaqueKHR idResultType | SpecConstantOp idResultType RayQueryGetIntersectionCandidateAABBOpaqueKHR) rayQuery; +opRayQueryGetIntersectionObjectRayDirectionKHR : idResult Equals Op (RayQueryGetIntersectionObjectRayDirectionKHR idResultType | SpecConstantOp idResultType RayQueryGetIntersectionObjectRayDirectionKHR) rayQuery intersection; +opRayQueryGetIntersectionObjectRayOriginKHR : idResult Equals Op (RayQueryGetIntersectionObjectRayOriginKHR idResultType | SpecConstantOp idResultType RayQueryGetIntersectionObjectRayOriginKHR) rayQuery intersection; +opRayQueryGetWorldRayDirectionKHR : idResult Equals Op (RayQueryGetWorldRayDirectionKHR idResultType | SpecConstantOp idResultType RayQueryGetWorldRayDirectionKHR) rayQuery; +opRayQueryGetWorldRayOriginKHR : idResult Equals Op (RayQueryGetWorldRayOriginKHR idResultType | SpecConstantOp idResultType RayQueryGetWorldRayOriginKHR) rayQuery; +opRayQueryGetIntersectionObjectToWorldKHR : idResult Equals Op (RayQueryGetIntersectionObjectToWorldKHR idResultType | SpecConstantOp idResultType RayQueryGetIntersectionObjectToWorldKHR) rayQuery intersection; +opRayQueryGetIntersectionWorldToObjectKHR : idResult Equals Op (RayQueryGetIntersectionWorldToObjectKHR idResultType | SpecConstantOp idResultType RayQueryGetIntersectionWorldToObjectKHR) rayQuery intersection; + +// Type-Declaration Operations +opTypeVoid : idResult Equals Op (TypeVoid | SpecConstantOp TypeVoid); +opTypeBool : idResult Equals Op (TypeBool | SpecConstantOp TypeBool); +opTypeInt : idResult Equals Op (TypeInt | SpecConstantOp TypeInt) widthLiteralInteger signedness; +opTypeFloat : idResult Equals Op (TypeFloat | SpecConstantOp TypeFloat) widthLiteralInteger; +opTypeVector : idResult Equals Op (TypeVector | SpecConstantOp TypeVector) componentType componentCount; +opTypeMatrix : idResult Equals Op (TypeMatrix | SpecConstantOp TypeMatrix) columnType columnCount; +opTypeImage : idResult Equals Op (TypeImage | SpecConstantOp TypeImage) sampledType dim depthLiteralInteger arrayed mS sampled imageFormat accessQualifier?; +opTypeSampler : idResult Equals Op (TypeSampler | SpecConstantOp TypeSampler); +opTypeSampledImage : idResult Equals Op (TypeSampledImage | SpecConstantOp TypeSampledImage) imageType; +opTypeArray : idResult Equals Op (TypeArray | SpecConstantOp TypeArray) elementType lengthIdRef; +opTypeRuntimeArray : idResult Equals Op (TypeRuntimeArray | SpecConstantOp TypeRuntimeArray) elementType; +opTypeStruct : idResult Equals Op (TypeStruct | SpecConstantOp TypeStruct) memberType*; +opTypeOpaque : idResult Equals Op (TypeOpaque | SpecConstantOp TypeOpaque) theNameOfTheOpaqueType; +opTypePointer : idResult Equals Op (TypePointer | SpecConstantOp TypePointer) storageClass type; +opTypeFunction : idResult Equals Op (TypeFunction | SpecConstantOp TypeFunction) returnType parameterType*; +opTypeEvent : idResult Equals Op (TypeEvent | SpecConstantOp TypeEvent); +opTypeDeviceEvent : idResult Equals Op (TypeDeviceEvent | SpecConstantOp TypeDeviceEvent); +opTypeReserveId : idResult Equals Op (TypeReserveId | SpecConstantOp TypeReserveId); +opTypeQueue : idResult Equals Op (TypeQueue | SpecConstantOp TypeQueue); +opTypePipe : idResult Equals Op (TypePipe | SpecConstantOp TypePipe) qualifier; +opTypeForwardPointer : Op TypeForwardPointer pointerType storageClass; +opTypePipeStorage : idResult Equals Op (TypePipeStorage | SpecConstantOp TypePipeStorage); +opTypeNamedBarrier : idResult Equals Op (TypeNamedBarrier | SpecConstantOp TypeNamedBarrier); +opTypeCooperativeMatrixKHR : idResult Equals Op (TypeCooperativeMatrixKHR | SpecConstantOp TypeCooperativeMatrixKHR) componentType scopeIdScope rows columns use; +opTypeRayQueryKHR : idResult Equals Op (TypeRayQueryKHR | SpecConstantOp TypeRayQueryKHR); +opTypeHitObjectNV : idResult Equals Op (TypeHitObjectNV | SpecConstantOp TypeHitObjectNV); +opTypeAccelerationStructureNV : idResult Equals Op (TypeAccelerationStructureNV | SpecConstantOp TypeAccelerationStructureNV); +opTypeAccelerationStructureKHR : idResult Equals Op (TypeAccelerationStructureKHR | SpecConstantOp TypeAccelerationStructureKHR); +opTypeCooperativeMatrixNV : idResult Equals Op (TypeCooperativeMatrixNV | SpecConstantOp TypeCooperativeMatrixNV) componentType execution rows columns; +opTypeBufferSurfaceINTEL : idResult Equals Op (TypeBufferSurfaceINTEL | SpecConstantOp TypeBufferSurfaceINTEL) accessQualifierAccessQualifier; +opTypeStructContinuedINTEL : Op TypeStructContinuedINTEL memberType*; + +// exclude Operations +opConstantFunctionPointerINTEL : idResult Equals Op (ConstantFunctionPointerINTEL idResultType | SpecConstantOp idResultType ConstantFunctionPointerINTEL) function; +opFunctionPointerCallINTEL : idResult Equals Op (FunctionPointerCallINTEL idResultType | SpecConstantOp idResultType FunctionPointerCallINTEL) operand1*; +opAsmTargetINTEL : idResult Equals Op (AsmTargetINTEL idResultType | SpecConstantOp idResultType AsmTargetINTEL) asmTarget; +opAsmINTEL : idResult Equals Op (AsmINTEL idResultType | SpecConstantOp idResultType AsmINTEL) asmType targetIdRef asmInstructions constraints; +opAsmCallINTEL : idResult Equals Op (AsmCallINTEL idResultType | SpecConstantOp idResultType AsmCallINTEL) asm argument0*; +opVmeImageINTEL : idResult Equals Op (VmeImageINTEL idResultType | SpecConstantOp idResultType VmeImageINTEL) imageType sampler; +opTypeVmeImageINTEL : idResult Equals Op (TypeVmeImageINTEL | SpecConstantOp TypeVmeImageINTEL) imageType; +opTypeAvcImePayloadINTEL : idResult Equals Op (TypeAvcImePayloadINTEL | SpecConstantOp TypeAvcImePayloadINTEL); +opTypeAvcRefPayloadINTEL : idResult Equals Op (TypeAvcRefPayloadINTEL | SpecConstantOp TypeAvcRefPayloadINTEL); +opTypeAvcSicPayloadINTEL : idResult Equals Op (TypeAvcSicPayloadINTEL | SpecConstantOp TypeAvcSicPayloadINTEL); +opTypeAvcMcePayloadINTEL : idResult Equals Op (TypeAvcMcePayloadINTEL | SpecConstantOp TypeAvcMcePayloadINTEL); +opTypeAvcMceResultINTEL : idResult Equals Op (TypeAvcMceResultINTEL | SpecConstantOp TypeAvcMceResultINTEL); +opTypeAvcImeResultINTEL : idResult Equals Op (TypeAvcImeResultINTEL | SpecConstantOp TypeAvcImeResultINTEL); +opTypeAvcImeResultSingleReferenceStreamoutINTEL : idResult Equals Op (TypeAvcImeResultSingleReferenceStreamoutINTEL | SpecConstantOp TypeAvcImeResultSingleReferenceStreamoutINTEL); +opTypeAvcImeResultDualReferenceStreamoutINTEL : idResult Equals Op (TypeAvcImeResultDualReferenceStreamoutINTEL | SpecConstantOp TypeAvcImeResultDualReferenceStreamoutINTEL); +opTypeAvcImeSingleReferenceStreaminINTEL : idResult Equals Op (TypeAvcImeSingleReferenceStreaminINTEL | SpecConstantOp TypeAvcImeSingleReferenceStreaminINTEL); +opTypeAvcImeDualReferenceStreaminINTEL : idResult Equals Op (TypeAvcImeDualReferenceStreaminINTEL | SpecConstantOp TypeAvcImeDualReferenceStreaminINTEL); +opTypeAvcRefResultINTEL : idResult Equals Op (TypeAvcRefResultINTEL | SpecConstantOp TypeAvcRefResultINTEL); +opTypeAvcSicResultINTEL : idResult Equals Op (TypeAvcSicResultINTEL | SpecConstantOp TypeAvcSicResultINTEL); +opSubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL : idResult Equals Op (SubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL) sliceType qp; +opSubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL : idResult Equals Op (SubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL) referenceBasePenalty payload; +opSubgroupAvcMceGetDefaultInterShapePenaltyINTEL : idResult Equals Op (SubgroupAvcMceGetDefaultInterShapePenaltyINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceGetDefaultInterShapePenaltyINTEL) sliceType qp; +opSubgroupAvcMceSetInterShapePenaltyINTEL : idResult Equals Op (SubgroupAvcMceSetInterShapePenaltyINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceSetInterShapePenaltyINTEL) packedShapePenalty payload; +opSubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL : idResult Equals Op (SubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL) sliceType qp; +opSubgroupAvcMceSetInterDirectionPenaltyINTEL : idResult Equals Op (SubgroupAvcMceSetInterDirectionPenaltyINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceSetInterDirectionPenaltyINTEL) directionCost payload; +opSubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL : idResult Equals Op (SubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL) sliceType qp; +opSubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL : idResult Equals Op (SubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL) sliceType qp; +opSubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL : idResult Equals Op (SubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL); +opSubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL : idResult Equals Op (SubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL); +opSubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL : idResult Equals Op (SubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL); +opSubgroupAvcMceSetMotionVectorCostFunctionINTEL : idResult Equals Op (SubgroupAvcMceSetMotionVectorCostFunctionINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceSetMotionVectorCostFunctionINTEL) packedCostCenterDelta packedCostTable costPrecision payload; +opSubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL : idResult Equals Op (SubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL) sliceType qp; +opSubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL : idResult Equals Op (SubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL); +opSubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL : idResult Equals Op (SubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL); +opSubgroupAvcMceSetAcOnlyHaarINTEL : idResult Equals Op (SubgroupAvcMceSetAcOnlyHaarINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceSetAcOnlyHaarINTEL) payload; +opSubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL : idResult Equals Op (SubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL) sourceFieldPolarity payload; +opSubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL : idResult Equals Op (SubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL) referenceFieldPolarity payload; +opSubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL : idResult Equals Op (SubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL) forwardReferenceFieldPolarity backwardReferenceFieldPolarity payload; +opSubgroupAvcMceConvertToImePayloadINTEL : idResult Equals Op (SubgroupAvcMceConvertToImePayloadINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceConvertToImePayloadINTEL) payload; +opSubgroupAvcMceConvertToImeResultINTEL : idResult Equals Op (SubgroupAvcMceConvertToImeResultINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceConvertToImeResultINTEL) payload; +opSubgroupAvcMceConvertToRefPayloadINTEL : idResult Equals Op (SubgroupAvcMceConvertToRefPayloadINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceConvertToRefPayloadINTEL) payload; +opSubgroupAvcMceConvertToRefResultINTEL : idResult Equals Op (SubgroupAvcMceConvertToRefResultINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceConvertToRefResultINTEL) payload; +opSubgroupAvcMceConvertToSicPayloadINTEL : idResult Equals Op (SubgroupAvcMceConvertToSicPayloadINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceConvertToSicPayloadINTEL) payload; +opSubgroupAvcMceConvertToSicResultINTEL : idResult Equals Op (SubgroupAvcMceConvertToSicResultINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceConvertToSicResultINTEL) payload; +opSubgroupAvcMceGetMotionVectorsINTEL : idResult Equals Op (SubgroupAvcMceGetMotionVectorsINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceGetMotionVectorsINTEL) payload; +opSubgroupAvcMceGetInterDistortionsINTEL : idResult Equals Op (SubgroupAvcMceGetInterDistortionsINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceGetInterDistortionsINTEL) payload; +opSubgroupAvcMceGetBestInterDistortionsINTEL : idResult Equals Op (SubgroupAvcMceGetBestInterDistortionsINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceGetBestInterDistortionsINTEL) payload; +opSubgroupAvcMceGetInterMajorShapeINTEL : idResult Equals Op (SubgroupAvcMceGetInterMajorShapeINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceGetInterMajorShapeINTEL) payload; +opSubgroupAvcMceGetInterMinorShapeINTEL : idResult Equals Op (SubgroupAvcMceGetInterMinorShapeINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceGetInterMinorShapeINTEL) payload; +opSubgroupAvcMceGetInterDirectionsINTEL : idResult Equals Op (SubgroupAvcMceGetInterDirectionsINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceGetInterDirectionsINTEL) payload; +opSubgroupAvcMceGetInterMotionVectorCountINTEL : idResult Equals Op (SubgroupAvcMceGetInterMotionVectorCountINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceGetInterMotionVectorCountINTEL) payload; +opSubgroupAvcMceGetInterReferenceIdsINTEL : idResult Equals Op (SubgroupAvcMceGetInterReferenceIdsINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceGetInterReferenceIdsINTEL) payload; +opSubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL : idResult Equals Op (SubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL idResultType | SpecConstantOp idResultType SubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL) packedReferenceIds packedReferenceParameterFieldPolarities payload; +opSubgroupAvcImeInitializeINTEL : idResult Equals Op (SubgroupAvcImeInitializeINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeInitializeINTEL) srcCoord partitionMask sADAdjustment; +opSubgroupAvcImeSetSingleReferenceINTEL : idResult Equals Op (SubgroupAvcImeSetSingleReferenceINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeSetSingleReferenceINTEL) refOffset searchWindowConfig payload; +opSubgroupAvcImeSetDualReferenceINTEL : idResult Equals Op (SubgroupAvcImeSetDualReferenceINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeSetDualReferenceINTEL) fwdRefOffset bwdRefOffset id payload; +opSubgroupAvcImeRefWindowSizeINTEL : idResult Equals Op (SubgroupAvcImeRefWindowSizeINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeRefWindowSizeINTEL) searchWindowConfig dualRef; +opSubgroupAvcImeAdjustRefOffsetINTEL : idResult Equals Op (SubgroupAvcImeAdjustRefOffsetINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeAdjustRefOffsetINTEL) refOffset srcCoord refWindowSize imageSize; +opSubgroupAvcImeConvertToMcePayloadINTEL : idResult Equals Op (SubgroupAvcImeConvertToMcePayloadINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeConvertToMcePayloadINTEL) payload; +opSubgroupAvcImeSetMaxMotionVectorCountINTEL : idResult Equals Op (SubgroupAvcImeSetMaxMotionVectorCountINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeSetMaxMotionVectorCountINTEL) maxMotionVectorCount payload; +opSubgroupAvcImeSetUnidirectionalMixDisableINTEL : idResult Equals Op (SubgroupAvcImeSetUnidirectionalMixDisableINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeSetUnidirectionalMixDisableINTEL) payload; +opSubgroupAvcImeSetEarlySearchTerminationThresholdINTEL : idResult Equals Op (SubgroupAvcImeSetEarlySearchTerminationThresholdINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeSetEarlySearchTerminationThresholdINTEL) threshold payload; +opSubgroupAvcImeSetWeightedSadINTEL : idResult Equals Op (SubgroupAvcImeSetWeightedSadINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeSetWeightedSadINTEL) packedSadWeights payload; +opSubgroupAvcImeEvaluateWithSingleReferenceINTEL : idResult Equals Op (SubgroupAvcImeEvaluateWithSingleReferenceINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeEvaluateWithSingleReferenceINTEL) srcImage refImage payload; +opSubgroupAvcImeEvaluateWithDualReferenceINTEL : idResult Equals Op (SubgroupAvcImeEvaluateWithDualReferenceINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeEvaluateWithDualReferenceINTEL) srcImage fwdRefImage bwdRefImage payload; +opSubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL : idResult Equals Op (SubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL) srcImage refImage payload streaminComponents; +opSubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL : idResult Equals Op (SubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL) srcImage fwdRefImage bwdRefImage payload streaminComponents; +opSubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL : idResult Equals Op (SubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL) srcImage refImage payload; +opSubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL : idResult Equals Op (SubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL) srcImage fwdRefImage bwdRefImage payload; +opSubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL : idResult Equals Op (SubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL) srcImage refImage payload streaminComponents; +opSubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL : idResult Equals Op (SubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL) srcImage fwdRefImage bwdRefImage payload streaminComponents; +opSubgroupAvcImeConvertToMceResultINTEL : idResult Equals Op (SubgroupAvcImeConvertToMceResultINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeConvertToMceResultINTEL) payload; +opSubgroupAvcImeGetSingleReferenceStreaminINTEL : idResult Equals Op (SubgroupAvcImeGetSingleReferenceStreaminINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeGetSingleReferenceStreaminINTEL) payload; +opSubgroupAvcImeGetDualReferenceStreaminINTEL : idResult Equals Op (SubgroupAvcImeGetDualReferenceStreaminINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeGetDualReferenceStreaminINTEL) payload; +opSubgroupAvcImeStripSingleReferenceStreamoutINTEL : idResult Equals Op (SubgroupAvcImeStripSingleReferenceStreamoutINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeStripSingleReferenceStreamoutINTEL) payload; +opSubgroupAvcImeStripDualReferenceStreamoutINTEL : idResult Equals Op (SubgroupAvcImeStripDualReferenceStreamoutINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeStripDualReferenceStreamoutINTEL) payload; +opSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL : idResult Equals Op (SubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL) payload majorShape; +opSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL : idResult Equals Op (SubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL) payload majorShape; +opSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL : idResult Equals Op (SubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL) payload majorShape; +opSubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL : idResult Equals Op (SubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL) payload majorShape direction; +opSubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL : idResult Equals Op (SubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL) payload majorShape direction; +opSubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL : idResult Equals Op (SubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL) payload majorShape direction; +opSubgroupAvcImeGetBorderReachedINTEL : idResult Equals Op (SubgroupAvcImeGetBorderReachedINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeGetBorderReachedINTEL) imageSelect payload; +opSubgroupAvcImeGetTruncatedSearchIndicationINTEL : idResult Equals Op (SubgroupAvcImeGetTruncatedSearchIndicationINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeGetTruncatedSearchIndicationINTEL) payload; +opSubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL : idResult Equals Op (SubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL) payload; +opSubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL : idResult Equals Op (SubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL) payload; +opSubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL : idResult Equals Op (SubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL idResultType | SpecConstantOp idResultType SubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL) payload; +opSubgroupAvcFmeInitializeINTEL : idResult Equals Op (SubgroupAvcFmeInitializeINTEL idResultType | SpecConstantOp idResultType SubgroupAvcFmeInitializeINTEL) srcCoord motionVectors majorShapes minorShapes direction pixelResolution sADAdjustment; +opSubgroupAvcBmeInitializeINTEL : idResult Equals Op (SubgroupAvcBmeInitializeINTEL idResultType | SpecConstantOp idResultType SubgroupAvcBmeInitializeINTEL) srcCoord motionVectors majorShapes minorShapes direction pixelResolution bidirectionalWeight sADAdjustment; +opSubgroupAvcRefConvertToMcePayloadINTEL : idResult Equals Op (SubgroupAvcRefConvertToMcePayloadINTEL idResultType | SpecConstantOp idResultType SubgroupAvcRefConvertToMcePayloadINTEL) payload; +opSubgroupAvcRefSetBidirectionalMixDisableINTEL : idResult Equals Op (SubgroupAvcRefSetBidirectionalMixDisableINTEL idResultType | SpecConstantOp idResultType SubgroupAvcRefSetBidirectionalMixDisableINTEL) payload; +opSubgroupAvcRefSetBilinearFilterEnableINTEL : idResult Equals Op (SubgroupAvcRefSetBilinearFilterEnableINTEL idResultType | SpecConstantOp idResultType SubgroupAvcRefSetBilinearFilterEnableINTEL) payload; +opSubgroupAvcRefEvaluateWithSingleReferenceINTEL : idResult Equals Op (SubgroupAvcRefEvaluateWithSingleReferenceINTEL idResultType | SpecConstantOp idResultType SubgroupAvcRefEvaluateWithSingleReferenceINTEL) srcImage refImage payload; +opSubgroupAvcRefEvaluateWithDualReferenceINTEL : idResult Equals Op (SubgroupAvcRefEvaluateWithDualReferenceINTEL idResultType | SpecConstantOp idResultType SubgroupAvcRefEvaluateWithDualReferenceINTEL) srcImage fwdRefImage bwdRefImage payload; +opSubgroupAvcRefEvaluateWithMultiReferenceINTEL : idResult Equals Op (SubgroupAvcRefEvaluateWithMultiReferenceINTEL idResultType | SpecConstantOp idResultType SubgroupAvcRefEvaluateWithMultiReferenceINTEL) srcImage packedReferenceIds payload; +opSubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL : idResult Equals Op (SubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL idResultType | SpecConstantOp idResultType SubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL) srcImage packedReferenceIds packedReferenceFieldPolarities payload; +opSubgroupAvcRefConvertToMceResultINTEL : idResult Equals Op (SubgroupAvcRefConvertToMceResultINTEL idResultType | SpecConstantOp idResultType SubgroupAvcRefConvertToMceResultINTEL) payload; +opSubgroupAvcSicInitializeINTEL : idResult Equals Op (SubgroupAvcSicInitializeINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicInitializeINTEL) srcCoord; +opSubgroupAvcSicConfigureSkcINTEL : idResult Equals Op (SubgroupAvcSicConfigureSkcINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicConfigureSkcINTEL) skipBlockPartitionType skipMotionVectorMask motionVectors bidirectionalWeight sADAdjustment payload; +opSubgroupAvcSicConfigureIpeLumaINTEL : idResult Equals Op (SubgroupAvcSicConfigureIpeLumaINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicConfigureIpeLumaINTEL) lumaIntraPartitionMask intraNeighbourAvailabilty leftEdgeLumaPixels upperLeftCornerLumaPixel upperEdgeLumaPixels upperRightEdgeLumaPixels sADAdjustment payload; +opSubgroupAvcSicConfigureIpeLumaChromaINTEL : idResult Equals Op (SubgroupAvcSicConfigureIpeLumaChromaINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicConfigureIpeLumaChromaINTEL) lumaIntraPartitionMask intraNeighbourAvailabilty leftEdgeLumaPixels upperLeftCornerLumaPixel upperEdgeLumaPixels upperRightEdgeLumaPixels leftEdgeChromaPixels upperLeftCornerChromaPixel upperEdgeChromaPixels sADAdjustment payload; +opSubgroupAvcSicGetMotionVectorMaskINTEL : idResult Equals Op (SubgroupAvcSicGetMotionVectorMaskINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicGetMotionVectorMaskINTEL) skipBlockPartitionType direction; +opSubgroupAvcSicConvertToMcePayloadINTEL : idResult Equals Op (SubgroupAvcSicConvertToMcePayloadINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicConvertToMcePayloadINTEL) payload; +opSubgroupAvcSicSetIntraLumaShapePenaltyINTEL : idResult Equals Op (SubgroupAvcSicSetIntraLumaShapePenaltyINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicSetIntraLumaShapePenaltyINTEL) packedShapePenalty payload; +opSubgroupAvcSicSetIntraLumaModeCostFunctionINTEL : idResult Equals Op (SubgroupAvcSicSetIntraLumaModeCostFunctionINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicSetIntraLumaModeCostFunctionINTEL) lumaModePenalty lumaPackedNeighborModes lumaPackedNonDcPenalty payload; +opSubgroupAvcSicSetIntraChromaModeCostFunctionINTEL : idResult Equals Op (SubgroupAvcSicSetIntraChromaModeCostFunctionINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicSetIntraChromaModeCostFunctionINTEL) chromaModeBasePenalty payload; +opSubgroupAvcSicSetBilinearFilterEnableINTEL : idResult Equals Op (SubgroupAvcSicSetBilinearFilterEnableINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicSetBilinearFilterEnableINTEL) payload; +opSubgroupAvcSicSetSkcForwardTransformEnableINTEL : idResult Equals Op (SubgroupAvcSicSetSkcForwardTransformEnableINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicSetSkcForwardTransformEnableINTEL) packedSadCoefficients payload; +opSubgroupAvcSicSetBlockBasedRawSkipSadINTEL : idResult Equals Op (SubgroupAvcSicSetBlockBasedRawSkipSadINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicSetBlockBasedRawSkipSadINTEL) blockBasedSkipType payload; +opSubgroupAvcSicEvaluateIpeINTEL : idResult Equals Op (SubgroupAvcSicEvaluateIpeINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicEvaluateIpeINTEL) srcImage payload; +opSubgroupAvcSicEvaluateWithSingleReferenceINTEL : idResult Equals Op (SubgroupAvcSicEvaluateWithSingleReferenceINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicEvaluateWithSingleReferenceINTEL) srcImage refImage payload; +opSubgroupAvcSicEvaluateWithDualReferenceINTEL : idResult Equals Op (SubgroupAvcSicEvaluateWithDualReferenceINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicEvaluateWithDualReferenceINTEL) srcImage fwdRefImage bwdRefImage payload; +opSubgroupAvcSicEvaluateWithMultiReferenceINTEL : idResult Equals Op (SubgroupAvcSicEvaluateWithMultiReferenceINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicEvaluateWithMultiReferenceINTEL) srcImage packedReferenceIds payload; +opSubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL : idResult Equals Op (SubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL) srcImage packedReferenceIds packedReferenceFieldPolarities payload; +opSubgroupAvcSicConvertToMceResultINTEL : idResult Equals Op (SubgroupAvcSicConvertToMceResultINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicConvertToMceResultINTEL) payload; +opSubgroupAvcSicGetIpeLumaShapeINTEL : idResult Equals Op (SubgroupAvcSicGetIpeLumaShapeINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicGetIpeLumaShapeINTEL) payload; +opSubgroupAvcSicGetBestIpeLumaDistortionINTEL : idResult Equals Op (SubgroupAvcSicGetBestIpeLumaDistortionINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicGetBestIpeLumaDistortionINTEL) payload; +opSubgroupAvcSicGetBestIpeChromaDistortionINTEL : idResult Equals Op (SubgroupAvcSicGetBestIpeChromaDistortionINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicGetBestIpeChromaDistortionINTEL) payload; +opSubgroupAvcSicGetPackedIpeLumaModesINTEL : idResult Equals Op (SubgroupAvcSicGetPackedIpeLumaModesINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicGetPackedIpeLumaModesINTEL) payload; +opSubgroupAvcSicGetIpeChromaModeINTEL : idResult Equals Op (SubgroupAvcSicGetIpeChromaModeINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicGetIpeChromaModeINTEL) payload; +opSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL : idResult Equals Op (SubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL) payload; +opSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL : idResult Equals Op (SubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL) payload; +opSubgroupAvcSicGetInterRawSadsINTEL : idResult Equals Op (SubgroupAvcSicGetInterRawSadsINTEL idResultType | SpecConstantOp idResultType SubgroupAvcSicGetInterRawSadsINTEL) payload; +opVariableLengthArrayINTEL : idResult Equals Op (VariableLengthArrayINTEL idResultType | SpecConstantOp idResultType VariableLengthArrayINTEL) lenght; +opSaveMemoryINTEL : idResult Equals Op (SaveMemoryINTEL idResultType | SpecConstantOp idResultType SaveMemoryINTEL); +opRestoreMemoryINTEL : Op RestoreMemoryINTEL ptr; +opArbitraryFloatSinCosPiINTEL : idResult Equals Op (ArbitraryFloatSinCosPiINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatSinCosPiINTEL) a m1 mout fromSign enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatCastINTEL : idResult Equals Op (ArbitraryFloatCastINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatCastINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatCastFromIntINTEL : idResult Equals Op (ArbitraryFloatCastFromIntINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatCastFromIntINTEL) a mout fromSign enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatCastToIntINTEL : idResult Equals Op (ArbitraryFloatCastToIntINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatCastToIntINTEL) a m1 enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatAddINTEL : idResult Equals Op (ArbitraryFloatAddINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatAddINTEL) a m1 b m2 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatSubINTEL : idResult Equals Op (ArbitraryFloatSubINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatSubINTEL) a m1 b m2 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatMulINTEL : idResult Equals Op (ArbitraryFloatMulINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatMulINTEL) a m1 b m2 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatDivINTEL : idResult Equals Op (ArbitraryFloatDivINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatDivINTEL) a m1 b m2 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatGTINTEL : idResult Equals Op (ArbitraryFloatGTINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatGTINTEL) a m1 b m2; +opArbitraryFloatGEINTEL : idResult Equals Op (ArbitraryFloatGEINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatGEINTEL) a m1 b m2; +opArbitraryFloatLTINTEL : idResult Equals Op (ArbitraryFloatLTINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatLTINTEL) a m1 b m2; +opArbitraryFloatLEINTEL : idResult Equals Op (ArbitraryFloatLEINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatLEINTEL) a m1 b m2; +opArbitraryFloatEQINTEL : idResult Equals Op (ArbitraryFloatEQINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatEQINTEL) a m1 b m2; +opArbitraryFloatRecipINTEL : idResult Equals Op (ArbitraryFloatRecipINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatRecipINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatRSqrtINTEL : idResult Equals Op (ArbitraryFloatRSqrtINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatRSqrtINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatCbrtINTEL : idResult Equals Op (ArbitraryFloatCbrtINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatCbrtINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatHypotINTEL : idResult Equals Op (ArbitraryFloatHypotINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatHypotINTEL) a m1 b m2 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatSqrtINTEL : idResult Equals Op (ArbitraryFloatSqrtINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatSqrtINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatLogINTEL : idResult Equals Op (ArbitraryFloatLogINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatLogINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatLog2INTEL : idResult Equals Op (ArbitraryFloatLog2INTEL idResultType | SpecConstantOp idResultType ArbitraryFloatLog2INTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatLog10INTEL : idResult Equals Op (ArbitraryFloatLog10INTEL idResultType | SpecConstantOp idResultType ArbitraryFloatLog10INTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatLog1pINTEL : idResult Equals Op (ArbitraryFloatLog1pINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatLog1pINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatExpINTEL : idResult Equals Op (ArbitraryFloatExpINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatExpINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatExp2INTEL : idResult Equals Op (ArbitraryFloatExp2INTEL idResultType | SpecConstantOp idResultType ArbitraryFloatExp2INTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatExp10INTEL : idResult Equals Op (ArbitraryFloatExp10INTEL idResultType | SpecConstantOp idResultType ArbitraryFloatExp10INTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatExpm1INTEL : idResult Equals Op (ArbitraryFloatExpm1INTEL idResultType | SpecConstantOp idResultType ArbitraryFloatExpm1INTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatSinINTEL : idResult Equals Op (ArbitraryFloatSinINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatSinINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatCosINTEL : idResult Equals Op (ArbitraryFloatCosINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatCosINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatSinCosINTEL : idResult Equals Op (ArbitraryFloatSinCosINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatSinCosINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatSinPiINTEL : idResult Equals Op (ArbitraryFloatSinPiINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatSinPiINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatCosPiINTEL : idResult Equals Op (ArbitraryFloatCosPiINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatCosPiINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatASinINTEL : idResult Equals Op (ArbitraryFloatASinINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatASinINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatASinPiINTEL : idResult Equals Op (ArbitraryFloatASinPiINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatASinPiINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatACosINTEL : idResult Equals Op (ArbitraryFloatACosINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatACosINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatACosPiINTEL : idResult Equals Op (ArbitraryFloatACosPiINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatACosPiINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatATanINTEL : idResult Equals Op (ArbitraryFloatATanINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatATanINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatATanPiINTEL : idResult Equals Op (ArbitraryFloatATanPiINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatATanPiINTEL) a m1 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatATan2INTEL : idResult Equals Op (ArbitraryFloatATan2INTEL idResultType | SpecConstantOp idResultType ArbitraryFloatATan2INTEL) a m1 b m2 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatPowINTEL : idResult Equals Op (ArbitraryFloatPowINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatPowINTEL) a m1 b m2 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatPowRINTEL : idResult Equals Op (ArbitraryFloatPowRINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatPowRINTEL) a m1 b m2 mout enableSubnormals roundingMode roundingAccuracy; +opArbitraryFloatPowNINTEL : idResult Equals Op (ArbitraryFloatPowNINTEL idResultType | SpecConstantOp idResultType ArbitraryFloatPowNINTEL) a m1 b mout enableSubnormals roundingMode roundingAccuracy; +opAliasDomainDeclINTEL : idResult Equals Op (AliasDomainDeclINTEL | SpecConstantOp AliasDomainDeclINTEL) nameIdRef?; +opAliasScopeDeclINTEL : idResult Equals Op (AliasScopeDeclINTEL | SpecConstantOp AliasScopeDeclINTEL) aliasDomain nameIdRef?; +opAliasScopeListDeclINTEL : idResult Equals Op (AliasScopeListDeclINTEL | SpecConstantOp AliasScopeListDeclINTEL) aliasScope*; +opFixedSqrtINTEL : idResult Equals Op (FixedSqrtINTEL idResultType | SpecConstantOp idResultType FixedSqrtINTEL) inputType input s iLiteralInteger rI q o; +opFixedRecipINTEL : idResult Equals Op (FixedRecipINTEL idResultType | SpecConstantOp idResultType FixedRecipINTEL) inputType input s iLiteralInteger rI q o; +opFixedRsqrtINTEL : idResult Equals Op (FixedRsqrtINTEL idResultType | SpecConstantOp idResultType FixedRsqrtINTEL) inputType input s iLiteralInteger rI q o; +opFixedSinINTEL : idResult Equals Op (FixedSinINTEL idResultType | SpecConstantOp idResultType FixedSinINTEL) inputType input s iLiteralInteger rI q o; +opFixedCosINTEL : idResult Equals Op (FixedCosINTEL idResultType | SpecConstantOp idResultType FixedCosINTEL) inputType input s iLiteralInteger rI q o; +opFixedSinCosINTEL : idResult Equals Op (FixedSinCosINTEL idResultType | SpecConstantOp idResultType FixedSinCosINTEL) inputType input s iLiteralInteger rI q o; +opFixedSinPiINTEL : idResult Equals Op (FixedSinPiINTEL idResultType | SpecConstantOp idResultType FixedSinPiINTEL) inputType input s iLiteralInteger rI q o; +opFixedCosPiINTEL : idResult Equals Op (FixedCosPiINTEL idResultType | SpecConstantOp idResultType FixedCosPiINTEL) inputType input s iLiteralInteger rI q o; +opFixedSinCosPiINTEL : idResult Equals Op (FixedSinCosPiINTEL idResultType | SpecConstantOp idResultType FixedSinCosPiINTEL) inputType input s iLiteralInteger rI q o; +opFixedLogINTEL : idResult Equals Op (FixedLogINTEL idResultType | SpecConstantOp idResultType FixedLogINTEL) inputType input s iLiteralInteger rI q o; +opFixedExpINTEL : idResult Equals Op (FixedExpINTEL idResultType | SpecConstantOp idResultType FixedExpINTEL) inputType input s iLiteralInteger rI q o; +opPtrCastToCrossWorkgroupINTEL : idResult Equals Op (PtrCastToCrossWorkgroupINTEL idResultType | SpecConstantOp idResultType PtrCastToCrossWorkgroupINTEL) pointer; +opCrossWorkgroupCastToPtrINTEL : idResult Equals Op (CrossWorkgroupCastToPtrINTEL idResultType | SpecConstantOp idResultType CrossWorkgroupCastToPtrINTEL) pointer; + +// Extensions +literalExtInstInteger + : clspvReflection + | glsl + ; + + +// Extension clspvReflection +clspvReflection + : argumentInfo + | argumentPodPushConstant + | argumentPodStorageBuffer + | argumentPodUniform + | argumentPointerPushConstant + | argumentPointerUniform + | argumentSampledImage + | argumentSampler + | argumentStorageBuffer + | argumentStorageImage + | argumentStorageTexelBuffer + | argumentUniform + | argumentUniformTexelBuffer + | argumentWorkgroup + | constantDataPointerPushConstant + | constantDataStorageBuffer + | constantDataUniform + | imageArgumentInfoChannelDataTypePushConstant + | imageArgumentInfoChannelDataTypeUniform + | imageArgumentInfoChannelOrderPushConstant + | imageArgumentInfoChannelOrderUniform + | kernel + | literalSampler + | normalizedSamplerMaskPushConstant + | printfBufferPointerPushConstant + | printfBufferStorageBuffer + | printfInfo + | programScopeVariablePointerPushConstant + | programScopeVariablePointerRelocation + | programScopeVariablesStorageBuffer + | propertyRequiredWorkgroupSize + | pushConstantEnqueuedLocalSize + | pushConstantGlobalOffset + | pushConstantGlobalSize + | pushConstantNumWorkgroups + | pushConstantRegionGroupOffset + | pushConstantRegionOffset + | specConstantGlobalOffset + | specConstantSubgroupMaxSize + | specConstantWorkDim + | specConstantWorkgroupSize + ; + +kernel : ModeExt_Kernel kernelIdRef nameIdRef (numArguments (flags attributes?)?)?; +argumentInfo : ModeExt_ArgumentInfo nameIdRef (typeName (addressQualifier (accessQualifierIdRef typeQualifier?)?)?)?; +argumentStorageBuffer : ModeExt_ArgumentStorageBuffer decl ordinal descriptorSetIdRef binding argInfo?; +argumentUniform : ModeExt_ArgumentUniform decl ordinal descriptorSetIdRef binding argInfo?; +argumentPodStorageBuffer : ModeExt_ArgumentPodStorageBuffer decl ordinal descriptorSetIdRef binding offsetIdRef sizeIdRef argInfo?; +argumentPodUniform : ModeExt_ArgumentPodUniform decl ordinal descriptorSetIdRef binding offsetIdRef sizeIdRef argInfo?; +argumentPodPushConstant : ModeExt_ArgumentPodPushConstant decl ordinal offsetIdRef sizeIdRef argInfo?; +argumentSampledImage : ModeExt_ArgumentSampledImage decl ordinal descriptorSetIdRef binding argInfo?; +argumentStorageImage : ModeExt_ArgumentStorageImage decl ordinal descriptorSetIdRef binding argInfo?; +argumentSampler : ModeExt_ArgumentSampler decl ordinal descriptorSetIdRef binding argInfo?; +argumentWorkgroup : ModeExt_ArgumentWorkgroup decl ordinal specId elemSize argInfo?; +specConstantWorkgroupSize : ModeExt_SpecConstantWorkgroupSize x y z; +specConstantGlobalOffset : ModeExt_SpecConstantGlobalOffset x y z; +specConstantWorkDim : ModeExt_SpecConstantWorkDim dimIdRef; +pushConstantGlobalOffset : ModeExt_PushConstantGlobalOffset offsetIdRef sizeIdRef; +pushConstantEnqueuedLocalSize : ModeExt_PushConstantEnqueuedLocalSize offsetIdRef sizeIdRef; +pushConstantGlobalSize : ModeExt_PushConstantGlobalSize offsetIdRef sizeIdRef; +pushConstantRegionOffset : ModeExt_PushConstantRegionOffset offsetIdRef sizeIdRef; +pushConstantNumWorkgroups : ModeExt_PushConstantNumWorkgroups offsetIdRef sizeIdRef; +pushConstantRegionGroupOffset : ModeExt_PushConstantRegionGroupOffset offsetIdRef sizeIdRef; +constantDataStorageBuffer : ModeExt_ConstantDataStorageBuffer descriptorSetIdRef binding data; +constantDataUniform : ModeExt_ConstantDataUniform descriptorSetIdRef binding data; +literalSampler : ModeExt_LiteralSampler descriptorSetIdRef binding mask; +propertyRequiredWorkgroupSize : ModeExt_PropertyRequiredWorkgroupSize kernelIdRef x y z; +specConstantSubgroupMaxSize : ModeExt_SpecConstantSubgroupMaxSize sizeIdRef; +argumentPointerPushConstant : ModeExt_ArgumentPointerPushConstant kernelIdRef ordinal offsetIdRef sizeIdRef argInfo?; +argumentPointerUniform : ModeExt_ArgumentPointerUniform kernelIdRef ordinal descriptorSetIdRef binding offsetIdRef sizeIdRef argInfo?; +programScopeVariablesStorageBuffer : ModeExt_ProgramScopeVariablesStorageBuffer descriptorSetIdRef binding data; +programScopeVariablePointerRelocation : ModeExt_ProgramScopeVariablePointerRelocation objectOffset pointerOffset pointerSize; +imageArgumentInfoChannelOrderPushConstant : ModeExt_ImageArgumentInfoChannelOrderPushConstant kernelIdRef ordinal offsetIdRef sizeIdRef; +imageArgumentInfoChannelDataTypePushConstant : ModeExt_ImageArgumentInfoChannelDataTypePushConstant kernelIdRef ordinal offsetIdRef sizeIdRef; +imageArgumentInfoChannelOrderUniform : ModeExt_ImageArgumentInfoChannelOrderUniform kernelIdRef ordinal descriptorSetIdRef binding offsetIdRef sizeIdRef; +imageArgumentInfoChannelDataTypeUniform : ModeExt_ImageArgumentInfoChannelDataTypeUniform kernelIdRef ordinal descriptorSetIdRef binding offsetIdRef sizeIdRef; +argumentStorageTexelBuffer : ModeExt_ArgumentStorageTexelBuffer decl ordinal descriptorSetIdRef binding argInfo?; +argumentUniformTexelBuffer : ModeExt_ArgumentUniformTexelBuffer decl ordinal descriptorSetIdRef binding argInfo?; +constantDataPointerPushConstant : ModeExt_ConstantDataPointerPushConstant offsetIdRef sizeIdRef data; +programScopeVariablePointerPushConstant : ModeExt_ProgramScopeVariablePointerPushConstant offsetIdRef sizeIdRef data; +printfInfo : ModeExt_PrintfInfo printfID formatString argumentSizes*; +printfBufferStorageBuffer : ModeExt_PrintfBufferStorageBuffer descriptorSetIdRef binding bufferSize; +printfBufferPointerPushConstant : ModeExt_PrintfBufferPointerPushConstant offsetIdRef sizeIdRef bufferSize; +normalizedSamplerMaskPushConstant : ModeExt_NormalizedSamplerMaskPushConstant kernelIdRef ordinal offsetIdRef sizeIdRef; + +// Extension glsl +glsl + : acos + | acosh + | asin + | asinh + | atan + | atan2 + | atanh + | ceil + | cos + | cosh + | cross + | degrees + | determinant + | distance + | exp + | exp2 + | fAbs + | fClamp + | fMax + | fMin + | fMix + | fSign + | faceForward + | findILsb + | findSMsb + | findUMsb + | floor + | fma + | fract + | frexp + | frexpStruct + | iMix + | interpolateAtCentroid + | interpolateAtOffset + | interpolateAtSample + | inverseSqrt + | ldexp + | length + | log + | log2 + | matrixInverse + | modf + | modfStruct + | nClamp + | nMax + | nMin + | normalize + | packDouble2x32 + | packHalf2x16 + | packSnorm2x16 + | packSnorm4x8 + | packUnorm2x16 + | packUnorm4x8 + | pow + | radians + | reflect + | refract + | round + | roundEven + | sAbs + | sClamp + | sMax + | sMin + | sSign + | sin + | sinh + | smoothStep + | sqrt + | step + | tan + | tanh + | trunc + | uClamp + | uMax + | uMin + | unpackDouble2x32 + | unpackHalf2x16 + | unpackSnorm2x16 + | unpackSnorm4x8 + | unpackUnorm2x16 + | unpackUnorm4x8 + ; + +round : ModeExt_Round x; +roundEven : ModeExt_RoundEven x; +trunc : ModeExt_Trunc x; +fAbs : ModeExt_FAbs x; +sAbs : ModeExt_SAbs x; +fSign : ModeExt_FSign x; +sSign : ModeExt_SSign x; +floor : ModeExt_Floor x; +ceil : ModeExt_Ceil x; +fract : ModeExt_Fract x; +radians : ModeExt_Radians degreesIdRef; +degrees : ModeExt_Degrees radiansIdRef; +sin : ModeExt_Sin x; +cos : ModeExt_Cos x; +tan : ModeExt_Tan x; +asin : ModeExt_Asin x; +acos : ModeExt_Acos x; +atan : ModeExt_Atan y; +sinh : ModeExt_Sinh x; +cosh : ModeExt_Cosh x; +tanh : ModeExt_Tanh x; +asinh : ModeExt_Asinh x; +acosh : ModeExt_Acosh x; +atanh : ModeExt_Atanh x; +atan2 : ModeExt_Atan2 y x; +pow : ModeExt_Pow x y; +exp : ModeExt_Exp x; +log : ModeExt_Log x; +exp2 : ModeExt_Exp2 x; +log2 : ModeExt_Log2 x; +sqrt : ModeExt_Sqrt x; +inverseSqrt : ModeExt_InverseSqrt x; +determinant : ModeExt_Determinant x; +matrixInverse : ModeExt_MatrixInverse x; +modf : ModeExt_Modf x iIdRef; +modfStruct : ModeExt_ModfStruct x; +fMin : ModeExt_FMin x y; +uMin : ModeExt_UMin x y; +sMin : ModeExt_SMin x y; +fMax : ModeExt_FMax x y; +uMax : ModeExt_UMax x y; +sMax : ModeExt_SMax x y; +fClamp : ModeExt_FClamp x minVal maxVal; +uClamp : ModeExt_UClamp x minVal maxVal; +sClamp : ModeExt_SClamp x minVal maxVal; +fMix : ModeExt_FMix x y a; +iMix : ModeExt_IMix x y a; +step : ModeExt_Step edge x; +smoothStep : ModeExt_SmoothStep edge0 edge1 x; +fma : ModeExt_Fma a b c; +frexp : ModeExt_Frexp x expIdRef; +frexpStruct : ModeExt_FrexpStruct x; +ldexp : ModeExt_Ldexp x expIdRef; +packSnorm4x8 : ModeExt_PackSnorm4x8 v; +packUnorm4x8 : ModeExt_PackUnorm4x8 v; +packSnorm2x16 : ModeExt_PackSnorm2x16 v; +packUnorm2x16 : ModeExt_PackUnorm2x16 v; +packHalf2x16 : ModeExt_PackHalf2x16 v; +packDouble2x32 : ModeExt_PackDouble2x32 v; +unpackSnorm2x16 : ModeExt_UnpackSnorm2x16 p; +unpackUnorm2x16 : ModeExt_UnpackUnorm2x16 p; +unpackHalf2x16 : ModeExt_UnpackHalf2x16 v; +unpackSnorm4x8 : ModeExt_UnpackSnorm4x8 p; +unpackUnorm4x8 : ModeExt_UnpackUnorm4x8 p; +unpackDouble2x32 : ModeExt_UnpackDouble2x32 v; +length : ModeExt_Length x; +distance : ModeExt_Distance p0 p1; +cross : ModeExt_Cross x y; +normalize : ModeExt_Normalize x; +faceForward : ModeExt_FaceForward nIdRef iIdRef nref; +reflect : ModeExt_Reflect iIdRef nIdRef; +refract : ModeExt_Refract iIdRef nIdRef eta; +findILsb : ModeExt_FindILsb valueIdRef; +findSMsb : ModeExt_FindSMsb valueIdRef; +findUMsb : ModeExt_FindUMsb valueIdRef; +interpolateAtCentroid : ModeExt_InterpolateAtCentroid interpolant; +interpolateAtSample : ModeExt_InterpolateAtSample interpolant sample; +interpolateAtOffset : ModeExt_InterpolateAtOffset interpolant offsetIdRef; +nMin : ModeExt_NMin x y; +nMax : ModeExt_NMax x y; +nClamp : ModeExt_NClamp x minVal maxVal; + // Alias types a : idRef; accel : idRef; accelerationStructure : idRef; access : hostAccessQualifier; +accessQualifierAccessQualifier : accessQualifier; +accessQualifierIdRef : idRef; accumulator : idRef; +addressQualifier : idRef; addressWidth : literalInteger; aliasDomain : idRef; aliasScope : idRef; aliasingScopesList : idRef; alignmentIdRef : idRef; alignmentLiteralInteger : literalInteger; +argInfo : idRef; argument : idRef; argument0 : idRef; +argumentSizes : idRef; arrayMember : literalInteger; arrayStride : literalInteger; arrayed : literalInteger; @@ -1539,6 +1851,7 @@ asmTarget : literalString; asmType : idRef; attachment : idRef; attachmentIndex : literalInteger; +attributes : idRef; b : idRef; bFloat16Value : idRef; backwardReferenceFieldPolarity : idRef; @@ -1549,6 +1862,7 @@ barrierCount : literalInteger; barycentric : idRef; base : idRef; bidirectionalWeight : idRef; +binding : idRef; bindingPoint : literalInteger; bitWidth : literalInteger; bits : idRef; @@ -1557,6 +1871,7 @@ blockSize : idRef; boxSize : idRef; branchWeights : literalInteger; bufferLocationID : literalInteger; +bufferSize : idRef; bwdRefImage : idRef; bwdRefOffset : idRef; byteOffset : literalInteger; @@ -1601,24 +1916,34 @@ cycles : literalInteger; d : idRef; data : idRef; dataWidth : literalInteger; +decl : idRef; decorationGroup : idRef; default : idRef; +degreesIdRef : idRef; delta : idRef; depthLiteralInteger : literalInteger; -descriptorSet : literalInteger; +descriptorSetIdRef : idRef; +descriptorSetLiteralInteger : literalInteger; destination : idRef; +dimIdRef : idRef; direction : idRef; directionCost : idRef; dualRef : idRef; +edge : idRef; +edge0 : idRef; +edge1 : idRef; +elemSize : idRef; element : idRef; elementType : idRef; enable : literalInteger; enableSubnormals : literalInteger; entryPoint : idRef; equal : idMemorySemantics; +eta : idRef; event : idRef; eventsList : idRef; execution : idScope; +expIdRef : idRef; expectedValue : idRef; extension : literalString; falseLabel : idRef; @@ -1629,6 +1954,7 @@ flags : idRef; floatValue : idRef; floating : fPRoundingMode; forceKey : literalInteger; +formatString : idRef; forwardReferenceFieldPolarity : idRef; fragmentIndex : idRef; fromSign : literalInteger; @@ -1651,7 +1977,8 @@ hitObject : idRef; hitObjectAttribute : idRef; hitObjectAttributes : idRef; hitT : idRef; -i : literalInteger; +iIdRef : idRef; +iLiteralInteger : literalInteger; iOPipeID : literalInteger; id : idRef; image : idRef; @@ -1672,11 +1999,13 @@ instanceId : idRef; instruction : literalExtInstInteger; integerValue : idRef; interface : idRef; +interpolant : idRef; intersection : idRef; intraNeighbourAvailabilty : idRef; invocationId : idRef; invocations : literalInteger; invoke : idRef; +kernelIdRef : idRef; kind : literalInteger; latency : literalInteger; latencyLabel : literalInteger; @@ -1684,7 +2013,7 @@ leftEdgeChromaPixels : idRef; leftEdgeLumaPixels : idRef; leftMatrix : idRef; lenght : idRef; -length : idRef; +lengthIdRef : idRef; levelOfDetail : idRef; line : literalInteger; localId : idRef; @@ -1711,6 +2040,7 @@ maxByteOffsetLiteralInteger : literalInteger; maxError : literalFloat; maxMotionVectorCount : idRef; maxNumberOfPayloads : idRef; +maxVal : idRef; maximumCopies : literalInteger; maximumReplicates : literalInteger; member : literalInteger; @@ -1722,20 +2052,24 @@ memoryType : literalString; mergeBlock : idRef; mergeKey : literalString; mergeType : literalString; +minVal : idRef; minorShapes : idRef; missIndex : idRef; modeExecutionMode : executionMode; modeLiteralInteger : literalInteger; motionVectors : idRef; mout : literalInteger; -n : literalInteger; nDRange : idRef; +nIdRef : idRef; +nLiteralInteger : literalInteger; nameIdRef : idRef; nameLiteralString : literalString; namedBarrier : idRef; next : idRef; nodeIndex : idRef; nodeName : literalString; +nref : idRef; +numArguments : idRef; numElements : idRef; numEvents : idRef; numPackets : idRef; @@ -1745,15 +2079,18 @@ o : literalInteger; object : idRef; object1 : idRef; object2 : idRef; +objectOffset : idRef; offsetIdRef : idRef; offsetLiteralInteger : literalInteger; -opcode : literalSpecConstantOpInteger; operand : idRef; operand1 : idRef; operand2 : idRef; operation : groupOperation; +ordinal : idRef; origin : idRef; p : idRef; +p0 : idRef; +p1 : idRef; packedCostCenterDelta : idRef; packedCostTable : idRef; packedIndices : idRef; @@ -1781,6 +2118,8 @@ pipe : idRef; pipeStorage : idRef; pixelResolution : idRef; pointer : idRef; +pointerOffset : idRef; +pointerSize : idRef; pointerType : idRef; predicate : idRef; prefetcherSizeInBytes : literalInteger; @@ -1789,6 +2128,7 @@ primitiveCountIdRef : idRef; primitiveCountLiteralInteger : literalInteger; primitiveId : idRef; primitiveIndex : idRef; +printfID : idRef; process : literalString; profilingInfo : idRef; propagate : literalInteger; @@ -1799,6 +2139,7 @@ qp : idRef; qualifier : accessQualifier; queue : idRef; rI : literalInteger; +radiansIdRef : idRef; rayDirection : idRef; rayFlagsIdRef : idRef; rayOrigin : idRef; @@ -1857,6 +2198,7 @@ sliceType : idRef; sourceFieldPolarity : idRef; sourceIdRef : idRef; sourceLiteralString : literalString; +specId : idRef; specializationConstantID : literalInteger; srcCoord : idRef; srcImage : idRef; @@ -1894,6 +2236,8 @@ time : idRef; trigger : initializationModeQualifier; trueLabel : idRef; type : idRef; +typeName : idRef; +typeQualifier : idRef; unequal : idMemorySemantics; unsignedValue : idRef; upperEdgeChromaPixels : idRef; @@ -1903,6 +2247,7 @@ upperLeftCornerLumaPixel : idRef; upperRightEdgeLumaPixels : idRef; use : idRef; userType : literalString; +v : idRef; valueIdRef : idRef; valueLiteralContextDependentNumber : literalContextDependentNumber; valueLiteralInteger : literalInteger; @@ -1933,6 +2278,7 @@ y : idRef; ySizeHint : idRef; ySizeIdRef : idRef; ySizeLiteralInteger : literalInteger; +z : idRef; zSizeHint : idRef; zSizeIdRef : idRef; zSizeLiteralInteger : literalInteger; @@ -2402,7 +2748,7 @@ decoration | ConduitKernelArgumentINTEL | Constant | CounterBuffer counterBuffer - | DescriptorSet descriptorSet + | DescriptorSet descriptorSetLiteralInteger | DontStaticallyCoalesceINTEL | DoublepumpINTEL | ExplicitInterpAMD @@ -2484,7 +2830,7 @@ decoration | RestrictPointer | RestrictPointerEXT | RowMajor - | SIMTCallINTEL n + | SIMTCallINTEL nLiteralInteger | Sample | SaturatedConversion | SecondaryViewportRelativeNV offsetLiteralInteger @@ -3077,11 +3423,11 @@ storeCacheControl pairIdRefIdRef : idRef idRef; pairIdRefLiteralInteger : idRef literalInteger; pairLiteralIntegerIdRef : literalInteger idRef; -literalContextDependentNumber : LiteralUnsignedInteger | LiteralInteger | LiteralFloat; -literalExtInstInteger : LiteralExtInstInteger; +literalContextDependentNumber : LiteralInteger | LiteralFloat; +literanHeaderUnsignedInteger : ModeHeader_PositiveInteger; +initBaseValue : ModeHeader_NegativeInteger | ModeHeader_PositiveInteger; literalFloat : LiteralFloat; -literalInteger : LiteralUnsignedInteger | LiteralInteger; -literalSpecConstantOpInteger : opWithRet; +literalInteger : LiteralInteger; literalString : LiteralString; idMemorySemantics : Id; idRef : Id; diff --git a/dartagnan/src/main/antlr4/SpirvLexer.g4 b/dartagnan/src/main/antlr4/SpirvLexer.g4 index ac9475bf0d..a5eb0c2235 100644 --- a/dartagnan/src/main/antlr4/SpirvLexer.g4 +++ b/dartagnan/src/main/antlr4/SpirvLexer.g4 @@ -1675,20 +1675,176 @@ WriteBackINTEL : 'WriteBackINTEL'; Op : 'Op'; Equals : '='; +Pipe : '|'; Id : '%' [A-Za-z0-9_]+; -LiteralFloat : [+-]? [0-9]+ '.' [0-9]*; +fragment LiteralSciFloat : '-'? [0-9]+ '.' [0-9]* [eE] [+-]? [0-9]+; +fragment LiteralHexFloat : '-'? '0x' ([0-9]+ '.'? | [0-9]* '.' [0-9]+) [Pp]? [+-]? [0-9]+ [DdFf]?; +fragment LiteralBaseFloat : '-'? [0-9]+ '.' [0-9]*; +LiteralFloat : LiteralHexFloat | LiteralSciFloat | LiteralBaseFloat; LiteralInteger : '-'? [0-9]+; -LiteralUnsignedInteger : [0-9]+; LiteralString : '"' ~[\n"]* '"'; -LineComment : ';' ~[\n]* -> skip; +LineComment : ';' ~[\n@]* -> skip; +HeaderStart : [@] -> pushMode(ModeHeader), skip; Whitespace : [ \t\r\n]+ -> skip; +mode ModeHeader; + +ModeHeader_Input : 'Input'; +ModeHeader_Output : 'Output'; +ModeHeader_Config : 'Config'; +ModeHeader_Id : '%' [A-Za-z0-9_]+ -> type(Id); +ModeHeader_AssertionExists : 'exists'; +ModeHeader_AssertionForall : 'forall'; +ModeHeader_AssertionNot : 'not'; +ModeHeader_AssertionAnd : 'and'; +ModeHeader_AssertionOr : 'or'; +ModeHeader_Equal : '='; +ModeHeader_EqualEqual : '=='; +ModeHeader_NotEqual : '!='; +ModeHeader_Less : '<'; +ModeHeader_Greater : '>'; +ModeHeader_LessEqual : '<='; +ModeHeader_GreaterEqual : '>='; +ModeHeader_LBracket : '['; +ModeHeader_RBracket : ']'; +ModeHeader_LPar : '('; +ModeHeader_RPar : ')'; +ModeHeader_LBrace : '{'; +ModeHeader_RBrace : '}'; +ModeHeader_Colon : ':'; +ModeHeader_Comma : ','; +ModeHeader_PositiveInteger : [0-9]+; +ModeHeader_NegativeInteger : '-' [0-9]+; +ModeHeader_Whitespace : [ \t\r]+ -> skip; +ModeHeader_NewLine : [\n]+ -> popMode, skip; + mode ModeExt; -ModeExt_Op : 'Op' -> type(Op); +ModeExt_Kernel : 'Kernel'; +ModeExt_ArgumentInfo : 'ArgumentInfo'; +ModeExt_ArgumentStorageBuffer : 'ArgumentStorageBuffer'; +ModeExt_ArgumentUniform : 'ArgumentUniform'; +ModeExt_ArgumentPodStorageBuffer : 'ArgumentPodStorageBuffer'; +ModeExt_ArgumentPodUniform : 'ArgumentPodUniform'; +ModeExt_ArgumentPodPushConstant : 'ArgumentPodPushConstant'; +ModeExt_ArgumentSampledImage : 'ArgumentSampledImage'; +ModeExt_ArgumentStorageImage : 'ArgumentStorageImage'; +ModeExt_ArgumentSampler : 'ArgumentSampler'; +ModeExt_ArgumentWorkgroup : 'ArgumentWorkgroup'; +ModeExt_SpecConstantWorkgroupSize : 'SpecConstantWorkgroupSize'; +ModeExt_SpecConstantGlobalOffset : 'SpecConstantGlobalOffset'; +ModeExt_SpecConstantWorkDim : 'SpecConstantWorkDim'; +ModeExt_PushConstantGlobalOffset : 'PushConstantGlobalOffset'; +ModeExt_PushConstantEnqueuedLocalSize : 'PushConstantEnqueuedLocalSize'; +ModeExt_PushConstantGlobalSize : 'PushConstantGlobalSize'; +ModeExt_PushConstantRegionOffset : 'PushConstantRegionOffset'; +ModeExt_PushConstantNumWorkgroups : 'PushConstantNumWorkgroups'; +ModeExt_PushConstantRegionGroupOffset : 'PushConstantRegionGroupOffset'; +ModeExt_ConstantDataStorageBuffer : 'ConstantDataStorageBuffer'; +ModeExt_ConstantDataUniform : 'ConstantDataUniform'; +ModeExt_LiteralSampler : 'LiteralSampler'; +ModeExt_PropertyRequiredWorkgroupSize : 'PropertyRequiredWorkgroupSize'; +ModeExt_SpecConstantSubgroupMaxSize : 'SpecConstantSubgroupMaxSize'; +ModeExt_ArgumentPointerPushConstant : 'ArgumentPointerPushConstant'; +ModeExt_ArgumentPointerUniform : 'ArgumentPointerUniform'; +ModeExt_ProgramScopeVariablesStorageBuffer : 'ProgramScopeVariablesStorageBuffer'; +ModeExt_ProgramScopeVariablePointerRelocation : 'ProgramScopeVariablePointerRelocation'; +ModeExt_ImageArgumentInfoChannelOrderPushConstant : 'ImageArgumentInfoChannelOrderPushConstant'; +ModeExt_ImageArgumentInfoChannelDataTypePushConstant : 'ImageArgumentInfoChannelDataTypePushConstant'; +ModeExt_ImageArgumentInfoChannelOrderUniform : 'ImageArgumentInfoChannelOrderUniform'; +ModeExt_ImageArgumentInfoChannelDataTypeUniform : 'ImageArgumentInfoChannelDataTypeUniform'; +ModeExt_ArgumentStorageTexelBuffer : 'ArgumentStorageTexelBuffer'; +ModeExt_ArgumentUniformTexelBuffer : 'ArgumentUniformTexelBuffer'; +ModeExt_ConstantDataPointerPushConstant : 'ConstantDataPointerPushConstant'; +ModeExt_ProgramScopeVariablePointerPushConstant : 'ProgramScopeVariablePointerPushConstant'; +ModeExt_PrintfInfo : 'PrintfInfo'; +ModeExt_PrintfBufferStorageBuffer : 'PrintfBufferStorageBuffer'; +ModeExt_PrintfBufferPointerPushConstant : 'PrintfBufferPointerPushConstant'; +ModeExt_NormalizedSamplerMaskPushConstant : 'NormalizedSamplerMaskPushConstant'; + +ModeExt_Round : 'Round'; +ModeExt_RoundEven : 'RoundEven'; +ModeExt_Trunc : 'Trunc'; +ModeExt_FAbs : 'FAbs'; +ModeExt_SAbs : 'SAbs'; +ModeExt_FSign : 'FSign'; +ModeExt_SSign : 'SSign'; +ModeExt_Floor : 'Floor'; +ModeExt_Ceil : 'Ceil'; +ModeExt_Fract : 'Fract'; +ModeExt_Radians : 'Radians'; +ModeExt_Degrees : 'Degrees'; +ModeExt_Sin : 'Sin'; +ModeExt_Cos : 'Cos'; +ModeExt_Tan : 'Tan'; +ModeExt_Asin : 'Asin'; +ModeExt_Acos : 'Acos'; +ModeExt_Atan : 'Atan'; +ModeExt_Sinh : 'Sinh'; +ModeExt_Cosh : 'Cosh'; +ModeExt_Tanh : 'Tanh'; +ModeExt_Asinh : 'Asinh'; +ModeExt_Acosh : 'Acosh'; +ModeExt_Atanh : 'Atanh'; +ModeExt_Atan2 : 'Atan2'; +ModeExt_Pow : 'Pow'; +ModeExt_Exp : 'Exp'; +ModeExt_Log : 'Log'; +ModeExt_Exp2 : 'Exp2'; +ModeExt_Log2 : 'Log2'; +ModeExt_Sqrt : 'Sqrt'; +ModeExt_InverseSqrt : 'InverseSqrt'; +ModeExt_Determinant : 'Determinant'; +ModeExt_MatrixInverse : 'MatrixInverse'; +ModeExt_Modf : 'Modf'; +ModeExt_ModfStruct : 'ModfStruct'; +ModeExt_FMin : 'FMin'; +ModeExt_UMin : 'UMin'; +ModeExt_SMin : 'SMin'; +ModeExt_FMax : 'FMax'; +ModeExt_UMax : 'UMax'; +ModeExt_SMax : 'SMax'; +ModeExt_FClamp : 'FClamp'; +ModeExt_UClamp : 'UClamp'; +ModeExt_SClamp : 'SClamp'; +ModeExt_FMix : 'FMix'; +ModeExt_IMix : 'IMix'; +ModeExt_Step : 'Step'; +ModeExt_SmoothStep : 'SmoothStep'; +ModeExt_Fma : 'Fma'; +ModeExt_Frexp : 'Frexp'; +ModeExt_FrexpStruct : 'FrexpStruct'; +ModeExt_Ldexp : 'Ldexp'; +ModeExt_PackSnorm4x8 : 'PackSnorm4x8'; +ModeExt_PackUnorm4x8 : 'PackUnorm4x8'; +ModeExt_PackSnorm2x16 : 'PackSnorm2x16'; +ModeExt_PackUnorm2x16 : 'PackUnorm2x16'; +ModeExt_PackHalf2x16 : 'PackHalf2x16'; +ModeExt_PackDouble2x32 : 'PackDouble2x32'; +ModeExt_UnpackSnorm2x16 : 'UnpackSnorm2x16'; +ModeExt_UnpackUnorm2x16 : 'UnpackUnorm2x16'; +ModeExt_UnpackHalf2x16 : 'UnpackHalf2x16'; +ModeExt_UnpackSnorm4x8 : 'UnpackSnorm4x8'; +ModeExt_UnpackUnorm4x8 : 'UnpackUnorm4x8'; +ModeExt_UnpackDouble2x32 : 'UnpackDouble2x32'; +ModeExt_Length : 'Length'; +ModeExt_Distance : 'Distance'; +ModeExt_Cross : 'Cross'; +ModeExt_Normalize : 'Normalize'; +ModeExt_FaceForward : 'FaceForward'; +ModeExt_Reflect : 'Reflect'; +ModeExt_Refract : 'Refract'; +ModeExt_FindILsb : 'FindILsb'; +ModeExt_FindSMsb : 'FindSMsb'; +ModeExt_FindUMsb : 'FindUMsb'; +ModeExt_InterpolateAtCentroid : 'InterpolateAtCentroid'; +ModeExt_InterpolateAtSample : 'InterpolateAtSample'; +ModeExt_InterpolateAtOffset : 'InterpolateAtOffset'; +ModeExt_NMin : 'NMin'; +ModeExt_NMax : 'NMax'; +ModeExt_NClamp : 'NClamp'; + ModeExt_Id : '%' [A-Za-z0-9_]+ -> type(Id); -LiteralExtInstInteger : [A-Za-z] [A-Za-z0-9_]*; ModeExt_LineComment : ';' ~[\n]* -> skip; ModeExt_Whitespace : [ \t\r]+ -> skip; ModeExt_NewLine : [\n]+ -> popMode, skip; - diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/Dartagnan.java b/dartagnan/src/main/java/com/dat3m/dartagnan/Dartagnan.java index ed965c7348..3ccab85b38 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/Dartagnan.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/Dartagnan.java @@ -74,7 +74,7 @@ public class Dartagnan extends BaseOptions { private static final Logger logger = LogManager.getLogger(Dartagnan.class); private static final Set supportedFormats = - ImmutableSet.copyOf(Arrays.asList(".litmus", ".c", ".i", ".ll")); + ImmutableSet.copyOf(Arrays.asList(".litmus", ".c", ".i", ".ll", ".spv.dis")); private Dartagnan(Configuration config) throws InvalidConfigurationException { config.recursiveInject(this); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/GlobalSettings.java b/dartagnan/src/main/java/com/dat3m/dartagnan/GlobalSettings.java index 3f3b80ca56..8d7d52b1fb 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/GlobalSettings.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/GlobalSettings.java @@ -77,7 +77,7 @@ public static String getOutputDirectory() { if (!home.isEmpty()) { return home + "/output"; } - return ""; + return "output"; } private static boolean isJUnitTest() { diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/EncodingContext.java b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/EncodingContext.java index 8f26fc0ad3..fb41926838 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/EncodingContext.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/EncodingContext.java @@ -5,7 +5,6 @@ import com.dat3m.dartagnan.expression.integers.IntCmpOp; import com.dat3m.dartagnan.expression.type.BooleanType; import com.dat3m.dartagnan.expression.type.IntegerType; -import com.dat3m.dartagnan.expression.type.TypeFactory; import com.dat3m.dartagnan.program.Register; import com.dat3m.dartagnan.program.analysis.BranchEquivalence; import com.dat3m.dartagnan.program.analysis.ExecutionAnalysis; @@ -214,17 +213,13 @@ public BooleanFormula dependency(Event first, Event second) { return booleanFormulaManager.makeVariable("idd " + first.getGlobalId() + " " + second.getGlobalId()); } - public Formula lastValue(MemoryObject base, int offset) { + public Formula lastValue(MemoryObject base, int offset, int size) { checkArgument(0 <= offset && offset < base.size(), "array index out of bounds"); final String name = String.format("last_val_at_%s_%d", base, offset); if (useIntegers) { return formulaManager.getIntegerFormulaManager().makeVariable(name); } - //TODO match this with the actual type stored at the memory address - // (we do not know and guess the arch type right now) - TypeFactory types = TypeFactory.getInstance(); - final int archSize = types.getMemorySizeInBits(types.getArchType()); - return formulaManager.getBitvectorFormulaManager().makeVariable(archSize, name); + return formulaManager.getBitvectorFormulaManager().makeVariable(size, name); } public BooleanFormula equal(Formula left, Formula right) { diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/ExpressionEncoder.java b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/ExpressionEncoder.java index 66a55390d2..f82fdea03b 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/ExpressionEncoder.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/ExpressionEncoder.java @@ -8,6 +8,7 @@ import com.dat3m.dartagnan.expression.booleans.BoolUnaryExpr; import com.dat3m.dartagnan.expression.integers.*; import com.dat3m.dartagnan.expression.misc.ITEExpr; +import com.dat3m.dartagnan.expression.type.TypeFactory; import com.dat3m.dartagnan.program.Register; import com.dat3m.dartagnan.program.event.Event; import com.dat3m.dartagnan.program.memory.Location; @@ -23,6 +24,8 @@ class ExpressionEncoder implements ExpressionVisitor { + private static final TypeFactory types = TypeFactory.getInstance(); + private final EncodingContext context; private final FormulaManager formulaManager; private final BooleanFormulaManager booleanFormulaManager; @@ -297,6 +300,7 @@ public Formula visitMemoryObject(MemoryObject memObj) { @Override public Formula visitLocation(Location location) { checkState(event == null, "Cannot evaluate %s at event %s.", location, event); - return context.lastValue(location.getMemoryObject(), location.getOffset()); + int size = types.getMemorySizeInBits(location.getType()); + return context.lastValue(location.getMemoryObject(), location.getOffset(), size); } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/ProgramEncoder.java b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/ProgramEncoder.java index 2fffb5de73..d8d65418af 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/ProgramEncoder.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/ProgramEncoder.java @@ -1,15 +1,19 @@ package com.dat3m.dartagnan.encoding; +import com.dat3m.dartagnan.expression.Expression; import com.dat3m.dartagnan.expression.type.IntegerType; import com.dat3m.dartagnan.program.Program; import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.ScopeHierarchy; import com.dat3m.dartagnan.program.Thread; import com.dat3m.dartagnan.program.analysis.BranchEquivalence; import com.dat3m.dartagnan.program.analysis.Dependency; import com.dat3m.dartagnan.program.analysis.ExecutionAnalysis; import com.dat3m.dartagnan.program.event.Event; import com.dat3m.dartagnan.program.event.RegWriter; +import com.dat3m.dartagnan.program.event.Tag; import com.dat3m.dartagnan.program.event.core.CondJump; +import com.dat3m.dartagnan.program.event.core.ControlBarrier; import com.dat3m.dartagnan.program.event.core.Label; import com.dat3m.dartagnan.program.event.core.threading.ThreadStart; import com.dat3m.dartagnan.program.memory.Memory; @@ -25,13 +29,11 @@ import org.sosy_lab.java_smt.api.NumeralFormula.IntegerFormula; import java.math.BigInteger; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import static com.dat3m.dartagnan.configuration.OptionNames.INITIALIZE_REGISTERS; import static com.google.common.collect.Lists.reverse; +import static java.util.stream.Collectors.*; @Options public class ProgramEncoder implements Encoder { @@ -70,6 +72,7 @@ public static ProgramEncoder withContext(EncodingContext context) throws Invalid public BooleanFormula encodeFullProgram() { return context.getBooleanFormulaManager().and( + encodeControlBarriers(), encodeConstants(), encodeMemory(), encodeControlFlow(), @@ -78,6 +81,32 @@ public BooleanFormula encodeFullProgram() { encodeDependencies()); } + public BooleanFormula encodeControlBarriers() { + BooleanFormulaManager bmgr = context.getBooleanFormulaManager(); + BooleanFormula enc = bmgr.makeTrue(); + Map> groups = context.getTask().getProgram().getThreads().stream() + .filter(Thread::hasScope) + .collect(groupingBy(this::getWorkgroupId, + flatMapping(t -> t.getEvents(ControlBarrier.class).stream(), toList()))); + + for (List events : groups.values()) { + for (ControlBarrier e1 : events) { + Expression id1 = e1.getId(); + BooleanFormula allCF = context.controlFlow(e1); + for (ControlBarrier e2 : events) { + if (!e1.getThread().equals(e2.getThread())) { + Expression id2 = e2.getId(); + BooleanFormula sameId = context.equal(context.encodeExpressionAt(id1, e1), context.encodeExpressionAt(id2, e2)); + BooleanFormula cf = bmgr.or(context.controlFlow(e2), bmgr.not(sameId)); + allCF = bmgr.and(allCF, cf); + } + } + enc = bmgr.and(enc, bmgr.equivalence(allCF, context.execution(e1))); + } + } + return enc; + } + public BooleanFormula encodeConstants() { List enc = new ArrayList<>(); for (NonDetValue value : context.getTask().getProgram().getConstants()) { @@ -121,22 +150,27 @@ private BooleanFormula encodeThreadCF(Thread thread) { enc.add(startEvent.encodeExec(context)); Event pred = startEvent; - for(Event e : startEvent.getSuccessor().getSuccessors()) { - // Immediate control flow - BooleanFormula cfCond = context.controlFlow(pred); - if (pred instanceof CondJump jump) { - cfCond = bmgr.and(cfCond, bmgr.not(context.jumpCondition(jump))); - } + Event next = startEvent.getSuccessor(); + if (next != null) { + for(Event e : next.getSuccessors()) { + // Immediate control flow + BooleanFormula cfCond = context.controlFlow(pred); + if (pred instanceof CondJump jump) { + cfCond = bmgr.and(cfCond, bmgr.not(context.jumpCondition(jump))); + } else if (pred instanceof ControlBarrier) { + cfCond = bmgr.and(cfCond, context.execution(pred)); + } - // Control flow via jumps - if (e instanceof Label label) { - for (CondJump jump : label.getJumpSet()) { - cfCond = bmgr.or(cfCond, bmgr.and(context.controlFlow(jump), context.jumpCondition(jump))); + // Control flow via jumps + if (e instanceof Label label) { + for (CondJump jump : label.getJumpSet()) { + cfCond = bmgr.or(cfCond, bmgr.and(context.controlFlow(jump), context.jumpCondition(jump))); + } } + enc.add(bmgr.equivalence(context.controlFlow(e), cfCond)); + enc.add(e.encodeExec(context)); + pred = e; } - enc.add(bmgr.equivalence(context.controlFlow(e), cfCond)); - enc.add(e.encodeExec(context)); - pred = e; } return bmgr.and(enc); } @@ -289,4 +323,17 @@ public BooleanFormula encodeFinalRegisterValues() { } return bmgr.and(enc); } + + private int getWorkgroupId(Thread thread) { + ScopeHierarchy hierarchy = thread.getScopeHierarchy(); + if (hierarchy != null) { + int id = hierarchy.getScopeId(Tag.Vulkan.WORK_GROUP); + if (id < 0) { + id = hierarchy.getScopeId(Tag.PTX.CTA); + } + return id; + } + throw new IllegalArgumentException("Attempt to compute workgroup ID " + + "for a non-hierarchical thread"); + } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/PropertyEncoder.java b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/PropertyEncoder.java index cafe77f6d3..398a34d5bf 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/PropertyEncoder.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/PropertyEncoder.java @@ -2,6 +2,7 @@ import com.dat3m.dartagnan.configuration.Arch; import com.dat3m.dartagnan.configuration.Property; +import com.dat3m.dartagnan.expression.type.TypeFactory; import com.dat3m.dartagnan.program.Program; import com.dat3m.dartagnan.program.Thread; import com.dat3m.dartagnan.program.analysis.ExecutionAnalysis; @@ -35,12 +36,13 @@ import java.util.stream.Collectors; import static com.dat3m.dartagnan.configuration.Property.*; -import static com.dat3m.dartagnan.program.Program.SourceLanguage.LITMUS; import static com.dat3m.dartagnan.wmm.RelationNameRepository.CO; +import static com.dat3m.dartagnan.program.Program.SourceLanguage.LLVM; public class PropertyEncoder implements Encoder { private static final Logger logger = LogManager.getLogger(PropertyEncoder.class); + private static final TypeFactory types = TypeFactory.getInstance(); private final EncodingContext context; private final Program program; @@ -110,7 +112,7 @@ public BooleanFormula encodeProperties(EnumSet properties) { BooleanFormula encoding = (specType == Property.Type.SAFETY) ? encodePropertyViolations(properties) : encodePropertyWitnesses(properties); - if (program.getFormat().equals(LITMUS) || properties.contains(LIVENESS)) { + if (!program.getFormat().equals(LLVM) || properties.contains(LIVENESS)) { // Both litmus assertions and liveness need to identify // the final stores to addresses. // TODO Optimization: This encoding can be restricted to only those addresses @@ -167,7 +169,7 @@ private BooleanFormula encodeLastCoConstraints() { final EncodingContext.EdgeEncoder coEncoder = context.edge(co); final RelationAnalysis.Knowledge knowledge = ra.getKnowledge(co); final List initEvents = program.getThreadEvents(Init.class); - final boolean doEncodeFinalAddressValues = program.getFormat() == LITMUS; + final boolean doEncodeFinalAddressValues = program.getFormat() != LLVM; // Find transitively implied coherences. We can use these to reduce the encoding. final EventGraph transCo = ra.findTransitivelyImpliedCo(co); // Find all writes that are never last, i.e., those that will always have a co-successor. @@ -205,7 +207,8 @@ private BooleanFormula encodeLastCoConstraints() { continue; } BooleanFormula sameAddress = context.sameAddress(init, w1); - Formula v2 = context.lastValue(init.getBase(), init.getOffset()); + int size = types.getMemorySizeInBits(init.getValue().getType()); + Formula v2 = context.lastValue(init.getBase(), init.getOffset(), size); BooleanFormula sameValue = context.equal(context.value(w1), v2); enc.add(bmgr.implication(bmgr.and(lastCoExpr, sameAddress), sameValue)); } @@ -219,7 +222,8 @@ private BooleanFormula encodeLastCoConstraints() { for (Init init : program.getThreadEvents(Init.class)) { BooleanFormula lastValueEnc = bmgr.makeFalse(); BooleanFormula lastStoreExistsEnc = bmgr.makeFalse(); - Formula v2 = context.lastValue(init.getBase(), init.getOffset()); + int size = types.getMemorySizeInBits(init.getValue().getType()); + Formula v2 = context.lastValue(init.getBase(), init.getOffset(), size); BooleanFormula readFromInit = context.equal(context.value(init), v2); for (Store w : program.getThreadEvents(Store.class)) { if (!alias.mayAlias(w, init)) { @@ -269,9 +273,19 @@ private TrackableFormula encodeProgramSpecification() { case FORALL, NOT_EXISTS, ASSERT -> bmgr.not(PROGRAM_SPEC.getSMTVariable(context)); case EXISTS -> PROGRAM_SPEC.getSMTVariable(context); }; + if (!program.getFormat().equals(LLVM)) { + encoding = bmgr.and(encoding, encodeProgramTermination()); + } return new TrackableFormula(trackingLiteral, encoding); } + private BooleanFormula encodeProgramTermination() { + final BooleanFormulaManager bmgr = context.getBooleanFormulaManager(); + return bmgr.and(program.getThreads().stream() + .map(t -> bmgr.equivalence(context.execution(t.getEntry()), context.execution(t.getExit()))) + .toList()); + } + // ====================================================================== // ====================================================================== // ======================== CAT Specification ========================== @@ -430,8 +444,9 @@ public TrackableFormula encodeDeadlocks() { final Map> spinloopsMap = Maps.toMap(program.getThreads(), t -> this.findSpinLoopsInThread(t, loopAnalysis)); // Compute "stuckness" encoding for all threads - final Map isStuckMap = Maps.toMap(program.getThreads(), - t -> this.generateStucknessEncoding(spinloopsMap.get(t), context)); + final Map isStuckMap = Maps.toMap(program.getThreads(), t -> + bmgr.or(generateBarrierStucknessEncoding(t, context), + this.generateSpinloopStucknessEncoding(spinloopsMap.get(t), context))); // Deadlock <=> allStuckOrDone /\ atLeastOneStuck BooleanFormula allStuckOrDone = bmgr.makeTrue(); @@ -453,9 +468,17 @@ public TrackableFormula encodeDeadlocks() { return new TrackableFormula(bmgr.not(LIVENESS.getSMTVariable(context)), hasDeadlock); } + private BooleanFormula generateBarrierStucknessEncoding(Thread thread, EncodingContext context) { + final BooleanFormulaManager bmgr = context.getBooleanFormulaManager(); + return bmgr.or(thread.getEvents().stream() + .filter(ControlBarrier.class::isInstance) + .map(e -> bmgr.and(context.controlFlow(e), bmgr.not(context.execution(e)))) + .toList()); + } + // Compute "stuckness": A thread is stuck if it reaches a spin loop bound event // while only reading from co-maximal stores. - private BooleanFormula generateStucknessEncoding(List loops, EncodingContext context) { + private BooleanFormula generateSpinloopStucknessEncoding(List loops, EncodingContext context) { final BooleanFormulaManager bmgr = context.getBooleanFormulaManager(); final RelationAnalysis ra = PropertyEncoder.this.ra; final Relation rf = memoryModel.getRelation(RelationNameRepository.RF); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/WmmEncoder.java b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/WmmEncoder.java index ff1f0e49d3..47c66da65b 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/WmmEncoder.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/WmmEncoder.java @@ -9,7 +9,7 @@ import com.dat3m.dartagnan.program.event.MemoryEvent; import com.dat3m.dartagnan.program.event.RegWriter; import com.dat3m.dartagnan.program.event.Tag; -import com.dat3m.dartagnan.program.event.core.FenceWithId; +import com.dat3m.dartagnan.program.event.core.ControlBarrier; import com.dat3m.dartagnan.program.event.core.Load; import com.dat3m.dartagnan.program.event.core.MemoryCoreEvent; import com.dat3m.dartagnan.program.event.core.RMWStoreExclusive; @@ -627,21 +627,21 @@ public Void visitSyncBarrier(SyncBar syncBar) { EncodingContext.EdgeEncoder encoder = context.edge(rel); EventGraph mustSet = ra.getKnowledge(rel).getMustSet(); encodeSets.get(rel).apply((e1, e2) -> { - FenceWithId f1 = (FenceWithId) e1; - FenceWithId f2 = (FenceWithId) e2; + ControlBarrier b1 = (ControlBarrier) e1; + ControlBarrier b2 = (ControlBarrier) e2; BooleanFormula sameId; // If they are in must, they are guaranteed to have the same id - if (mustSet.contains(f1, f2)) { + if (mustSet.contains(b1, b2)) { sameId = bmgr.makeTrue(); } else { - Expression id1 = f1.getFenceID(); - Expression id2 = f2.getFenceID(); - sameId = context.equal(context.encodeExpressionAt(id1, f1), - context.encodeExpressionAt(id2, f2)); + Expression id1 = b1.getId(); + Expression id2 = b2.getId(); + sameId = context.equal(context.encodeExpressionAt(id1, b1), + context.encodeExpressionAt(id2, b2)); } enc.add(bmgr.equivalence( - encoder.encode(f1, f2), - bmgr.and(execution(f1, f2), sameId))); + encoder.encode(b1, b2), + bmgr.and(execution(b1, b2), sameId))); }); return null; } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/exception/ParsingException.java b/dartagnan/src/main/java/com/dat3m/dartagnan/exception/ParsingException.java index a5cb63957b..f80d5ed119 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/exception/ParsingException.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/exception/ParsingException.java @@ -5,4 +5,8 @@ public class ParsingException extends RuntimeException { public ParsingException(String msg){ super(msg); } + + public ParsingException(String format, Object... args){ + this(String.format(format, args)); + } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/Expression.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/Expression.java index 518d22e252..afc86451c1 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/Expression.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/Expression.java @@ -2,6 +2,8 @@ import com.dat3m.dartagnan.expression.processing.ExpressionInspector; import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.memory.Location; +import com.dat3m.dartagnan.program.memory.MemoryObject; import com.google.common.collect.ImmutableSet; import java.util.List; @@ -28,4 +30,24 @@ public Expression visitRegister(Register reg) { return collector.regs.build(); } + default ImmutableSet getMemoryObjects() { + class MemoryObjectCollector implements ExpressionInspector { + private final ImmutableSet.Builder objects = ImmutableSet.builder(); + @Override + public MemoryObject visitMemoryObject(MemoryObject memObj) { + objects.add(memObj); + return memObj; + } + + @Override + public Expression visitLocation(Location location) { + objects.add(location.getMemoryObject()); + return location; + } + } + + final MemoryObjectCollector collector = new MemoryObjectCollector(); + this.accept(collector); + return collector.objects.build(); + } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/ExpressionFactory.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/ExpressionFactory.java index b81a40ff62..90d8481105 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/ExpressionFactory.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/ExpressionFactory.java @@ -8,6 +8,9 @@ import com.dat3m.dartagnan.expression.misc.GEPExpr; import com.dat3m.dartagnan.expression.misc.ITEExpr; import com.dat3m.dartagnan.expression.type.*; +import com.dat3m.dartagnan.program.memory.MemoryObject; +import com.dat3m.dartagnan.program.memory.ScopedPointer; +import com.dat3m.dartagnan.program.memory.ScopedPointerVariable; import com.google.common.base.Preconditions; import java.math.BigDecimal; @@ -279,6 +282,14 @@ public Expression makeGetElementPointer(Type indexingType, Expression base, List return new GEPExpr(indexingType, base, offsets); } + public ScopedPointer makeScopedPointer(String id, String scopeId, Type type, Expression address) { + return new ScopedPointer(id, scopeId, type, address); + } + + public ScopedPointerVariable makeScopedPointerVariable(String id, String scopeId, Type type, MemoryObject address) { + return new ScopedPointerVariable(id, scopeId, type, address); + } + // ----------------------------------------------------------------------------------------------------------------- // Misc diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/misc/ConstructExpr.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/misc/ConstructExpr.java index 0ebdd6f799..f118bffba7 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/misc/ConstructExpr.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/misc/ConstructExpr.java @@ -9,6 +9,7 @@ import com.dat3m.dartagnan.expression.type.ArrayType; import java.util.List; +import java.util.stream.Collectors; import static com.google.common.base.Preconditions.checkArgument; @@ -31,4 +32,9 @@ public ConstructExpr(Type type, List arguments) { public T accept(ExpressionVisitor visitor) { return visitor.visitConstructExpression(this); } -} + + @Override + public String toString() { + return operands.stream().map(Expression::toString).collect(Collectors.joining(", ", "{ ", " }")); + } +} \ No newline at end of file diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/FunctionType.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/FunctionType.java index 24f0a519f6..7b69d6ca88 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/FunctionType.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/FunctionType.java @@ -28,7 +28,7 @@ public boolean equals(Object obj) { return true; } return (obj instanceof FunctionType other) - && other.returnType == this.returnType + && other.returnType.equals(this.returnType) && Arrays.equals(other.parameterTypes, this.parameterTypes) && other.isVarArgs == this.isVarArgs; } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/IntegerType.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/IntegerType.java index 1d45a1f3e4..71924ef96c 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/IntegerType.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/IntegerType.java @@ -5,7 +5,7 @@ import java.math.BigInteger; -public final class IntegerType implements Type { +public class IntegerType implements Type { private final int bitWidth; diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/ScopedPointerType.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/ScopedPointerType.java new file mode 100644 index 0000000000..e0fefdb89a --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/ScopedPointerType.java @@ -0,0 +1,45 @@ +package com.dat3m.dartagnan.expression.type; + +import com.dat3m.dartagnan.expression.Type; + +import java.util.Objects; + +public class ScopedPointerType extends IntegerType { + + private static final int ARCH_SIZE = TypeFactory.getInstance().getArchType().getBitWidth(); + + private final String scopeId; + private final Type pointedType; + + ScopedPointerType(String scopeId, Type pointedType) { + super(ARCH_SIZE); + this.scopeId = scopeId; + this.pointedType = pointedType; + } + + public String getScopeId() { + return scopeId; + } + + public Type getPointedType() { + return pointedType; + } + + @Override + public String toString() { + return String.format("%s(%s)*", pointedType.toString(), scopeId); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof ScopedPointerType that)) return false; + if (!super.equals(o)) return false; + return Objects.equals(scopeId, that.scopeId) && Objects.equals(pointedType, that.pointedType); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), scopeId, pointedType); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeFactory.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeFactory.java index f696baf845..148b4cb13d 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeFactory.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeFactory.java @@ -44,6 +44,12 @@ public IntegerType getIntegerType(int bitWidth) { return typeNormalizer.normalize(new IntegerType(bitWidth)); } + public ScopedPointerType getScopedPointerType(String scopeId, Type pointedType) { + checkNotNull(scopeId); + checkNotNull(pointedType); + return typeNormalizer.normalize(new ScopedPointerType(scopeId, pointedType)); + } + public FloatType getFloatType(int mantissaBits, int exponentBits) { checkArgument(mantissaBits > 0 && exponentBits > 0, "Cannot construct floating-point type with mantissa %s and exponent %s", @@ -132,4 +138,52 @@ public Map decomposeIntoPrimitives(Type type) { return decomposition; } + + public static boolean isStaticType(Type type) { + if (type instanceof BooleanType || type instanceof IntegerType || type instanceof FloatType) { + return true; + } + if (type instanceof ArrayType aType) { + return aType.hasKnownNumElements() && isStaticType(aType.getElementType()); + } + if (type instanceof AggregateType aType) { + for (Type elType : aType.getDirectFields()) { + if (!isStaticType(elType)) { + return false; + } + } + return true; + } + throw new UnsupportedOperationException("Cannot compute if type '" + type + "' is static"); + } + + public static boolean isStaticTypeOf(Type staticType, Type runtimeType) { + if (staticType.equals(runtimeType)) { + return true; + } + if (staticType instanceof AggregateType aStaticType && runtimeType instanceof AggregateType aRuntimeType) { + int size = aStaticType.getDirectFields().size(); + if (size != aRuntimeType.getDirectFields().size()) { + return false; + } + for (int i = 0; i < size; i++) { + if (!isStaticTypeOf(aStaticType.getDirectFields().get(i), aRuntimeType.getDirectFields().get(i))) { + return false; + } + } + return true; + } + if (staticType instanceof ArrayType aStaticType && runtimeType instanceof ArrayType aRuntimeType) { + int countStatic = aStaticType.getNumElements(); + int countRuntime = aRuntimeType.getNumElements(); + if (countStatic != countRuntime && (countRuntime != -1 || countStatic <= 0)) { + return false; + } + return isStaticTypeOf(aStaticType.getElementType(), aRuntimeType.getElementType()); + } + if (staticType instanceof ScopedPointerType pStaticType && runtimeType instanceof ScopedPointerType pRuntimeType) { + return isStaticTypeOf(pStaticType.getPointedType(), pRuntimeType.getPointedType()); + } + return false; + } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeLayout.java b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeLayout.java index 7b9d47e498..ae71f8212e 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeLayout.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/expression/type/TypeLayout.java @@ -20,7 +20,10 @@ public static TypeLayout of(Type type) { final int alignment; // For primitives, we assume that size and alignment requirement coincide - if (type instanceof IntegerType integerType) { + if (type instanceof BooleanType) { + unpaddedSize = 1; + alignment = unpaddedSize; + } else if (type instanceof IntegerType integerType) { unpaddedSize = IntMath.divide(integerType.getBitWidth(), 8, RoundingMode.CEILING); alignment = unpaddedSize; } else if (type instanceof FloatType floatType) { diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/ParserSpirv.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/ParserSpirv.java index dc3e7f10e5..50444f563b 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/ParserSpirv.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/ParserSpirv.java @@ -21,7 +21,6 @@ public Program parse(CharStream charStream) { ParserRuleContext parserEntryPoint = parser.spv(); VisitorSpirv visitor = new VisitorSpirv(); - parserEntryPoint.accept(visitor); - return visitor.buildProgram(); + return parserEntryPoint.accept(visitor); } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/utils/ProgramBuilder.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/utils/ProgramBuilder.java index b2e1d97f7b..b0bff0d508 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/utils/ProgramBuilder.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/utils/ProgramBuilder.java @@ -37,6 +37,7 @@ public class ProgramBuilder { private static final TypeFactory types = TypeFactory.getInstance(); private static final ExpressionFactory expressions = ExpressionFactory.getInstance(); + private static final int ARCH_SIZE = types.getMemorySizeInBytes(types.getArchType()); private static final FunctionType DEFAULT_THREAD_TYPE = types.getFunctionType(types.getVoidType(), List.of()); @@ -179,7 +180,7 @@ public MemoryObject getOrNewMemoryObject(String name, int size) { mem.setName(name); if (program.getFormat() == LITMUS) { // Litmus code always initializes memory - final Expression zero = expressions.makeZero(types.getByteType()); + final Expression zero = expressions.makeZero(types.getArchType()); for (int offset = 0; offset < size; offset++) { mem.setInitialValue(offset, zero); } @@ -190,7 +191,7 @@ public MemoryObject getOrNewMemoryObject(String name, int size) { } public MemoryObject getOrNewMemoryObject(String name) { - return getOrNewMemoryObject(name, 1); + return getOrNewMemoryObject(name, ARCH_SIZE); } public MemoryObject newMemoryObject(String name, int size) { @@ -214,7 +215,7 @@ public void initLocEqLocVal(String leftName, String rightName){ } public void initLocEqConst(String locName, Expression iValue){ - getOrNewMemoryObject(locName).setInitialValue(0,iValue); + getOrNewMemoryObject(locName).setInitialValue(0, iValue); } public void initRegEqLocPtr(int regThread, String regName, String locName, Type type) { @@ -298,7 +299,7 @@ public void newScopedThread(Arch arch, int id, int ...ids) { public void initVirLocEqCon(String leftName, IntLiteral iValue){ MemoryObject object = locations.computeIfAbsent( - leftName, k->program.getMemory().allocateVirtual(1, true, null)); + leftName, k->program.getMemory().allocateVirtual(ARCH_SIZE, true, null)); object.setName(leftName); object.setInitialValue(0, iValue); } @@ -309,7 +310,7 @@ public void initVirLocEqLoc(String leftName, String rightName){ throw new MalformedProgramException("Alias to non-exist location: " + rightName); } MemoryObject object = locations.computeIfAbsent(leftName, - k->program.getMemory().allocateVirtual(1, true, null)); + k->program.getMemory().allocateVirtual(ARCH_SIZE, true, null)); object.setName(leftName); object.setInitialValue(0,rightLocation.getInitialValue(0)); } @@ -320,7 +321,7 @@ public void initVirLocEqLocAliasGen(String leftName, String rightName){ throw new MalformedProgramException("Alias to non-exist location: " + rightName); } MemoryObject object = locations.computeIfAbsent(leftName, - k->program.getMemory().allocateVirtual(1, true, rightLocation)); + k->program.getMemory().allocateVirtual(ARCH_SIZE, true, rightLocation)); object.setName(leftName); object.setInitialValue(0,rightLocation.getInitialValue(0)); } @@ -331,9 +332,9 @@ public void initVirLocEqLocAliasProxy(String leftName, String rightName){ throw new MalformedProgramException("Alias to non-exist location: " + rightName); } MemoryObject object = locations.computeIfAbsent( - leftName, k->program.getMemory().allocateVirtual(1, false, rightLocation)); + leftName, k->program.getMemory().allocateVirtual(ARCH_SIZE, false, rightLocation)); object.setName(leftName); - object.setInitialValue(0,rightLocation.getInitialValue(0)); + object.setInitialValue(0, rightLocation.getInitialValue(0)); } // ---------------------------------------------------------------------------------------------------------------- diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusAssertions.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusAssertions.java index 20afc5ef5c..c8ce2ca1d4 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusAssertions.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusAssertions.java @@ -115,6 +115,6 @@ private Expression acceptAssertionValue(LitmusAssertionsParser.AssertionValueCon checkState(base != null, "uninitialized location %s", name); TerminalNode offset = ctx.DigitSequence(); int o = offset == null ? 0 : Integer.parseInt(offset.getText()); - return right && offset == null ? base : new Location(name, base, o); + return right && offset == null ? base : new Location(name, archType, base, o); } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusC.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusC.java index b8a367561c..bbdd3df887 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusC.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusC.java @@ -5,6 +5,7 @@ import com.dat3m.dartagnan.expression.ExpressionFactory; import com.dat3m.dartagnan.expression.integers.IntLiteral; import com.dat3m.dartagnan.expression.type.IntegerType; +import com.dat3m.dartagnan.expression.type.TypeFactory; import com.dat3m.dartagnan.parsers.LitmusCBaseVisitor; import com.dat3m.dartagnan.parsers.LitmusCParser; import com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder; @@ -28,6 +29,7 @@ public class VisitorLitmusC extends LitmusCBaseVisitor { private final ProgramBuilder programBuilder = ProgramBuilder.forLanguage(Program.SourceLanguage.LITMUS); private final ExpressionFactory expressions = programBuilder.getExpressionFactory(); private final IntegerType archType = programBuilder.getTypeFactory().getArchType(); + private final int archSize = TypeFactory.getInstance().getMemorySizeInBytes(archType); private int currentThread; private int scope; private int ifId = 0; @@ -76,7 +78,7 @@ public Object visitGlobalDeclaratorRegister(LitmusCParser.GlobalDeclaratorRegist @Override public Object visitGlobalDeclaratorLocationLocation(LitmusCParser.GlobalDeclaratorLocationLocationContext ctx) { - if(ctx.Ast() == null){ + if(ctx.Ast() == null) { programBuilder.initLocEqLocPtr(ctx.varName(0).getText(), ctx.varName(1).getText()); } else { String rightName = ctx.varName(1).getText(); @@ -135,7 +137,7 @@ public Object visitGlobalDeclaratorArray(LitmusCParser.GlobalDeclaratorArrayCont } } } - MemoryObject object = programBuilder.newMemoryObject(name,values.size()); + MemoryObject object = programBuilder.newMemoryObject(name,values.size() * archSize); for(int i = 0; i < values.size(); i++) { object.setInitialValue(i,values.get(i)); } @@ -532,7 +534,7 @@ public Expression visitVarName(LitmusCParser.VarNameContext ctx){ } return programBuilder.getOrNewRegister(scope, ctx.getText(), archType); } - MemoryObject object = programBuilder.newMemoryObject(ctx.getText(), 1); + MemoryObject object = programBuilder.newMemoryObject(ctx.getText(), archSize); Register register = programBuilder.getOrNewRegister(scope, null, archType); programBuilder.addChild(currentThread, EventFactory.newLoadWithMo(register, object, C11.NONATOMIC)); return register; diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusPTX.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusPTX.java index 154759a7a7..cf99a696e1 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusPTX.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusPTX.java @@ -298,12 +298,12 @@ public Object visitFenceAlias(LitmusPTXParser.FenceAliasContext ctx) { @Override public Object visitBarrier(LitmusPTXParser.BarrierContext ctx) { - Expression fenceId = (Expression) ctx.value().accept(this); - Event fence = EventFactory.newFenceWithId(ctx.getText().toLowerCase(), fenceId); + Expression barrierId = (Expression) ctx.value().accept(this); + Event barrier = EventFactory.newControlBarrier(ctx.getText().toLowerCase(), barrierId); if(ctx.barrierMode().Arrive() != null) { - fence.addTags(Tag.PTX.ARRIVE); + barrier.addTags(Tag.PTX.ARRIVE); } - return programBuilder.addChild(mainThread, fence); + return programBuilder.addChild(mainThread, barrier); } @Override diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusVulkan.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusVulkan.java index 161679f7b0..cb50070057 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusVulkan.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLitmusVulkan.java @@ -337,24 +337,24 @@ public Object visitControlBarrier(LitmusVulkanParser.ControlBarrierContext ctx) String scope = (ctx.scope() != null) ? ctx.scope().content : ""; List storageClassSemantics = (List) ctx.storageClassSemanticList().accept(this); List avvisSemantics = (List) ctx.avvisSemanticList().accept(this); - Expression fenceId = (Expression) ctx.value().accept(this); - String fenceIdString = ctx.getText().replace(fenceId.toString(), ""); - Event fence = EventFactory.newFenceWithId(fenceIdString.toLowerCase(), fenceId); - fence.addTags(Tag.Vulkan.CBAR); + Expression barrierId = (Expression) ctx.value().accept(this); + String barrierIdString = ctx.getText().replace(barrierId.toString(), ""); + Event barrier = EventFactory.newControlBarrier(barrierIdString.toLowerCase(), barrierId); + barrier.addTags(Tag.Vulkan.CBAR); if (!mo.equals(Tag.Vulkan.ACQUIRE) && !mo.equals(Tag.Vulkan.RELEASE) && !mo.equals(Tag.Vulkan.ACQ_REL)) { - fence.removeTags(Tag.FENCE); + barrier.removeTags(Tag.FENCE); } if (!mo.isEmpty()) { - fence.addTags(mo); + barrier.addTags(mo); } if (!avvis.isEmpty()) { - fence.addTags(avvis); + barrier.addTags(avvis); } if (!scope.isEmpty()) { - fence.addTags(scope); + barrier.addTags(scope); } - tagControl(fence, false, mo, avvis, scope, "", storageClassSemantics, avvisSemantics); - return programBuilder.addChild(mainThread, fence); + tagControl(barrier, false, mo, avvis, scope, "", storageClassSemantics, avvisSemantics); + return programBuilder.addChild(mainThread, barrier); } @Override diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLlvm.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLlvm.java index 5e1170623c..e150cafd35 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLlvm.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLlvm.java @@ -3,7 +3,6 @@ import com.dat3m.dartagnan.exception.ParsingException; import com.dat3m.dartagnan.expression.*; import com.dat3m.dartagnan.expression.integers.IntBinaryOp; -import com.dat3m.dartagnan.expression.misc.ConstructExpr; import com.dat3m.dartagnan.expression.type.*; import com.dat3m.dartagnan.parsers.LLVMIRBaseVisitor; import com.dat3m.dartagnan.parsers.LLVMIRParser.*; @@ -263,34 +262,10 @@ public Expression visitGlobalDef(GlobalDefContext ctx) { final Expression value; value = hasInitializer ? checkExpression(type, ctx.constant()) : program.newConstant(type); - setInitialMemoryFromConstant(globalObject, 0, value); + globalObject.setInitialValue(0, value); return null; } - private void setInitialMemoryFromConstant(MemoryObject memObj, int offset, Expression constant) { - if (constant.getType() instanceof ArrayType arrayType) { - assert constant instanceof ConstructExpr; - final ConstructExpr constArray = (ConstructExpr) constant; - final List arrayElements = constArray.getOperands(); - for (int i = 0; i < arrayElements.size(); i++) { - final int innerOffset = types.getOffsetInBytes(arrayType, i); - setInitialMemoryFromConstant(memObj, offset + innerOffset, arrayElements.get(i)); - } - } else if (constant.getType() instanceof AggregateType aggregateType) { - assert constant instanceof ConstructExpr; - final ConstructExpr constStruct = (ConstructExpr) constant; - final List structElements = constStruct.getOperands(); - for (int i = 0; i < structElements.size(); i++) { - int innerOffset = types.getOffsetInBytes(aggregateType, i); - setInitialMemoryFromConstant(memObj, offset + innerOffset, structElements.get(i)); - } - } else if (constant.getType() instanceof IntegerType) { - memObj.setInitialValue(offset, constant); - } else { - throw new UnsupportedOperationException("Unrecognized constant value: " + constant); - } - } - private Block getBlock(String label) { return basicBlocks.computeIfAbsent(label, k -> { diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorSpirv.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorSpirv.java index d91960c6c8..f8c54d890c 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorSpirv.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorSpirv.java @@ -1,14 +1,153 @@ package com.dat3m.dartagnan.parsers.program.visitors; -import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.exception.ParsingException; import com.dat3m.dartagnan.parsers.SpirvBaseVisitor; -import com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder; +import com.dat3m.dartagnan.parsers.SpirvParser; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.*; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.builders.ProgramBuilder; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.utils.ThreadGrid; import com.dat3m.dartagnan.program.Program; +import com.dat3m.dartagnan.program.Register; +import org.antlr.v4.runtime.tree.ParseTree; -public class VisitorSpirv extends SpirvBaseVisitor { +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; - private final ProgramBuilder programBuilder = ProgramBuilder.forLanguage(Program.SourceLanguage.SPV); - public Program buildProgram() { - return programBuilder.build(); +public class VisitorSpirv extends SpirvBaseVisitor { + + private final Map> visitors = new HashMap<>(); + private VisitorOpsConstant specConstantVisitor; + private ProgramBuilder builder; + + @Override + public Program visitSpv(SpirvParser.SpvContext ctx) { + this.builder = createBuilder(ctx); + this.initializeVisitors(); + this.specConstantVisitor = getSpecConstantVisitor(); + ctx.spvHeaders().accept(new VisitorSpirvInput(builder)); + ctx.spvInstructions().accept(this); + ctx.spvHeaders().accept(new VisitorSpirvOutput(builder)); + return builder.build(); + } + + @Override + public Program visitOp(SpirvParser.OpContext ctx) { + String name = parseOpName(ctx); + if (builder.getNextOps() != null) { + if (!builder.getNextOps().contains(name)) { + throw new ParsingException("Unexpected operation '%s'", name); + } + builder.clearNextOps(); + } + SpirvBaseVisitor visitor = visitors.get(name); + if (visitor == null) { + throw new ParsingException("Unsupported operation '%s'", name); + } + Object result = ctx.accept(visitor); + if (isSpecConstantOp(ctx)) { + if (result instanceof Register register) { + specConstantVisitor.visitOpSpecConstantOp(register); + } else { + throw new ParsingException( + "Illegal result type for OpSpecConstantOp '%s'", name); + } + } + return null; + } + + private ProgramBuilder createBuilder(SpirvParser.SpvContext ctx) { + ThreadGrid grid = new ThreadGrid(1, 1, 1, 1); + boolean hasConfig = false; + for (SpirvParser.SpvHeaderContext header : ctx.spvHeaders().spvHeader()) { + SpirvParser.ConfigHeaderContext cfgCtx = header.configHeader(); + if (cfgCtx != null) { + if (hasConfig) { + throw new ParsingException("Multiple config headers are not allowed"); + } + hasConfig = true; + List literals = cfgCtx.literanHeaderUnsignedInteger(); + int sg = Integer.parseInt(literals.get(0).getText()); + int wg = Integer.parseInt(literals.get(1).getText()); + int qf = Integer.parseInt(literals.get(2).getText()); + grid = new ThreadGrid(sg, wg, qf, 1); + } + } + return new ProgramBuilder(grid); + } + + private void initializeVisitors() { + for (Class cls : getChildVisitors()) { + try { + Constructor constructor = cls.getDeclaredConstructor(ProgramBuilder.class); + SpirvBaseVisitor visitor = (SpirvBaseVisitor) constructor.newInstance(builder); + Method method = cls.getDeclaredMethod("getSupportedOps"); + Object object = method.invoke(visitor); + if (object instanceof Set ops) { + ops.forEach(op -> { + if (visitors.put(op.toString(), visitor) != null) { + throw new IllegalArgumentException("Attempt to redefine visitor for " + op); + } + }); + } else { + throw new IllegalArgumentException("Illegal supported Ops in " + cls.getName()); + } + } catch (NoSuchMethodException | SecurityException | + InstantiationException | IllegalAccessException | + IllegalArgumentException | InvocationTargetException e) { + throw new IllegalArgumentException("Failed to initialize visitor " + cls.getName(), e); + } + } + } + + String parseOpName(SpirvParser.OpContext ctx) { + ParseTree innerCtx = ctx.getChild(0); + if ("Op".equals(innerCtx.getChild(0).getText())) { + return "Op" + innerCtx.getChild(1).getText(); + } + if ("SpecConstantOp".equals(innerCtx.getChild(3).getText())) { + return "Op" + innerCtx.getChild(5).getText(); + } + return "Op" + innerCtx.getChild(3).getText(); + } + + boolean isSpecConstantOp(SpirvParser.OpContext ctx) { + ParseTree innerCtx = ctx.getChild(0); + if ("Op".equals(innerCtx.getChild(0).getText())) { + return false; + } + return "SpecConstantOp".equals(innerCtx.getChild(3).getText()); + } + + private VisitorOpsConstant getSpecConstantVisitor() { + return visitors.values().stream() + .filter(VisitorOpsConstant.class::isInstance) + .findFirst() + .map(v -> (VisitorOpsConstant) v) + .orElseThrow(() -> new IllegalArgumentException( + "Missing visitor " + VisitorOpsConstant.class.getSimpleName())); + } + + private Set> getChildVisitors() { + return Set.of( + VisitorOpsAnnotation.class, + VisitorOpsArithmetic.class, + VisitorOpsAtomic.class, + VisitorOpsBarrier.class, + VisitorOpsBits.class, + VisitorOpsConstant.class, + VisitorOpsControlFlow.class, + VisitorOpsDebug.class, + VisitorOpsExtension.class, + VisitorOpsFunction.class, + VisitorOpsLogical.class, + VisitorOpsMemory.class, + VisitorOpsSetting.class, + VisitorOpsType.class + ); } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsAnnotation.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsAnnotation.java new file mode 100644 index 0000000000..d1de71fbce --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsAnnotation.java @@ -0,0 +1,51 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.parsers.SpirvBaseVisitor; +import com.dat3m.dartagnan.parsers.SpirvParser; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations.Decoration; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations.DecorationType; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.builders.ProgramBuilder; + +import java.util.Set; + +import static com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations.DecorationType.*; + +public class VisitorOpsAnnotation extends SpirvBaseVisitor { + + private final Decoration builtIn; + private final Decoration specId; + + public VisitorOpsAnnotation(ProgramBuilder builder) { + this.builtIn = builder.getDecorationsBuilder().getDecoration(BUILT_IN); + this.specId = builder.getDecorationsBuilder().getDecoration(SPEC_ID); + } + + @Override + public Void visitOpDecorate(SpirvParser.OpDecorateContext ctx) { + String id = ctx.targetIdRef().getText(); + DecorationType type = fromString(ctx.decoration().getChild(0).getText()); + switch (type) { + case BUILT_IN -> { + String value = ctx.decoration().builtIn().getText(); + builtIn.addDecoration(id, value); + } + case SPEC_ID -> { + String value = ctx.decoration().specializationConstantID().getText(); + specId.addDecoration(id, value); + } + case ARRAY_STRIDE, BINDING, BLOCK, BUFFER_BLOCK, COHERENT, DESCRIPTOR_SET, OFFSET, NO_CONTRACTION, NO_PERSPECTIVE, NON_WRITABLE -> { + // TODO: Implementation + } + default -> throw new ParsingException("Unsupported decoration type '%s'", type); + } + return null; + } + + public Set getSupportedOps() { + return Set.of( + "OpDecorate", + "OpMemberDecorate" + ); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsArithmetic.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsArithmetic.java new file mode 100644 index 0000000000..9b5c00a49e --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsArithmetic.java @@ -0,0 +1,128 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.Type; +import com.dat3m.dartagnan.expression.integers.IntBinaryOp; +import com.dat3m.dartagnan.expression.integers.IntUnaryOp; +import com.dat3m.dartagnan.expression.type.ArrayType; +import com.dat3m.dartagnan.expression.type.IntegerType; +import com.dat3m.dartagnan.parsers.SpirvBaseVisitor; +import com.dat3m.dartagnan.parsers.SpirvParser; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.builders.ProgramBuilder; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.event.EventFactory; +import com.dat3m.dartagnan.program.event.core.Local; + +import java.util.Set; +import java.util.function.Function; + +import static com.dat3m.dartagnan.expression.integers.IntBinaryOp.*; +import static com.dat3m.dartagnan.expression.integers.IntUnaryOp.MINUS; + +public class VisitorOpsArithmetic extends SpirvBaseVisitor { + + private static final ExpressionFactory expressions = ExpressionFactory.getInstance(); + + private final ProgramBuilder builder; + + public VisitorOpsArithmetic(ProgramBuilder builder) { + this.builder = builder; + } + + @Override + public Event visitOpSNegate(SpirvParser.OpSNegateContext ctx) { + return visitIntegerUnExpression(ctx.idResult(), ctx.idResultType(), ctx.operand(), MINUS); + } + + @Override + public Event visitOpIAdd(SpirvParser.OpIAddContext ctx) { + return visitIntegerBinExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), ADD); + } + + @Override + public Event visitOpISub(SpirvParser.OpISubContext ctx) { + return visitIntegerBinExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), SUB); + } + + @Override + public Event visitOpIMul(SpirvParser.OpIMulContext ctx) { + return visitIntegerBinExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), MUL); + } + + @Override + public Event visitOpUDiv(SpirvParser.OpUDivContext ctx) { + return visitIntegerBinExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), UDIV); + } + + @Override + public Event visitOpSDiv(SpirvParser.OpSDivContext ctx) { + return visitIntegerBinExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), DIV); + } + + private Event visitIntegerUnExpression( + SpirvParser.IdResultContext idCtx, + SpirvParser.IdResultTypeContext typeCtx, + SpirvParser.OperandContext opCtx, + IntUnaryOp op + ) { + String id = idCtx.getText(); + return forType(id, typeCtx.getText(), iType -> { + Expression left = builder.getExpression(opCtx.getText()); + if (iType.equals(left.getType())) { + return expressions.makeUnary(op, left); + } + throw new ParsingException("Illegal definition for '%s', " + + "types do not match: '%s' is '%s' and '%s' is '%s'", + id, opCtx.getText(), left.getType(), typeCtx.getText(), iType); + }); + } + + private Event visitIntegerBinExpression( + SpirvParser.IdResultContext idCtx, + SpirvParser.IdResultTypeContext typeCtx, + SpirvParser.Operand1Context op1Ctx, + SpirvParser.Operand2Context op2Ctx, + IntBinaryOp op + ) { + String id = idCtx.getText(); + return forType(id, typeCtx.getText(), iType -> { + Expression op1 = builder.getExpression(op1Ctx.getText()); + Expression op2 = builder.getExpression(op2Ctx.getText()); + if (iType.equals(op1.getType()) && op1.getType().equals(op2.getType())) { + return expressions.makeBinary(op1, op, op2); + } + throw new ParsingException("Illegal definition for '%s', " + + "types do not match: '%s' is '%s', '%s' is '%s' and '%s' is '%s'", + id, op1Ctx.getText(), op1.getType(), op2Ctx.getText(), op2.getType(), + typeCtx.getText(), iType); + }); + } + + private Event forType(String id, String typeId, Function f) { + Type type = builder.getType(typeId); + if (type instanceof IntegerType iType) { + Register register = builder.addRegister(id, typeId); + Local event = EventFactory.newLocal(register, f.apply(iType)); + return builder.addEvent(event); + } + if (type instanceof ArrayType) { + throw new ParsingException("Unsupported result type for '%s', " + + "vector types are not supported", id); + } + throw new ParsingException("Illegal result type for '%s'", id); + } + + public Set getSupportedOps() { + return Set.of( + "OpSNegate", + "OpIAdd", + "OpISub", + "OpIMul", + "OpUDiv", + "OpSDiv" + ); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsAtomic.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsAtomic.java new file mode 100644 index 0000000000..77aaebc188 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsAtomic.java @@ -0,0 +1,253 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.Type; +import com.dat3m.dartagnan.expression.integers.IntBinaryOp; +import com.dat3m.dartagnan.expression.integers.IntCmpOp; +import com.dat3m.dartagnan.expression.type.IntegerType; +import com.dat3m.dartagnan.parsers.SpirvBaseVisitor; +import com.dat3m.dartagnan.parsers.SpirvParser; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.helpers.HelperTags; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.builders.ProgramBuilder; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.event.lang.spirv.*; + +import java.util.Set; + +import static com.dat3m.dartagnan.program.event.EventFactory.Spirv.*; + +public class VisitorOpsAtomic extends SpirvBaseVisitor { + + private final ProgramBuilder builder; + + public VisitorOpsAtomic(ProgramBuilder builder) { + this.builder = builder; + } + + @Override + public Event visitOpAtomicLoad(SpirvParser.OpAtomicLoadContext ctx) { + Register register = builder.addRegister(ctx.idResult().getText(), ctx.idResultType().getText()); + Expression ptr = builder.getExpression(ctx.pointer().getText()); + String scope = getScopeTag(ctx.memory().getText()); + Set tags = getMemorySemanticsTags(ctx.semantics().getText()); + tags.add(builder.getPointerStorageClass(ctx.pointer().getText())); + SpirvLoad event = newSpirvLoad(register, ptr, scope, tags); + return builder.addEvent(event); + } + + @Override + public Event visitOpAtomicStore(SpirvParser.OpAtomicStoreContext ctx) { + Expression ptr = builder.getExpression(ctx.pointer().getText()); + Expression value = builder.getExpression(ctx.valueIdRef().getText()); + String scope = getScopeTag(ctx.memory().getText()); + Set tags = getMemorySemanticsTags(ctx.semantics().getText()); + tags.add(builder.getPointerStorageClass(ctx.pointer().getText())); + SpirvStore event = newSpirvStore(ptr, value, scope, tags); + return builder.addEvent(event); + } + + @Override + public Event visitOpAtomicExchange(SpirvParser.OpAtomicExchangeContext ctx) { + Register register = builder.addRegister(ctx.idResult().getText(), ctx.idResultType().getText()); + Expression ptr = builder.getExpression(ctx.pointer().getText()); + Expression value = builder.getExpression(ctx.valueIdRef().getText()); + String scope = getScopeTag(ctx.memory().getText()); + Set tags = getMemorySemanticsTags(ctx.semantics().getText()); + tags.add(builder.getPointerStorageClass(ctx.pointer().getText())); + SpirvXchg event = newSpirvXchg(register, ptr, value, scope, tags); + return builder.addEvent(event); + } + + @Override + public Event visitOpAtomicCompareExchange(SpirvParser.OpAtomicCompareExchangeContext ctx) { + return visitOpAtomicCompareExchange(ctx.idResult(), ctx.idResultType(), + ctx.pointer(), ctx.memory(), ctx.equal(), ctx.unequal(), ctx.valueIdRef(), ctx.comparator()); + } + + @Override + public Event visitOpAtomicCompareExchangeWeak(SpirvParser.OpAtomicCompareExchangeWeakContext ctx) { + // OpAtomicCompareExchangeWeak is deprecated and has the same semantics as OpAtomicCompareExchange + return visitOpAtomicCompareExchange(ctx.idResult(), ctx.idResultType(), + ctx.pointer(), ctx.memory(), ctx.equal(), ctx.unequal(), ctx.valueIdRef(), ctx.comparator()); + } + + @Override + public Event visitOpAtomicIIncrement(SpirvParser.OpAtomicIIncrementContext ctx) { + return visitAtomicOpIncDec(ctx.idResult(), ctx.idResultType(), ctx.pointer(), + ctx.memory(), ctx.semantics(), IntBinaryOp.ADD); + } + + @Override + public Event visitOpAtomicIDecrement(SpirvParser.OpAtomicIDecrementContext ctx) { + return visitAtomicOpIncDec(ctx.idResult(), ctx.idResultType(), ctx.pointer(), + ctx.memory(), ctx.semantics(), IntBinaryOp.SUB); + } + + @Override + public Event visitOpAtomicIAdd(SpirvParser.OpAtomicIAddContext ctx) { + return visitAtomicOp(ctx.idResult(), ctx.idResultType(), ctx.pointer(), + ctx.memory(), ctx.semantics(), ctx.valueIdRef(), IntBinaryOp.ADD); + } + + @Override + public Event visitOpAtomicISub(SpirvParser.OpAtomicISubContext ctx) { + return visitAtomicOp(ctx.idResult(), ctx.idResultType(), ctx.pointer(), + ctx.memory(), ctx.semantics(), ctx.valueIdRef(), IntBinaryOp.SUB); + } + + @Override + public Event visitOpAtomicAnd(SpirvParser.OpAtomicAndContext ctx) { + return visitAtomicOp(ctx.idResult(), ctx.idResultType(), ctx.pointer(), + ctx.memory(), ctx.semantics(), ctx.valueIdRef(), IntBinaryOp.AND); + } + + @Override + public Event visitOpAtomicOr(SpirvParser.OpAtomicOrContext ctx) { + return visitAtomicOp(ctx.idResult(), ctx.idResultType(), ctx.pointer(), + ctx.memory(), ctx.semantics(), ctx.valueIdRef(), IntBinaryOp.OR); + } + + @Override + public Event visitOpAtomicXor(SpirvParser.OpAtomicXorContext ctx) { + return visitAtomicOp(ctx.idResult(), ctx.idResultType(), ctx.pointer(), + ctx.memory(), ctx.semantics(), ctx.valueIdRef(), IntBinaryOp.XOR); + } + + @Override + public Event visitOpAtomicSMax(SpirvParser.OpAtomicSMaxContext ctx) { + return visitOpAtomicExtremum(ctx.idResult(), ctx.idResultType(), ctx.pointer(), + ctx.memory(), ctx.semantics(), ctx.valueIdRef(), IntCmpOp.GT); + } + + @Override + public Event visitOpAtomicSMin(SpirvParser.OpAtomicSMinContext ctx) { + return visitOpAtomicExtremum(ctx.idResult(), ctx.idResultType(), ctx.pointer(), + ctx.memory(), ctx.semantics(), ctx.valueIdRef(), IntCmpOp.LT); + } + + private Event visitOpAtomicExtremum( + SpirvParser.IdResultContext idCtx, + SpirvParser.IdResultTypeContext typeCtx, + SpirvParser.PointerContext ptrCtx, + SpirvParser.MemoryContext scopeCtx, + SpirvParser.SemanticsContext tagsCtx, + SpirvParser.ValueIdRefContext valCtx, + IntCmpOp kind + ) { + Register register = builder.addRegister(idCtx.getText(), typeCtx.getText()); + Expression ptr = builder.getExpression(ptrCtx.getText()); + Expression value = builder.getExpression(valCtx.getText()); + String scope = getScopeTag(scopeCtx.getText()); + Set tags = getMemorySemanticsTags(tagsCtx.getText()); + tags.add(builder.getPointerStorageClass(ptrCtx.getText())); + if (!(ptr.getType() instanceof IntegerType) || !(value.getType() instanceof IntegerType)) { + throw new ParsingException("Unexpected type at '%s' or '%s', expected integer but received '%s' and '%s'", + ptrCtx.getText(), valCtx.getText(), ptr.getType(), value.getType()); + } + SpirvRmwExtremum event = newSpirvRmwExtremum(register, ptr, kind, value, scope, tags); + return builder.addEvent(event); + } + + private Event visitOpAtomicCompareExchange( + SpirvParser.IdResultContext idCtx, + SpirvParser.IdResultTypeContext typeCtx, + SpirvParser.PointerContext ptrCtx, + SpirvParser.MemoryContext scopeCtx, + SpirvParser.EqualContext eqCtx, + SpirvParser.UnequalContext neqCtx, + SpirvParser.ValueIdRefContext valCtx, + SpirvParser.ComparatorContext cmpCtx + ) { + Register register = builder.addRegister(idCtx.getText(), typeCtx.getText()); + Expression ptr = builder.getExpression(ptrCtx.getText()); + String scope = getScopeTag(scopeCtx.getText()); + Set eqTags = getMemorySemanticsTags(eqCtx.getText()); + + eqTags.add(builder.getPointerStorageClass(ptrCtx.getText())); + + Set neqTags = getMemorySemanticsTags(neqCtx.getText()); + neqTags.add(builder.getPointerStorageClass(ptrCtx.getText())); + Expression value = builder.getExpression(valCtx.getText()); + Expression cmp = builder.getExpression(cmpCtx.getText()); + SpirvCmpXchg event = newSpirvCmpXchg(register, ptr, cmp, value, scope, eqTags, neqTags); + return builder.addEvent(event); + } + + private Event visitAtomicOpIncDec( + SpirvParser.IdResultContext idCtx, + SpirvParser.IdResultTypeContext typeCtx, + SpirvParser.PointerContext ptrCtx, + SpirvParser.MemoryContext scopeCtx, + SpirvParser.SemanticsContext tagsCtx, + IntBinaryOp op + ) { + String typeId = typeCtx.getText(); + Type type = builder.getType(typeId); + if (type instanceof IntegerType iType) { + Expression value = ExpressionFactory.getInstance().makeOne(iType); + return visitAtomicOp(idCtx, typeCtx, ptrCtx, scopeCtx, tagsCtx, value, op); + } + throw new ParsingException("Unexpected type at '%s', expected integer but received '%s'", typeId, type); + } + + private Event visitAtomicOp( + SpirvParser.IdResultContext idCtx, + SpirvParser.IdResultTypeContext typeCtx, + SpirvParser.PointerContext ptrCtx, + SpirvParser.MemoryContext scopeCtx, + SpirvParser.SemanticsContext tagsCtx, + SpirvParser.ValueIdRefContext valCtx, + IntBinaryOp op + ) { + Expression value = builder.getExpression(valCtx.getText()); + return visitAtomicOp(idCtx, typeCtx, ptrCtx, scopeCtx, tagsCtx, value, op); + } + + private Event visitAtomicOp( + SpirvParser.IdResultContext idCtx, + SpirvParser.IdResultTypeContext typeCtx, + SpirvParser.PointerContext ptrCtx, + SpirvParser.MemoryContext scopeCtx, + SpirvParser.SemanticsContext tagsCtx, + Expression value, + IntBinaryOp op + ) { + Register register = builder.addRegister(idCtx.getText(), typeCtx.getText()); + Expression ptr = builder.getExpression(ptrCtx.getText()); + String scope = getScopeTag(scopeCtx.getText()); + Set tags = getMemorySemanticsTags(tagsCtx.getText()); + tags.add(builder.getPointerStorageClass(ptrCtx.getText())); + SpirvRmw event = newSpirvRmw(register, ptr, op, value, scope, tags); + return builder.addEvent(event); + } + + private String getScopeTag(String scopeId) { + return HelperTags.parseScope(scopeId, builder.getExpression(scopeId)); + } + + private Set getMemorySemanticsTags(String semanticsId) { + return HelperTags.parseMemorySemanticsTags(semanticsId, builder.getExpression(semanticsId)); + } + + public Set getSupportedOps() { + return Set.of( + "OpAtomicLoad", + "OpAtomicStore", + "OpAtomicExchange", + "OpAtomicCompareExchange", + "OpAtomicCompareExchangeWeak", + "OpAtomicIAdd", + "OpAtomicISub", + "OpAtomicIIncrement", + "OpAtomicIDecrement", + "OpAtomicAnd", + "OpAtomicOr", + "OpAtomicXor", + "OpAtomicSMax", + "OpAtomicSMin" + ); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsBarrier.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsBarrier.java new file mode 100644 index 0000000000..56a7d0bca5 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsBarrier.java @@ -0,0 +1,73 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.type.IntegerType; +import com.dat3m.dartagnan.expression.type.TypeFactory; +import com.dat3m.dartagnan.parsers.SpirvBaseVisitor; +import com.dat3m.dartagnan.parsers.SpirvParser; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.helpers.HelperTags; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.builders.ProgramBuilder; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.event.EventFactory; +import com.dat3m.dartagnan.program.event.Tag; + +import java.util.Set; + +public class VisitorOpsBarrier extends SpirvBaseVisitor { + + private static final ExpressionFactory expressions = ExpressionFactory.getInstance(); + private final IntegerType archType = TypeFactory.getInstance().getArchType(); + private final ProgramBuilder builder; + private int nextBarrierId = 0; + + public VisitorOpsBarrier(ProgramBuilder builder) { + this.builder = builder; + } + + @Override + public Event visitOpControlBarrier(SpirvParser.OpControlBarrierContext ctx) { + if (!ctx.execution().getText().equals(ctx.memory().getText())) { + throw new ParsingException("Unequal scopes in OpControlBarrier are not supported"); + } + Expression barrierId = expressions.makeValue(nextBarrierId++, archType); + Event barrier = EventFactory.newControlBarrier("cbar", barrierId); + barrier.addTags(Tag.Spirv.CONTROL); + barrier.addTags(getScopeTag(ctx.execution().getText())); + Set tags = getMemorySemanticsTags(ctx.semantics().getText()); + if (Set.of(Tag.Spirv.RELAXED).equals(tags)) { + barrier.removeTags(Tag.FENCE); + } else { + barrier.addTags(tags); + } + return builder.addEvent(barrier); + } + + @Override + public Event visitOpMemoryBarrier(SpirvParser.OpMemoryBarrierContext ctx) { + Set tags = getMemorySemanticsTags(ctx.semantics().getText()); + if (!Set.of(Tag.Spirv.RELAXED).equals(tags)) { + Event fence = EventFactory.newFence(Tag.FENCE); + fence.addTags(getScopeTag(ctx.memory().getText())); + fence.addTags(tags); + return builder.addEvent(fence); + } + throw new ParsingException("Illegal OpMemoryBarrier with semantics None"); + } + + private String getScopeTag(String scopeId) { + return HelperTags.parseScope(scopeId, builder.getExpression(scopeId)); + } + + private Set getMemorySemanticsTags(String semanticsId) { + return HelperTags.parseMemorySemanticsTags(semanticsId, builder.getExpression(semanticsId)); + } + + public Set getSupportedOps() { + return Set.of( + "OpControlBarrier", + "OpMemoryBarrier" + ); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsBits.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsBits.java new file mode 100644 index 0000000000..39bd1b2b4a --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsBits.java @@ -0,0 +1,122 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.Type; +import com.dat3m.dartagnan.expression.integers.IntBinaryOp; +import com.dat3m.dartagnan.expression.type.ArrayType; +import com.dat3m.dartagnan.expression.type.IntegerType; +import com.dat3m.dartagnan.parsers.SpirvBaseVisitor; +import com.dat3m.dartagnan.parsers.SpirvParser; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.builders.ProgramBuilder; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.event.EventFactory; +import com.dat3m.dartagnan.program.event.core.Local; + +import java.util.Set; +import java.util.function.Function; + +public class VisitorOpsBits extends SpirvBaseVisitor { + + private static final ExpressionFactory expressions = ExpressionFactory.getInstance(); + + private final ProgramBuilder builder; + + public VisitorOpsBits(ProgramBuilder builder) { + this.builder = builder; + } + + @Override + public Event visitOpShiftLeftLogical(SpirvParser.OpShiftLeftLogicalContext ctx) { + return visitShiftBinExpression(ctx.idResult(), ctx.idResultType(), ctx.base(), ctx.shift(), IntBinaryOp.LSHIFT); + } + + @Override + public Event visitOpShiftRightLogical(SpirvParser.OpShiftRightLogicalContext ctx) { + return visitShiftBinExpression(ctx.idResult(), ctx.idResultType(), ctx.base(), ctx.shift(), IntBinaryOp.RSHIFT); + } + + @Override + public Event visitOpShiftRightArithmetic(SpirvParser.OpShiftRightArithmeticContext ctx) { + return visitShiftBinExpression(ctx.idResult(), ctx.idResultType(), ctx.base(), ctx.shift(), IntBinaryOp.ARSHIFT); + } + + @Override + public Event visitOpBitwiseAnd(SpirvParser.OpBitwiseAndContext ctx) { + return visitBitwiseExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), IntBinaryOp.AND); + } + + @Override + public Event visitOpBitwiseOr(SpirvParser.OpBitwiseOrContext ctx) { + return visitBitwiseExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), IntBinaryOp.OR); + } + + @Override + public Event visitOpBitwiseXor(SpirvParser.OpBitwiseXorContext ctx) { + return visitBitwiseExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), IntBinaryOp.XOR); + } + + private Event visitShiftBinExpression( + SpirvParser.IdResultContext idCtx, + SpirvParser.IdResultTypeContext typeCtx, + SpirvParser.BaseContext op1Ctx, + SpirvParser.ShiftContext op2Ctx, + IntBinaryOp op) { + String id = idCtx.getText(); + return forType(id, typeCtx.getText(), bType -> { + Expression op1 = getOperandInteger(id, op1Ctx.getText()); + Expression op2 = getOperandInteger(id, op2Ctx.getText()); + return expressions.makeBinary(op1, op, op2); + }); + } + + private Event visitBitwiseExpression( + SpirvParser.IdResultContext idCtx, + SpirvParser.IdResultTypeContext typeCtx, + SpirvParser.Operand1Context op1Ctx, + SpirvParser.Operand2Context op2Ctx, + IntBinaryOp op) { + String id = idCtx.getText(); + return forType(id, typeCtx.getText(), bType -> { + Expression op1 = getOperandInteger(id, op1Ctx.getText()); + Expression op2 = getOperandInteger(id, op2Ctx.getText()); + return expressions.makeBinary(op1, op, op2); + }); + } + + private Event forType(String id, String typeId, Function f) { + Type type = builder.getType(typeId); + if (type instanceof IntegerType bType) { + Register register = builder.addRegister(id, typeId); + Local event = EventFactory.newLocal(register, f.apply(bType)); + return builder.addEvent(event); + } + if (type instanceof ArrayType) { + throw new ParsingException("Unsupported result type for '%s', " + + "vector types are not supported", id); + } + throw new ParsingException("Illegal result type for '%s'", id); + } + + private Expression getOperandInteger(String id, String opId) { + Expression op = builder.getExpression(opId); + if (op.getType() instanceof IntegerType) { + return op; + } + throw new ParsingException("Illegal definition for '%s', " + + "operand '%s' must be an integer", id, opId); + } + + public Set getSupportedOps() { + return Set.of( + "OpShiftLeftLogical", + "OpShiftRightLogical", + "opShiftRightArithmetic", + "OpBitwiseAnd", + "OpBitwiseOr", + "OpBitwiseXor" + ); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsConstant.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsConstant.java new file mode 100644 index 0000000000..4de218bf58 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsConstant.java @@ -0,0 +1,246 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.Type; +import com.dat3m.dartagnan.expression.integers.IntLiteral; +import com.dat3m.dartagnan.expression.type.AggregateType; +import com.dat3m.dartagnan.expression.type.ArrayType; +import com.dat3m.dartagnan.expression.type.BooleanType; +import com.dat3m.dartagnan.expression.type.IntegerType; +import com.dat3m.dartagnan.parsers.SpirvBaseVisitor; +import com.dat3m.dartagnan.parsers.SpirvParser; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations.BuiltIn; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations.SpecId; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.builders.ProgramBuilder; +import com.dat3m.dartagnan.program.Register; +import org.antlr.v4.runtime.RuleContext; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import static com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations.DecorationType.BUILT_IN; +import static com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations.DecorationType.SPEC_ID; + +public class VisitorOpsConstant extends SpirvBaseVisitor { + + private static final ExpressionFactory expressions = ExpressionFactory.getInstance(); + + private final Set specConstants = new HashSet<>(); + private final ProgramBuilder builder; + private final BuiltIn builtIn; + private final SpecId specId; + + public VisitorOpsConstant(ProgramBuilder builder) { + this.builder = builder; + this.builtIn = (BuiltIn) builder.getDecorationsBuilder().getDecoration(BUILT_IN); + this.specId = (SpecId) builder.getDecorationsBuilder().getDecoration(SPEC_ID); + } + + @Override + public Expression visitOpConstantTrue(SpirvParser.OpConstantTrueContext ctx) { + return builder.addExpression(ctx.idResult().getText(), expressions.makeTrue()); + } + + @Override + public Expression visitOpSpecConstantTrue(SpirvParser.OpSpecConstantTrueContext ctx) { + String id = ctx.idResult().getText(); + specConstants.add(id); + return builder.addExpression(id, makeBooleanSpecConstant(id, true)); + } + + @Override + public Expression visitOpConstantFalse(SpirvParser.OpConstantFalseContext ctx) { + return builder.addExpression(ctx.idResult().getText(), expressions.makeFalse()); + } + + @Override + public Expression visitOpSpecConstantFalse(SpirvParser.OpSpecConstantFalseContext ctx) { + String id = ctx.idResult().getText(); + specConstants.add(id); + return builder.addExpression(id, makeBooleanSpecConstant(id, false)); + } + + @Override + public Expression visitOpConstant(SpirvParser.OpConstantContext ctx) { + String id = ctx.idResult().getText(); + Type type = builder.getType(ctx.idResultType().getText()); + String value = ctx.valueLiteralContextDependentNumber().getText(); + return builder.addExpression(id, makeConstant(type, value)); + } + + @Override + public Expression visitOpSpecConstant(SpirvParser.OpSpecConstantContext ctx) { + String id = ctx.idResult().getText(); + Type type = builder.getType(ctx.idResultType().getText()); + if (type instanceof IntegerType iType) { + Integer input = getInputValue(id); + if (input != null) { + specConstants.add(id); + return builder.addExpression(id, expressions.makeValue(input, iType)); + } + String value = specId.getValue(id); + if (value == null) { + value = ctx.valueLiteralContextDependentNumber().getText(); + } + specConstants.add(id); + return builder.addExpression(id, expressions.makeValue(Long.parseLong(value), iType)); + } + throw new ParsingException("Illegal constant type '%s'", type); + } + + @Override + public Expression visitOpConstantComposite(SpirvParser.OpConstantCompositeContext ctx) { + String id = ctx.idResult().getText(); + Type type = builder.getType(ctx.idResultType().getText()); + List elementIds = ctx.constituents().stream().map(RuleContext::getText).toList(); + for (String elementId : elementIds) { + if (specConstants.contains(elementId)) { + throw new ParsingException("Reference to spec constant '%s' " + + "from base composite constant '%s'", elementId, id); + } + } + return builder.addExpression(id, makeConstantComposite(id, type, elementIds)); + } + + @Override + public Expression visitOpSpecConstantComposite(SpirvParser.OpSpecConstantCompositeContext ctx) { + String id = ctx.idResult().getText(); + Type type = builder.getType(ctx.idResultType().getText()); + List elementIds = ctx.constituents().stream().map(RuleContext::getText).toList(); + for (String elementId : elementIds) { + if (!specConstants.contains(elementId)) { + throw new ParsingException("Reference to base constant '%s' " + + "from spec composite constant '%s'", elementId, id); + } + } + Expression value = builtIn.getDecoration(id, type); + if (value == null) { + value = makeConstantComposite(id, type, elementIds); + } + specConstants.add(id); + return builder.addExpression(id, value); + } + + @Override + public Expression visitOpConstantNull(SpirvParser.OpConstantNullContext ctx) { + String id = ctx.idResult().getText(); + Type type = builder.getType(ctx.idResultType().getText()); + if (type instanceof BooleanType) { + Expression expression = expressions.makeFalse(); + return builder.addExpression(id, expression); + } + if (type instanceof IntegerType iType) { + Expression expression = expressions.makeZero(iType); + return builder.addExpression(id, expression); + } + throw new ParsingException("Illegal NULL constant type '%s'", type); + } + + public void visitOpSpecConstantOp(Register register) { + // TODO: Implementation + // Special handling for OpSpecConstantOp (wrapper for another Op) + throw new ParsingException("Unsupported instruction OpSpecConstantOp"); + } + + private Expression makeBooleanSpecConstant(String id, boolean value) { + Integer input = getInputValue(id); + if (input != null) { + value = input != 0; + } else { + String decoration = specId.getValue(id); + if (decoration != null) { + value = !"0".equals(decoration); + } + } + if (value) { + return expressions.makeTrue(); + } + return expressions.makeFalse(); + } + + private Expression makeConstant(Type type, String value) { + if (type instanceof IntegerType iType) { + long intValue = Long.parseLong(value); + return expressions.makeValue(intValue, iType); + } + throw new ParsingException("Illegal constant type '%s'", type); + } + + private Expression makeConstantComposite(String id, Type type, List elementIds) { + if (type instanceof AggregateType aType) { + return makeConstantStruct(id, aType, elementIds); + } else if (type instanceof ArrayType aType) { + return makeConstantArray(id, aType, elementIds); + } else { + throw new ParsingException("Illegal type '%s' for composite constant '%s'", type, id); + } + } + + private Expression makeConstantStruct(String id, AggregateType type, List elementIds) { + List elementTypes = type.getDirectFields(); + if (elementTypes.size() != elementIds.size()) { + throw new ParsingException("Mismatching number of elements in the composite constant '%s', " + + "expected %d elements but received %d elements", id, elementTypes.size(), elementIds.size()); + } + List elements = new ArrayList<>(); + for (int i = 0; i < elementTypes.size(); i++) { + Expression expression = builder.getExpression(elementIds.get(i)); + if (!expression.getType().equals(elementTypes.get(i))) { + throw new ParsingException("Mismatching type of a composite constant '%s' element '%s', " + + "expected '%s' but received '%s'", id, elementIds.get(i), + elementTypes.get(i), expression.getType()); + } + elements.add(expression); + } + return expressions.makeConstruct(elements); + } + + private Expression makeConstantArray(String id, ArrayType type, List elementIds) { + if (type.getNumElements() != elementIds.size()) { + throw new ParsingException("Mismatching number of elements in the composite constant '%s', " + + "expected %d elements but received %d elements", id, type.getNumElements(), elementIds.size()); + } + Type elementType = type.getElementType(); + List elements = new ArrayList<>(); + for (String elementId : elementIds) { + Expression expression = builder.getExpression(elementId); + if (!expression.getType().equals(elementType)) { + throw new ParsingException("Mismatching type of a composite constant '%s' element '%s', " + + "expected '%s' but received '%s'", id, elementId, + elementType, expression.getType()); + } + elements.add(expression); + } + return expressions.makeArray(elementType, elements, true); + } + + private Integer getInputValue(String id) { + if (builder.hasInput(id)) { + Expression expr = builder.getInput(id); + if (expr instanceof IntLiteral iExpr) { + return iExpr.getValueAsInt(); + } + throw new ParsingException("Unexpected input for SpecConstant '%s', " + + "expected integer but received '%s'", id, expr.getType()); + } + return null; + } + + public Set getSupportedOps() { + return Set.of( + "OpConstantTrue", + "OpConstantFalse", + "OpConstant", + "OpConstantComposite", + "OpConstantNull", + "OpSpecConstantTrue", + "OpSpecConstantFalse", + "OpSpecConstant", + "OpSpecConstantComposite" + ); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsControlFlow.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsControlFlow.java new file mode 100644 index 0000000000..ab3dbe82fe --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsControlFlow.java @@ -0,0 +1,217 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.Type; +import com.dat3m.dartagnan.expression.type.TypeFactory; +import com.dat3m.dartagnan.parsers.SpirvBaseVisitor; +import com.dat3m.dartagnan.parsers.SpirvParser; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.builders.ControlFlowBuilder; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.builders.ProgramBuilder; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.event.EventFactory; +import com.dat3m.dartagnan.program.event.core.Label; +import com.dat3m.dartagnan.program.event.functions.Return; + +import java.util.*; + +import static com.dat3m.dartagnan.program.event.EventFactory.newFunctionReturn; + +public class VisitorOpsControlFlow extends SpirvBaseVisitor { + + private static final TypeFactory types = TypeFactory.getInstance(); + private final ProgramBuilder builder; + private final ControlFlowBuilder cfBuilder; + private String continueLabelId; + private String mergeLabelId; + private String nextLabelId; + + public VisitorOpsControlFlow(ProgramBuilder builder) { + this.builder = builder; + this.cfBuilder = builder.getControlFlowBuilder(); + } + + @Override + public Event visitOpPhi(SpirvParser.OpPhiContext ctx) { + String id = ctx.idResult().getText(); + String typeId = ctx.idResultType().getText(); + Register register = builder.addRegister(id, typeId); + for (SpirvParser.VariableContext vCtx : ctx.variable()) { + SpirvParser.PairIdRefIdRefContext pCtx = vCtx.pairIdRefIdRef(); + String labelId = pCtx.idRef(1).getText(); + String expressionId = pCtx.idRef(0).getText(); + cfBuilder.addPhiDefinition(labelId, register, expressionId); + } + builder.addExpression(id, register); + return null; + } + + @Override + public Event visitOpLabel(SpirvParser.OpLabelContext ctx) { + if (nextLabelId != null) { + if (!nextLabelId.equals(ctx.idResult().getText())) { + throw new ParsingException("Illegal label, expected '%s' but received '%s'", + nextLabelId, ctx.idResult().getText()); + } + nextLabelId = null; + } + String labelId = ctx.idResult().getText(); + Label event = cfBuilder.getOrCreateLabel(labelId); + cfBuilder.startBlock(labelId); + return builder.addEvent(event); + } + + @Override + public Event visitOpSelectionMerge(SpirvParser.OpSelectionMergeContext ctx) { + if (mergeLabelId == null) { + mergeLabelId = ctx.mergeBlock().getText(); + builder.setNextOps(Set.of("OpBranchConditional", "OpSwitch")); + return null; + } + throw new ParsingException("End label must be null"); + } + + @Override + public Event visitOpLoopMerge(SpirvParser.OpLoopMergeContext ctx) { + if (continueLabelId == null && mergeLabelId == null) { + continueLabelId = ctx.continueTarget().getText(); + mergeLabelId = ctx.mergeBlock().getText(); + builder.setNextOps(Set.of("OpBranchConditional", "OpBranch")); + return null; + } + throw new ParsingException("End and continue labels must be null"); + } + + @Override + public Event visitOpBranch(SpirvParser.OpBranchContext ctx) { + String labelId = ctx.targetLabel().getText(); + if (continueLabelId == null && mergeLabelId == null) { + return visitGoto(labelId); + } + if (continueLabelId != null && mergeLabelId != null) { + return visitLoopBranch(labelId); + } + throw new ParsingException("OpBranch '%s' must be either " + + "a part of a loop definition or an arbitrary goto", labelId); + } + + @Override + public Event visitOpBranchConditional(SpirvParser.OpBranchConditionalContext ctx) { + Expression guard = builder.getExpression(ctx.condition().getText()); + String trueLabelId = ctx.trueLabel().getText(); + String falseLabelId = ctx.falseLabel().getText(); + if (trueLabelId.equals(falseLabelId)) { + throw new ParsingException("Labels of conditional branch cannot be the same"); + } + if (mergeLabelId != null) { + if (continueLabelId != null) { + return visitLoopBranchConditional(guard, trueLabelId, falseLabelId); + } + return visitIfBranch(guard, trueLabelId, falseLabelId); + } + return visitConditionalJump(guard, trueLabelId, falseLabelId); + } + + @Override + public Event visitOpReturn(SpirvParser.OpReturnContext ctx) { + Type returnType = builder.getCurrentFunctionType().getReturnType(); + if (types.getVoidType().equals(returnType)) { + Return event = newFunctionReturn(null); + builder.addEvent(event); + return cfBuilder.endBlock(event); + } + throw new ParsingException("Illegal non-value return for a non-void function '%s'", + builder.getCurrentFunctionName()); + } + + @Override + public Event visitOpReturnValue(SpirvParser.OpReturnValueContext ctx) { + Type returnType = builder.getCurrentFunctionType().getReturnType(); + if (!types.getVoidType().equals(returnType)) { + String valueId = ctx.valueIdRef().getText(); + Expression expression = builder.getExpression(valueId); + Event event = newFunctionReturn(expression); + builder.addEvent(event); + return cfBuilder.endBlock(event); + } + throw new ParsingException("Illegal value return for a void function '%s'", + builder.getCurrentFunctionName()); + } + + private Event visitGoto(String labelId) { + Label label = cfBuilder.getOrCreateLabel(labelId); + Event event = EventFactory.newGoto(label); + builder.addEvent(event); + return cfBuilder.endBlock(event); + } + + private Event visitLoopBranch(String labelId) { + continueLabelId = null; + mergeLabelId = null; + return visitGoto(labelId); + } + + private Event visitIfBranch(Expression guard, String trueLabelId, String falseLabelId) { + for (String labelId : List.of(trueLabelId, falseLabelId)) { + if (cfBuilder.isBlockStarted(labelId)) { + throw new ParsingException("Illegal backward jump to '%s' from a structured branch", labelId); + } + } + mergeLabelId = null; + nextLabelId = trueLabelId; + builder.setNextOps(Set.of("OpLabel")); + Label falseLabel = cfBuilder.getOrCreateLabel(falseLabelId); + Label mergeLabel = cfBuilder.createMergeLabel(falseLabelId); + Event event = EventFactory.newIfJumpUnless(guard, falseLabel, mergeLabel); + builder.addEvent(event); + return cfBuilder.endBlock(event); + } + + private Event visitConditionalJump(Expression guard, String trueLabelId, String falseLabelId) { + if (cfBuilder.isBlockStarted(trueLabelId)) { + if (cfBuilder.isBlockStarted(falseLabelId)) { + throw new ParsingException("Unsupported conditional branch " + + "with two backward jumps to '%s' and '%s'", trueLabelId, falseLabelId); + } + String labelId = trueLabelId; + trueLabelId = falseLabelId; + falseLabelId = labelId; + guard = ExpressionFactory.getInstance().makeNot(guard); + } + Label trueLabel = cfBuilder.getOrCreateLabel(trueLabelId); + Label falseLabel = cfBuilder.getOrCreateLabel(falseLabelId); + Event trueJump = builder.addEvent(EventFactory.newJump(guard, trueLabel)); + builder.addEvent(EventFactory.newGoto(falseLabel)); + return cfBuilder.endBlock(trueJump); + } + + private Event visitLoopBranchConditional(Expression guard, String trueLabelId, String falseLabelId) { + mergeLabelId = null; + continueLabelId = null; + nextLabelId = trueLabelId; + builder.setNextOps(Set.of("OpLabel")); + + // TODO: For a structured while loop, a control dependency + // should be generated in the same way as for a structured if branch. + // We need to add a new event type for this. + // For now, we can treat while loop as unstructured jumps, + // because Vulkan memory model has no control dependency. + + return visitConditionalJump(guard, trueLabelId, falseLabelId); + } + + public Set getSupportedOps() { + return Set.of( + "OpPhi", + "OpBranch", + "OpBranchConditional", + "OpLabel", + "OpLoopMerge", + "OpSelectionMerge", + "OpReturn", + "OpReturnValue" + ); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsDebug.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsDebug.java new file mode 100644 index 0000000000..779ae94c19 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsDebug.java @@ -0,0 +1,28 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.parsers.SpirvBaseVisitor; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.builders.ProgramBuilder; + +import java.util.Set; + +public class VisitorOpsDebug extends SpirvBaseVisitor { + + public VisitorOpsDebug(ProgramBuilder builder) { + // TODO: Implement mapping to original variable names + // and lines of code (readability for human users) + } + + public Set getSupportedOps() { + return Set.of( + "OpSource", + "OpSourceContinued", + "OpSourceExtension", + "OpName", + "OpMemberName", + "OpString", + "OpLine", + "OpNoLine", + "OpModuleProcessed" + ); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsExtension.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsExtension.java new file mode 100644 index 0000000000..f51ed1a319 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsExtension.java @@ -0,0 +1,69 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.parsers.SpirvBaseVisitor; +import com.dat3m.dartagnan.parsers.SpirvParser; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.extenstions.VisitorExtension; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.extenstions.VisitorExtensionClspvReflection; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.builders.ProgramBuilder; +import org.antlr.v4.runtime.tree.ParseTree; +import org.antlr.v4.runtime.tree.TerminalNode; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +public class VisitorOpsExtension extends SpirvBaseVisitor { + + private final Map> availableVisitors = new HashMap<>(); + private final Map visitorIds = new HashMap<>(); + + public VisitorOpsExtension(ProgramBuilder builder) { + VisitorExtensionClspvReflection clspv = new VisitorExtensionClspvReflection(builder); + this.availableVisitors.put("NonSemantic.ClspvReflection.5", clspv); + this.availableVisitors.put("NonSemantic.ClspvReflection.6", clspv); + } + + @Override + public Void visitOpExtInstImport(SpirvParser.OpExtInstImportContext ctx) { + String name = ctx.nameLiteralString().getText(); + name = name.substring(1, name.length() - 1); + SpirvBaseVisitor visitor = availableVisitors.get(name); + if (visitor != null) { + String id = ctx.idResult().getText(); + visitorIds.put(id, name); + return null; + } + throw new ParsingException("Unsupported Spir-V extension '%s'", name); + } + + @Override + public Void visitOpExtInst(SpirvParser.OpExtInstContext ctx) { + String id = ctx.set().getText(); + String name = visitorIds.get(id); + if (name != null) { + VisitorExtension visitor = availableVisitors.get(name); + String instruction = getFirstTokenText(ctx.instruction()); + if (visitor.getSupportedInstructions().contains(instruction)) { + ctx.accept(visitor); + return null; + } + throw new ParsingException("External instruction '%s' is not implemented for '%s'", instruction, name); + } + throw new ParsingException("Unexpected extension id '%s'", id); + } + + private String getFirstTokenText(ParseTree ctx) { + while (!(ctx instanceof TerminalNode)) { + ctx = ctx.getChild(0); + } + return ctx.getText(); + } + + public Set getSupportedOps() { + return Set.of( + "OpExtInstImport", + "OpExtInst" + ); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsFunction.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsFunction.java new file mode 100644 index 0000000000..a8c34e33bc --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsFunction.java @@ -0,0 +1,181 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.Type; +import com.dat3m.dartagnan.expression.type.FunctionType; +import com.dat3m.dartagnan.expression.type.ScopedPointerType; +import com.dat3m.dartagnan.expression.type.TypeFactory; +import com.dat3m.dartagnan.expression.type.VoidType; +import com.dat3m.dartagnan.parsers.SpirvBaseVisitor; +import com.dat3m.dartagnan.parsers.SpirvParser; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.builders.ProgramBuilder; +import com.dat3m.dartagnan.program.event.functions.FunctionCall; +import com.dat3m.dartagnan.program.memory.ScopedPointer; +import com.dat3m.dartagnan.program.Function; +import com.dat3m.dartagnan.program.Register; + +import java.util.*; +import java.util.stream.IntStream; + +import static com.dat3m.dartagnan.program.event.EventFactory.newValueFunctionCall; +import static com.dat3m.dartagnan.program.event.EventFactory.newVoidFunctionCall; + +public class VisitorOpsFunction extends SpirvBaseVisitor { + + private static final TypeFactory types = TypeFactory.getInstance(); + private final ProgramBuilder builder; + private String currentId; + private FunctionType currentType; + private List currentArgs; + private int nextFunctionId = 0; + + final Map forwardFunctions = new HashMap<>(); + final Map> forwardCalls = new HashMap<>(); + + public VisitorOpsFunction(ProgramBuilder builder) { + this.builder = builder; + } + + @Override + public Void visitOpFunction(SpirvParser.OpFunctionContext ctx) { + String id = ctx.idResult().getText(); + String typeName = ctx.functionType().getText(); + Type type = builder.getType(typeName); + if (type instanceof FunctionType fType) { + String returnTypeName = ctx.idResultType().getText(); + Type returnType = builder.getType(returnTypeName); + if (!returnType.equals(fType.getReturnType())) { + throw new ParsingException("Failed to create function '%s'. " + + "Illegal return type: expected %s but received %s", + id, fType.getReturnType().getClass().getSimpleName(), + returnType.getClass().getSimpleName()); + } + currentId = id; + currentType = fType; + currentArgs = new ArrayList<>(); + if (currentType.getParameterTypes().isEmpty()) { + createFunction(); + } + return null; + } + throw new ParsingException("Failed to create function '%s'. " + + "Illegal variable type '%s': expected %s but received %s", + id, typeName, FunctionType.class.getSimpleName(), + type.getClass().getSimpleName()); + } + + @Override + public Void visitOpFunctionParameter(SpirvParser.OpFunctionParameterContext ctx) { + String id = ctx.idResult().getText(); + if (currentId == null || currentType == null || currentArgs == null) { + throw new ParsingException("Attempt to declare function parameter '%s' " + + "outside of a function definition", id); + } + Type type = builder.getType(ctx.idResultType().getText()); + if (!(type instanceof ScopedPointerType)) { + throw new ParsingException("Attempt to use a non-pointer type for parameter '%s " + + "in function '%s'", id, currentId); + } + List argTypes = currentType.getParameterTypes(); + int idx = currentArgs.size(); + if (idx >= argTypes.size() || !type.equals(argTypes.get(idx))) { + throw new ParsingException("Mismatching argument type in function '%s' " + + "for argument '%s'", currentId, id); + } + if (currentArgs.contains(id)) { + throw new ParsingException("Duplicated parameter id '%s' in function '%s'", id, currentId); + } + currentArgs.add(id); + if (currentArgs.size() == currentType.getParameterTypes().size()) { + createFunction(); + } + return null; + } + + @Override + public Void visitOpFunctionEnd(SpirvParser.OpFunctionEndContext ctx) { + builder.endCurrentFunction(); + return null; + } + + @Override + public Void visitOpFunctionCall(SpirvParser.OpFunctionCallContext ctx) { + String id = ctx.idResult().getText(); + String typeId = ctx.idResultType().getText(); + String functionId = ctx.function().getText(); + Type returnType = builder.getType(typeId); + List args = ctx.argument().stream() + .map(a -> builder.getExpression(a.getText())).toList(); + List argTypes = args.stream() + .map(e -> e instanceof ScopedPointer pBase + ? types.getScopedPointerType(pBase.getScopeId(), pBase.getInnerType()) + : e.getType()).toList(); + FunctionType functionType = types.getFunctionType(builder.getType(typeId), argTypes); + Function function = getCalledFunction(functionId, functionType); + FunctionCall event; + if (returnType instanceof VoidType) { + event = newVoidFunctionCall(function, args); + } else { + Register register = builder.addRegister(id, typeId); + event = newValueFunctionCall(register, function, args); + } + if (!builder.hasDefinition(functionId)) { + forwardCalls.computeIfAbsent(functionId, x -> new HashSet<>()).add(event); + } + builder.addEvent(event); + return null; + } + + private void createFunction() { + Function function = new Function(currentId, currentType, currentArgs, nextFunctionId++, null); + builder.startCurrentFunction(function); + if (forwardFunctions.containsKey(currentId)) { + Function forwardFunction = forwardFunctions.remove(currentId); + checkFunctionType(currentId, forwardFunction, currentType); + forwardCalls.remove(currentId).forEach(e -> e.setCallTarget(function)); + } + currentId = null; + currentType = null; + currentArgs = null; + } + + private Function getCalledFunction(String id, FunctionType type) { + if (builder.hasDefinition(id)) { + Expression expression = builder.getExpression(id); + if (expression instanceof Function function) { + checkFunctionType(id, function, type); + return function; + } + throw new ParsingException("Unexpected type of expression '%s', " + + "expected a function but received '%s'", id, expression.getType()); + } + if (forwardFunctions.containsKey(id)) { + Function function = forwardFunctions.get(id); + checkFunctionType(id, function, type); + return function; + } + List args = IntStream.range(0, type.getParameterTypes().size()) + .boxed().map(i -> "param_" + i) + .toList(); + Function function = new Function(id, type, args, nextFunctionId++, null); + forwardFunctions.put(id, function); + return function; + } + + private void checkFunctionType(String id, Function function, Type type) { + if (!function.getFunctionType().equals(type)) { + throw new ParsingException("Illegal call of function '%s', " + + "function type doesn't match the function definition", id); + } + } + + public Set getSupportedOps() { + return Set.of( + "OpFunction", + "OpFunctionParameter", + "OpFunctionEnd", + "OpFunctionCall" + ); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsLogical.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsLogical.java new file mode 100644 index 0000000000..a1343d664d --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsLogical.java @@ -0,0 +1,214 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.Type; +import com.dat3m.dartagnan.expression.booleans.BoolBinaryOp; +import com.dat3m.dartagnan.expression.booleans.BoolUnaryOp; +import com.dat3m.dartagnan.expression.integers.IntCmpOp; +import com.dat3m.dartagnan.expression.type.ArrayType; +import com.dat3m.dartagnan.expression.type.BooleanType; +import com.dat3m.dartagnan.expression.type.IntegerType; +import com.dat3m.dartagnan.parsers.SpirvBaseVisitor; +import com.dat3m.dartagnan.parsers.SpirvParser; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.builders.ProgramBuilder; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.event.EventFactory; +import com.dat3m.dartagnan.program.event.core.Local; + +import java.util.Set; +import java.util.function.Function; + +public class VisitorOpsLogical extends SpirvBaseVisitor { + + private static final ExpressionFactory expressions = ExpressionFactory.getInstance(); + + private final ProgramBuilder builder; + + public VisitorOpsLogical(ProgramBuilder builder) { + this.builder = builder; + } + + @Override + public Event visitOpLogicalOr(SpirvParser.OpLogicalOrContext ctx) { + return visitLogicalBinExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), BoolBinaryOp.OR); + } + + @Override + public Event visitOpLogicalAnd(SpirvParser.OpLogicalAndContext ctx) { + return visitLogicalBinExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), BoolBinaryOp.AND); + } + + @Override + public Event visitOpLogicalNot(SpirvParser.OpLogicalNotContext ctx) { + return visitLogicalUnExpression(ctx.idResult(), ctx.idResultType(), ctx.operand(), BoolUnaryOp.NOT); + } + + @Override + public Event visitOpSelect(SpirvParser.OpSelectContext ctx) { + String id = ctx.idResult().getText(); + Expression cond = getOperandBoolean(id, ctx.condition().getText()); + Expression op1 = builder.getExpression(ctx.object1().getText()); + Expression op2 = builder.getExpression(ctx.object2().getText()); + Type type = builder.getType(ctx.idResultType().getText()); + Register register = builder.addRegister(id, ctx.idResultType().getText()); + if (!op1.getType().equals(type) || !op2.getType().equals(type)) { + throw new ParsingException("Illegal definition for '%s', " + + "expected two operands type '%s but received '%s' and '%s'", + id, type, op1.getType(), op2.getType()); + } + if (op1.getType() instanceof IntegerType) { + return builder.addEvent(new Local(register, expressions.makeITE(cond, op1, op2))); + } + throw new ParsingException("Illegal definition for '%s', " + + "operands must be integers or arrays of booleans", id); + } + + @Override + public Event visitOpIEqual(SpirvParser.OpIEqualContext ctx) { + return visitIntegerBinExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), IntCmpOp.EQ); + } + + @Override + public Event visitOpINotEqual(SpirvParser.OpINotEqualContext ctx) { + return visitIntegerBinExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), IntCmpOp.NEQ); + } + + @Override + public Event visitOpUGreaterThan(SpirvParser.OpUGreaterThanContext ctx) { + return visitIntegerBinExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), IntCmpOp.UGT); + } + + @Override + public Event visitOpSGreaterThan(SpirvParser.OpSGreaterThanContext ctx) { + return visitIntegerBinExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), IntCmpOp.GT); + } + + @Override + public Event visitOpUGreaterThanEqual(SpirvParser.OpUGreaterThanEqualContext ctx) { + return visitIntegerBinExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), IntCmpOp.UGTE); + } + + @Override + public Event visitOpSGreaterThanEqual(SpirvParser.OpSGreaterThanEqualContext ctx) { + return visitIntegerBinExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), IntCmpOp.GTE); + } + + @Override + public Event visitOpULessThan(SpirvParser.OpULessThanContext ctx) { + return visitIntegerBinExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), IntCmpOp.ULT); + } + + @Override + public Event visitOpSLessThan(SpirvParser.OpSLessThanContext ctx) { + return visitIntegerBinExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), IntCmpOp.LT); + } + + @Override + public Event visitOpULessThanEqual(SpirvParser.OpULessThanEqualContext ctx) { + return visitIntegerBinExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), IntCmpOp.ULTE); + } + + @Override + public Event visitOpSLessThanEqual(SpirvParser.OpSLessThanEqualContext ctx) { + return visitIntegerBinExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), IntCmpOp.LTE); + } + + private Event visitLogicalUnExpression( + SpirvParser.IdResultContext idCtx, + SpirvParser.IdResultTypeContext typeCtx, + SpirvParser.OperandContext opCtx, + BoolUnaryOp op) { + String id = idCtx.getText(); + return forType(id, typeCtx.getText(), bType -> { + Expression operand = getOperandBoolean(id, opCtx.getText()); + return expressions.makeUnary(op, operand); + }); + } + + private Event visitLogicalBinExpression( + SpirvParser.IdResultContext idCtx, + SpirvParser.IdResultTypeContext typeCtx, + SpirvParser.Operand1Context op1Ctx, + SpirvParser.Operand2Context op2Ctx, + BoolBinaryOp op) { + String id = idCtx.getText(); + return forType(id, typeCtx.getText(), bType -> { + Expression op1 = getOperandBoolean(id, op1Ctx.getText()); + Expression op2 = getOperandBoolean(id, op2Ctx.getText()); + return expressions.makeBinary(op1, op, op2); + }); + } + + private Event visitIntegerBinExpression( + SpirvParser.IdResultContext idCtx, + SpirvParser.IdResultTypeContext typeCtx, + SpirvParser.Operand1Context op1Ctx, + SpirvParser.Operand2Context op2Ctx, + IntCmpOp op) { + String id = idCtx.getText(); + return forType(id, typeCtx.getText(), bType -> { + Expression op1 = getOperandInteger(id, op1Ctx.getText()); + Expression op2 = getOperandInteger(id, op2Ctx.getText()); + if (op1.getType().equals(op2.getType())) { + return expressions.makeIntCmp(op1, op, op2); + } + throw new ParsingException("Illegal definition for '%s', " + + "operands have different types: '%s' is '%s' and '%s' is '%s'", + id, op1Ctx.getText(), op1.getType(), op2Ctx.getText(), op2.getType()); + }); + } + + private Event forType(String id, String typeId, Function f) { + Type type = builder.getType(typeId); + Register register = builder.addRegister(id, typeId); + if (type instanceof BooleanType bType) { + Local event = EventFactory.newLocal(register, f.apply(bType)); + return builder.addEvent(event); + } + if (type instanceof ArrayType) { + throw new ParsingException("Unsupported result type for '%s', " + + "vector types are not supported", id); + } + throw new ParsingException("Illegal result type for '%s'", id); + } + + private Expression getOperandBoolean(String id, String opId) { + Expression op = builder.getExpression(opId); + if (op.getType() instanceof BooleanType) { + return op; + } + throw new ParsingException("Illegal definition for '%s', " + + "operand '%s' must be a boolean", id, opId); + } + + private Expression getOperandInteger(String id, String opId) { + Expression op = builder.getExpression(opId); + if (op.getType() instanceof IntegerType) { + return op; + } + throw new ParsingException("Illegal definition for '%s', " + + "operand '%s' must be an integer", id, opId); + } + + public Set getSupportedOps() { + return Set.of( + "OpLogicalOr", + "OpLogicalAnd", + "OpLogicalNot", + "OpSelect", + "OpIEqual", + "OpINotEqual", + "OpUGreaterThan", + "OpSGreaterThan", + "OpUGreaterThanEqual", + "OpSGreaterThanEqual", + "OpULessThan", + "OpSLessThan", + "OpULessThanEqual", + "OpSLessThanEqual" + ); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsMemory.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsMemory.java new file mode 100644 index 0000000000..09078282dc --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsMemory.java @@ -0,0 +1,245 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.Type; +import com.dat3m.dartagnan.expression.integers.IntLiteral; +import com.dat3m.dartagnan.expression.type.*; +import com.dat3m.dartagnan.parsers.SpirvBaseVisitor; +import com.dat3m.dartagnan.parsers.SpirvParser; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations.BuiltIn; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.helpers.HelperTypes; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.helpers.HelperInputs; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.helpers.HelperTags; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.builders.ProgramBuilder; +import com.dat3m.dartagnan.program.memory.MemoryObject; +import com.dat3m.dartagnan.program.memory.ScopedPointer; +import com.dat3m.dartagnan.program.memory.ScopedPointerVariable; +import com.dat3m.dartagnan.expression.type.ScopedPointerType; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.event.EventFactory; +import com.dat3m.dartagnan.program.event.Tag; +import org.antlr.v4.runtime.tree.ParseTree; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import static com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations.DecorationType.BUILT_IN; + +public class VisitorOpsMemory extends SpirvBaseVisitor { + + private static final TypeFactory types = TypeFactory.getInstance(); + private static final ExpressionFactory expressions = ExpressionFactory.getInstance(); + private final ProgramBuilder builder; + private final BuiltIn builtIn; + + public VisitorOpsMemory(ProgramBuilder builder) { + this.builder = builder; + this.builtIn = (BuiltIn) builder.getDecorationsBuilder().getDecoration(BUILT_IN); + } + + @Override + public Event visitOpStore(SpirvParser.OpStoreContext ctx) { + Expression pointer = builder.getExpression(ctx.pointer().getText()); + Expression value = builder.getExpression(ctx.object().getText()); + Event event = EventFactory.newStore(pointer, value); + Set tags = parseMemoryAccessTags(ctx.memoryAccess()); + if (!tags.contains(Tag.Spirv.MEM_VISIBLE)) { + String storageClass = builder.getPointerStorageClass(ctx.pointer().getText()); + String scope = getScope(storageClass); + event.addTags(tags); + event.addTags(storageClass); + if (scope != null) { + event.addTags(Tag.Spirv.MEM_NON_PRIVATE); + event.addTags(scope); + } + return builder.addEvent(event); + } + throw new ParsingException("OpStore cannot contain tag '%s'", Tag.Spirv.MEM_VISIBLE); + } + + @Override + public Event visitOpLoad(SpirvParser.OpLoadContext ctx) { + Register register = builder.addRegister(ctx.idResult().getText(), ctx.idResultType().getText()); + Expression pointer = builder.getExpression(ctx.pointer().getText()); + Event event = EventFactory.newLoad(register, pointer); + Set tags = parseMemoryAccessTags(ctx.memoryAccess()); + if (!tags.contains(Tag.Spirv.MEM_AVAILABLE)) { + String storageClass = builder.getPointerStorageClass(ctx.pointer().getText()); + String scope = getScope(storageClass); + event.addTags(tags); + event.addTags(storageClass); + if (scope != null) { + event.addTags(Tag.Spirv.MEM_NON_PRIVATE); + event.addTags(scope); + } + return builder.addEvent(event); + } + throw new ParsingException("OpLoad cannot contain tag '%s'", Tag.Spirv.MEM_AVAILABLE); + } + + @Override + public Event visitOpVariable(SpirvParser.OpVariableContext ctx) { + String id = ctx.idResult().getText(); + String typeId = ctx.idResultType().getText(); + if (builder.getType(typeId) instanceof ScopedPointerType pointerType) { + Type type = pointerType.getPointedType(); + Expression value = getOpVariableInitialValue(ctx, type); + if (value != null) { + if (!TypeFactory.isStaticTypeOf(value.getType(), type)) { + throw new ParsingException("Mismatching value type for variable '%s', " + + "expected '%s' but received '%s'", id, type, value.getType()); + } + type = value.getType(); + } else if (!TypeFactory.isStaticType(type)) { + throw new ParsingException("Missing initial value for runtime variable '%s'", id); + } else { + value = builder.makeUndefinedValue(type); + } + int size = types.getMemorySizeInBytes(type); + MemoryObject memObj = builder.allocateVariable(id, size); + memObj.setInitialValue(0, value); + ScopedPointerVariable pointer = expressions.makeScopedPointerVariable(id, pointerType.getScopeId(), type, memObj); + validateVariableStorageClass(pointer, ctx.storageClass().getText()); + builder.addExpression(id, pointer); + return null; + } + throw new ParsingException("Type '%s' is not a pointer type", typeId); + } + + private Expression getOpVariableInitialValue(SpirvParser.OpVariableContext ctx, Type type) { + String id = ctx.idResult().getText(); + if (builder.hasInput(id)) { + if (builtIn.hasDecoration(id) || ctx.initializer() != null) { + throw new ParsingException("The original value of variable '%s' " + + "cannot be overwritten by an external input", id); + } + return HelperInputs.castInput(id, type, builder.getInput(id)); + } + if (builtIn.hasDecoration(id)) { + if (ctx.initializer() != null) { + throw new ParsingException("The original value of variable '%s' " + + "cannot be overwritten by a decoration", id); + } + return builtIn.getDecoration(id, type); + } + if (ctx.initializer() != null) { + return builder.getExpression(ctx.initializer().getText()); + } + return null; + } + + private void validateVariableStorageClass(ScopedPointerVariable pointer, String classToken) { + String ptrStorageClass = pointer.getScopeId(); + String varStorageClass = HelperTags.parseStorageClass(classToken); + if (!varStorageClass.equals(ptrStorageClass)) { + throw new ParsingException("Storage class of variable '%s' " + + "does not match the pointer storage class", pointer.getId()); + } + if (Tag.Spirv.SC_GENERIC.equals(ptrStorageClass)) { + throw new ParsingException("Variable '%s' has illegal storage class '%s'", + pointer.getId(), classToken); + } + } + + @Override + public Event visitOpAccessChain(SpirvParser.OpAccessChainContext ctx) { + visitOpAccessChain(ctx.idResult().getText(), ctx.idResultType().getText(), + ctx.base().getText(), ctx.indexesIdRef()); + return null; + } + + @Override + public Event visitOpInBoundsAccessChain(SpirvParser.OpInBoundsAccessChainContext ctx) { + visitOpAccessChain(ctx.idResult().getText(), ctx.idResultType().getText(), + ctx.base().getText(), ctx.indexesIdRef()); + return null; + } + + private void visitOpAccessChain(String id, String typeId, String baseId, + List idxContexts) { + if (builder.getType(typeId) instanceof ScopedPointerType pointerType) { + ScopedPointer base = (ScopedPointer) builder.getExpression(baseId); + Type baseType = base.getInnerType(); + Type resultType = pointerType.getPointedType(); + List intIndexes = new ArrayList<>(); + List exprIndexes = new ArrayList<>(); + idxContexts.forEach(c -> { + Expression expression = builder.getExpression(c.getText()); + exprIndexes.add(expression); + intIndexes.add(expression instanceof IntLiteral intLiteral ? intLiteral.getValueAsInt() : -1); + }); + Type runtimeResultType = HelperTypes.getMemberType(baseId, baseType, intIndexes); + if (!TypeFactory.isStaticTypeOf(runtimeResultType, resultType)) { + throw new ParsingException("Invalid result type in access chain '%s', " + + "expected '%s' but received '%s'", id, resultType, runtimeResultType); + } + Expression expression = HelperTypes.getMemberAddress(baseId, base, baseType, exprIndexes); + ScopedPointer pointer = expressions.makeScopedPointer(id, pointerType.getScopeId(), runtimeResultType, expression); + builder.addExpression(id, pointer); + return; + } + throw new ParsingException("Type '%s' is not a pointer type", typeId); + } + + private Set parseMemoryAccessTags(SpirvParser.MemoryAccessContext ctx) { + if (ctx == null || ctx.None() != null) { + return Set.of(); + } + if (ctx.Volatile() != null) { + return Set.of(Tag.Spirv.MEM_VOLATILE); + } + if (ctx.Nontemporal() != null) { + return Set.of(Tag.Spirv.MEM_NON_TEMPORAL); + } + if (ctx.NonPrivatePointer() != null || ctx.NonPrivatePointerKHR() != null) { + return Set.of(Tag.Spirv.MEM_NON_PRIVATE); + } + if (ctx.idScope() != null) { + String scopeId = ctx.idScope().getText(); + String scopeTag = HelperTags.parseScope(scopeId, builder.getExpression(scopeId)); + Set tags = new HashSet<>(Set.of(scopeTag, Tag.Spirv.MEM_NON_PRIVATE)); + if (ctx.MakePointerAvailable() != null || ctx.MakePointerAvailableKHR() != null) { + tags.add(Tag.Spirv.MEM_AVAILABLE); + } + if (ctx.MakePointerVisible() != null || ctx.MakePointerVisibleKHR() != null) { + tags.add(Tag.Spirv.MEM_VISIBLE); + } + return tags; + } + throw new ParsingException("Unsupported memory access tag '%s'", + String.join(" ", ctx.children.stream().map(ParseTree::getText).toList())); + } + + private String getScope(String storageClass) { + return switch (storageClass) { + case Tag.Spirv.SC_UNIFORM_CONSTANT, + Tag.Spirv.SC_UNIFORM, + Tag.Spirv.SC_OUTPUT, + Tag.Spirv.SC_PUSH_CONSTANT, + Tag.Spirv.SC_STORAGE_BUFFER, + Tag.Spirv.SC_PHYS_STORAGE_BUFFER -> Tag.Spirv.DEVICE; + case Tag.Spirv.SC_PRIVATE, + Tag.Spirv.SC_FUNCTION, + Tag.Spirv.SC_INPUT -> null; + case Tag.Spirv.SC_WORKGROUP -> Tag.Spirv.WORKGROUP; + case Tag.Spirv.SC_CROSS_WORKGROUP -> Tag.Spirv.QUEUE_FAMILY; + default -> throw new UnsupportedOperationException( + "Unsupported storage class " + storageClass); + }; + } + + public Set getSupportedOps() { + return Set.of( + "OpVariable", + "OpLoad", + "OpStore", + "OpAccessChain", + "OpInBoundsAccessChain" + ); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsSetting.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsSetting.java new file mode 100644 index 0000000000..847e9a69b9 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsSetting.java @@ -0,0 +1,32 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.parsers.SpirvBaseVisitor; +import com.dat3m.dartagnan.parsers.SpirvParser; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.builders.ProgramBuilder; + +import java.util.Set; + +public class VisitorOpsSetting extends SpirvBaseVisitor { + + private final ProgramBuilder builder; + + public VisitorOpsSetting(ProgramBuilder builder) { + this.builder = builder; + } + + @Override + public Void visitOpEntryPoint(SpirvParser.OpEntryPointContext ctx) { + builder.setEntryPointId(ctx.entryPoint().getText()); + return null; + } + + public Set getSupportedOps() { + return Set.of( + "OpCapability", + "OpMemoryModel", + "OpEntryPoint", + "OpExecutionMode", + "OpExecutionModeId" + ); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsType.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsType.java new file mode 100644 index 0000000000..ad4719ccfc --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsType.java @@ -0,0 +1,132 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.Type; +import com.dat3m.dartagnan.expression.integers.IntLiteral; +import com.dat3m.dartagnan.expression.type.TypeFactory; +import com.dat3m.dartagnan.parsers.SpirvBaseVisitor; +import com.dat3m.dartagnan.parsers.SpirvParser; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.helpers.HelperTags; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.builders.ProgramBuilder; + +import java.util.List; +import java.util.Set; + +public class VisitorOpsType extends SpirvBaseVisitor { + + private static final TypeFactory types = TypeFactory.getInstance(); + + private final ProgramBuilder builder; + + public VisitorOpsType(ProgramBuilder builder) { + this.builder = builder; + } + + @Override + public Type visitOp(SpirvParser.OpContext ctx) { + Type type = ctx.getChild(0).accept(this); + if (type != null) { + return type; + } + throw new ParsingException("Cannot parse operation '%s'", ctx.getText()); + } + + @Override + public Type visitOpTypeVoid(SpirvParser.OpTypeVoidContext ctx) { + return builder.addType(ctx.idResult().getText(), types.getVoidType()); + } + + @Override + public Type visitOpTypeBool(SpirvParser.OpTypeBoolContext ctx) { + return builder.addType(ctx.idResult().getText(), types.getBooleanType()); + } + + @Override + public Type visitOpTypeInt(SpirvParser.OpTypeIntContext ctx) { + // TODO: Signedness + String id = ctx.idResult().getText(); + int size = Integer.parseInt(ctx.widthLiteralInteger().getText()); + Type type = types.getIntegerType(size); + return builder.addType(id, type); + } + + @Override + public Type visitOpTypeVector(SpirvParser.OpTypeVectorContext ctx) { + String id = ctx.idResult().getText(); + String elementTypeName = ctx.componentType().getText(); + Type elementType = builder.getType(elementTypeName); + int size = Integer.parseInt(ctx.componentCount().getText()); + Type type = types.getArrayType(elementType, size); + return builder.addType(id, type); + } + + @Override + public Type visitOpTypeArray(SpirvParser.OpTypeArrayContext ctx) { + String id = ctx.idResult().getText(); + String elementTypeName = ctx.elementType().getText(); + Type elementType = builder.getType(elementTypeName); + String lengthValueName = ctx.lengthIdRef().getText(); + Expression lengthExpr = builder.getExpression(lengthValueName); + if (lengthExpr != null) { + if (lengthExpr instanceof IntLiteral iValue) { + Type type = types.getArrayType(elementType, iValue.getValue().intValue()); + return builder.addType(id, type); + } + throw new ParsingException("Attempt to use a non-integer value as array size '%s'", lengthValueName); + } + throw new ParsingException("Reference to undefined expression '%s'", lengthValueName); + } + + @Override + public Type visitOpTypeRuntimeArray(SpirvParser.OpTypeRuntimeArrayContext ctx) { + String id = ctx.idResult().getText(); + String elementTypeName = ctx.elementType().getText(); + Type elementType = builder.getType(elementTypeName); + Type type = types.getArrayType(elementType); + return builder.addType(id, type); + } + + @Override + public Type visitOpTypeStruct(SpirvParser.OpTypeStructContext ctx) { + String id = ctx.idResult().getText(); + List memberTypes = ctx.memberType().stream() + .map(memberCtx -> builder.getType(memberCtx.getText())).toList(); + Type type = types.getAggregateType(memberTypes); + return builder.addType(id, type); + } + + @Override + public Type visitOpTypePointer(SpirvParser.OpTypePointerContext ctx) { + String id = ctx.idResult().getText(); + String inner = ctx.type().getText(); + String storageClass = HelperTags.parseStorageClass(ctx.storageClass().getText()); + Type type = types.getScopedPointerType(storageClass, builder.getType(inner)); + return builder.addType(id, type); + } + + @Override + public Type visitOpTypeFunction(SpirvParser.OpTypeFunctionContext ctx) { + String id = ctx.idResult().getText(); + String returnTypeName = ctx.returnType().getText(); + Type returnType = builder.getType(returnTypeName); + List argTypes = ctx.parameterType().stream() + .map(argCtx -> builder.getType(argCtx.getText())).toList(); + Type type = types.getFunctionType(returnType, argTypes); + return builder.addType(id, type); + } + + public Set getSupportedOps() { + return Set.of( + "OpTypeVoid", + "OpTypeBool", + "OpTypeInt", + "OpTypeVector", + "OpTypeArray", + "OpTypeRuntimeArray", + "OpTypeStruct", + "OpTypePointer", + "OpTypeFunction" + ); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorSpirvInput.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorSpirvInput.java new file mode 100644 index 0000000000..765c728dcf --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorSpirvInput.java @@ -0,0 +1,56 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.type.IntegerType; +import com.dat3m.dartagnan.expression.type.TypeFactory; +import com.dat3m.dartagnan.parsers.SpirvBaseVisitor; +import com.dat3m.dartagnan.parsers.SpirvParser; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.builders.ProgramBuilder; + +public class VisitorSpirvInput extends SpirvBaseVisitor { + private static final TypeFactory types = TypeFactory.getInstance(); + private static final ExpressionFactory expressions = ExpressionFactory.getInstance(); + + private final ProgramBuilder builder; + + public VisitorSpirvInput(ProgramBuilder builder) { + this.builder = builder; + } + + @Override + public Expression visitSpvHeaders(SpirvParser.SpvHeadersContext ctx) { + for (SpirvParser.SpvHeaderContext header : ctx.spvHeader()) { + if (header.inputHeader() != null && header.inputHeader().initList() != null) { + visitInitList(header.inputHeader().initList()); + } + } + return null; + } + + @Override + public Expression visitInit(SpirvParser.InitContext ctx) { + String id = ctx.varName().getText(); + Expression value = visit(ctx.initValue()); + builder.addInput(id, value); + return null; + } + + @Override + public Expression visitInitBaseValue(SpirvParser.InitBaseValueContext ctx) { + IntegerType mockType = types.getArchType(); + try { + return expressions.makeValue(Long.parseLong(ctx.getText()), mockType); + } catch (ParsingException e) { + throw new ParsingException("Unsupported value " + ctx.getText()); + } + } + + @Override + public Expression visitInitCollectionValue(SpirvParser.InitCollectionValueContext ctx) { + return expressions.makeConstruct(ctx.initValues().initValue().stream() + .map(this::visitInitValue) + .toList()); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorSpirvOutput.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorSpirvOutput.java new file mode 100644 index 0000000000..1fbf076f80 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorSpirvOutput.java @@ -0,0 +1,193 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.Type; +import com.dat3m.dartagnan.expression.base.LiteralExpressionBase; +import com.dat3m.dartagnan.expression.integers.IntCmpOp; +import com.dat3m.dartagnan.expression.integers.IntLiteral; +import com.dat3m.dartagnan.expression.type.AggregateType; +import com.dat3m.dartagnan.expression.type.ArrayType; +import com.dat3m.dartagnan.expression.type.IntegerType; +import com.dat3m.dartagnan.expression.type.TypeFactory; +import com.dat3m.dartagnan.parsers.SpirvBaseVisitor; +import com.dat3m.dartagnan.parsers.SpirvParser; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.helpers.HelperTypes; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.builders.ProgramBuilder; +import com.dat3m.dartagnan.program.Program; +import com.dat3m.dartagnan.program.memory.Location; +import com.dat3m.dartagnan.program.memory.ScopedPointerVariable; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.dat3m.dartagnan.expression.integers.IntCmpOp.*; +import static com.dat3m.dartagnan.program.Program.SpecificationType.*; + +public class VisitorSpirvOutput extends SpirvBaseVisitor { + + private static final TypeFactory types = TypeFactory.getInstance(); + private static final ExpressionFactory expressions = ExpressionFactory.getInstance(); + private final Map locationTypes = new HashMap<>(); + private final ProgramBuilder builder; + private Program.SpecificationType type; + private Expression condition; + + public VisitorSpirvOutput(ProgramBuilder builder) { + this.builder = builder; + } + + @Override + public Expression visitSpvHeaders(SpirvParser.SpvHeadersContext ctx) { + for (SpirvParser.SpvHeaderContext header : ctx.spvHeader()) { + if (header.outputHeader() != null && header.outputHeader().assertionList() != null) { + visitAssertionList(header.outputHeader().assertionList()); + } + } + if (type == null) { + type = FORALL; + condition = ExpressionFactory.getInstance().makeTrue(); + } + builder.setSpecification(type, condition); + return null; + } + + @Override + public Expression visitAssertionList(SpirvParser.AssertionListContext ctx) { + Program.SpecificationType parsedType = parseType(ctx); + Expression parsedAssertion = ctx.assertion().accept(this); + appendAssertion(parsedType, parsedAssertion); + return null; + } + + @Override + public Expression visitAssertionParenthesis(SpirvParser.AssertionParenthesisContext ctx) { + return ctx.assertion().accept(this); + } + + @Override + public Expression visitAssertionNot(SpirvParser.AssertionNotContext ctx) { + return expressions.makeNot(ctx.assertion().accept(this)); + } + + @Override + public Expression visitAssertionAnd(SpirvParser.AssertionAndContext ctx) { + return expressions.makeAnd(ctx.assertion(0).accept(this), ctx.assertion(1).accept(this)); + } + + @Override + public Expression visitAssertionOr(SpirvParser.AssertionOrContext ctx) { + return expressions.makeOr(ctx.assertion(0).accept(this), ctx.assertion(1).accept(this)); + } + + @Override + public Expression visitAssertionBasic(SpirvParser.AssertionBasicContext ctx) { + Expression expr1 = ctx.assertionValue(0).accept(this); + Expression expr2 = ctx.assertionValue(1).accept(this); + IntCmpOp op = parseOperand(ctx.assertionCompare()); + expr1 = normalize(expr1, expr2); + expr2 = normalize(expr2, expr1); + return expressions.makeBinary(expr1, op, expr2); + } + + @Override + public Expression visitAssertionValue(SpirvParser.AssertionValueContext ctx) { + if (ctx.initBaseValue() != null) { + return expressions.parseValue(ctx.initBaseValue().getText(), types.getArchType()); + } + String name = ctx.varName().getText(); + ScopedPointerVariable base = (ScopedPointerVariable) builder.getExpression(name); + if (base != null) { + List indexes = ctx.indexValue().stream() + .map(c -> Integer.parseInt(c.ModeHeader_PositiveInteger().getText())) + .toList(); + return createLocation(base, indexes); + } + throw new ParsingException("Uninitialized location %s", name); + } + + private void appendAssertion(Program.SpecificationType newType, Expression expression) { + if (condition == null) { + type = newType; + condition = expression; + } else if (newType.equals(type)) { + if (type.equals(FORALL)) { + condition = ExpressionFactory.getInstance().makeAnd(condition, expression); + } else if (type.equals(NOT_EXISTS)) { + condition = ExpressionFactory.getInstance().makeOr(condition, expression); + } else { + throw new ParsingException("Multiline assertion is not supported for type " + newType); + } + } else { + throw new ParsingException("Mixed assertion type is not supported"); + } + } + + private Expression normalize(Expression target, Expression other) { + Type targetType = target instanceof Location ? locationTypes.get(target) : target.getType(); + Type otherType = other instanceof Location ? locationTypes.get(other) : other.getType(); + if (targetType.equals(otherType)) { + return target; + } + if (target instanceof Location && other instanceof LiteralExpressionBase) { + return target; + } + if (target instanceof IntLiteral iValue && other instanceof Location) { + int size = types.getMemorySizeInBits(otherType); + IntegerType newType = types.getIntegerType(size); + return new IntLiteral(newType, iValue.getValue()); + } + throw new ParsingException("Mismatching type assertions are not supported for %s and %s", + target.getClass().getSimpleName(), other.getClass().getSimpleName()); + } + + private Program.SpecificationType parseType(SpirvParser.AssertionListContext ctx) { + if (ctx.ModeHeader_AssertionNot() != null) { + return NOT_EXISTS; + } + if (ctx.ModeHeader_AssertionExists() != null) { + return EXISTS; + } + if (ctx.ModeHeader_AssertionForall() != null) { + return FORALL; + } + throw new ParsingException("Unrecognised assertion type"); + } + + private IntCmpOp parseOperand(SpirvParser.AssertionCompareContext ctx) { + if (ctx.ModeHeader_EqualEqual() != null) { + return EQ; + } + if (ctx.ModeHeader_NotEqual() != null) { + return NEQ; + } + if (ctx.ModeHeader_Less() != null) { + return LT; + } + if (ctx.ModeHeader_LessEqual() != null) { + return LTE; + } + if (ctx.ModeHeader_Greater() != null) { + return GT; + } + if (ctx.ModeHeader_GreaterEqual() != null) { + return GTE; + } + throw new ParsingException("Unrecognised comparison operator"); + } + + private Location createLocation(ScopedPointerVariable base, List indexes) { + String name = indexes.isEmpty() ? base.getId() : + base.getId() + "[" + String.join("][", indexes.stream().map(Object::toString).toArray(String[]::new)) + "]"; + Type elType = HelperTypes.getMemberType(base.getId(), base.getInnerType(), indexes); + if (elType instanceof ArrayType || elType instanceof AggregateType) { + throw new ParsingException("Index is not deep enough for variable '%s'", name); + } + int offset = HelperTypes.getMemberOffset(base.getId(), 0, base.getInnerType(), indexes); + Location location = new Location(name, elType, base.getAddress(), offset); + locationTypes.put(location, elType); + return location; + } +} \ No newline at end of file diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/builders/ControlFlowBuilder.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/builders/ControlFlowBuilder.java new file mode 100644 index 0000000000..68cf0f9534 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/builders/ControlFlowBuilder.java @@ -0,0 +1,103 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv.builders; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.event.EventFactory; +import com.dat3m.dartagnan.program.event.core.Label; +import com.google.common.collect.Sets; + +import java.util.*; + +public class ControlFlowBuilder { + + protected final Map blockLabels = new HashMap<>(); + protected final Map lastBlockEvents = new HashMap<>(); + protected final Map mergeLabelIds = new HashMap<>(); + protected final Deque blockStack = new ArrayDeque<>(); + protected final Map> phiDefinitions = new HashMap<>(); + protected final Map expressions; + + public ControlFlowBuilder(Map expressions) { + this.expressions = expressions; + } + + public boolean isInsideBlock() { + return !blockStack.isEmpty(); + } + + public boolean isBlockStarted(String id) { + return lastBlockEvents.containsKey(id) || blockStack.contains(id); + } + + public void build() { + validateBeforeBuild(); + phiDefinitions.forEach((blockId, def) -> + def.forEach((k, v) -> { + Event event = EventFactory.newLocal(k, expressions.get(v)); + lastBlockEvents.get(blockId).getPredecessor().insertAfter(event); + })); + mergeLabelIds.forEach((jumpLabelId, endLabelId) -> + lastBlockEvents.get(jumpLabelId).getPredecessor().insertAfter(blockLabels.get(endLabelId))); + } + + public void startBlock(String id) { + if (lastBlockEvents.containsKey(id)) { + throw new ParsingException("Attempt to redefine label '%s'", id); + } + blockStack.push(id); + } + + public Event endBlock(Event event) { + if (blockStack.isEmpty()) { + throw new ParsingException("Attempt to exit block while not in a block definition"); + } + lastBlockEvents.put(blockStack.pop(), event); + return event; + } + + public Label getOrCreateLabel(String id) { + return blockLabels.computeIfAbsent(id, EventFactory::newLabel); + } + + public Label createMergeLabel(String id) { + String mergeId = id + "_end"; + mergeLabelIds.put(id, mergeId); + return createLabel(mergeId); + } + + public void addPhiDefinition(String blockId, Register register, String expressionId) { + phiDefinitions.computeIfAbsent(blockId, k -> new HashMap<>()).put(register, expressionId); + } + + private void validateBeforeBuild() { + if (!blockStack.isEmpty()) { + throw new ParsingException("Unclosed blocks %s", String.join(",", blockStack)); + } + Set missingPhiBlocks = Sets.difference(phiDefinitions.keySet(), blockLabels.keySet()); + if (!missingPhiBlocks.isEmpty()) { + throw new ParsingException("Phi operation(s) refer to undefined block(s) %s", + String.join(", ", missingPhiBlocks)); + } + Set missingMergeBlocks = Sets.difference(mergeLabelIds.keySet(), blockLabels.keySet()); + if (!missingMergeBlocks.isEmpty()) { + throw new ParsingException("Branch merge label(s) refer to undefined block(s) %s", + String.join(", ", missingMergeBlocks)); + } + Map reverse = new HashMap<>(); + lastBlockEvents.forEach((k, v) -> { + if (reverse.containsKey(v)) { + throw new ParsingException("Multiple blocks end in the same event '%s'", v); + } + reverse.put(v, k); + }); + } + + private Label createLabel(String id) { + if (blockLabels.containsKey(id)) { + throw new ParsingException("Attempt to redefine label '%s'", id); + } + return getOrCreateLabel(id); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/builders/DecorationsBuilder.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/builders/DecorationsBuilder.java new file mode 100644 index 0000000000..9114261fb7 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/builders/DecorationsBuilder.java @@ -0,0 +1,30 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv.builders; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations.BuiltIn; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations.Decoration; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations.DecorationType; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations.SpecId; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.utils.ThreadGrid; + +import java.util.EnumMap; + +import static com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations.DecorationType.BUILT_IN; +import static com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations.DecorationType.SPEC_ID; + +public class DecorationsBuilder { + + private final EnumMap mapping = new EnumMap<>(DecorationType.class); + + public DecorationsBuilder(ThreadGrid grid) { + mapping.put(BUILT_IN, new BuiltIn(grid)); + mapping.put(SPEC_ID, new SpecId()); + } + + public Decoration getDecoration(DecorationType type) { + if (mapping.containsKey(type)) { + return mapping.get(type); + } + throw new ParsingException("Unsupported decoration type '%s'", type); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/builders/ProgramBuilder.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/builders/ProgramBuilder.java new file mode 100644 index 0000000000..86a0f811f9 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/builders/ProgramBuilder.java @@ -0,0 +1,280 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv.builders; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.Type; +import com.dat3m.dartagnan.expression.type.FunctionType; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations.BuiltIn; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.utils.ThreadCreator; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.utils.ThreadGrid; +import com.dat3m.dartagnan.program.event.functions.FunctionCall; +import com.dat3m.dartagnan.program.memory.ScopedPointer; +import com.dat3m.dartagnan.program.memory.ScopedPointerVariable; +import com.dat3m.dartagnan.expression.type.ScopedPointerType; +import com.dat3m.dartagnan.program.*; +import com.dat3m.dartagnan.program.event.*; +import com.dat3m.dartagnan.program.memory.Memory; +import com.dat3m.dartagnan.program.memory.MemoryObject; + +import java.util.*; +import java.util.stream.Collectors; + +import static com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations.DecorationType.BUILT_IN; + +public class ProgramBuilder { + + protected final Map types = new HashMap<>(); + protected final Map expressions = new HashMap<>(); + protected final Map inputs = new HashMap<>(); + protected final ThreadGrid grid; + protected final Program program; + protected ControlFlowBuilder controlFlowBuilder; + protected DecorationsBuilder decorationsBuilder; + protected Function currentFunction; + protected String entryPointId; + protected Set nextOps; + + public ProgramBuilder(ThreadGrid grid) { + this.grid = grid; + this.program = new Program(new Memory(), Program.SourceLanguage.SPV); + this.controlFlowBuilder = new ControlFlowBuilder(expressions); + this.decorationsBuilder = new DecorationsBuilder(grid); + } + + public Program build() { + validateBeforeBuild(); + controlFlowBuilder.build(); + BuiltIn builtIn = (BuiltIn) decorationsBuilder.getDecoration(BUILT_IN); + new ThreadCreator(grid, getEntryPointFunction(), getVariables(), builtIn).create(); + return program; + } + + public ThreadGrid getThreadGrid() { + return grid; + } + + public ControlFlowBuilder getControlFlowBuilder() { + return controlFlowBuilder; + } + + public DecorationsBuilder getDecorationsBuilder() { + return decorationsBuilder; + } + + public Set getNextOps() { + return nextOps; + } + + public void setNextOps(Set nextOps) { + if (this.nextOps != null) { + throw new ParsingException("Illegal attempt to override next ops"); + } + this.nextOps = nextOps; + } + + public void clearNextOps() { + this.nextOps = null; + } + + public void setEntryPointId(String id) { + if (entryPointId != null) { + throw new ParsingException("Multiple entry points are not supported"); + } + entryPointId = id; + } + + public void setSpecification(Program.SpecificationType type, Expression condition) { + if (program.getSpecification() != null) { + throw new ParsingException("Attempt to override program specification"); + } + program.setSpecification(type, condition); + } + + public boolean hasInput(String id) { + return inputs.containsKey(id); + } + + public boolean hasDefinition(String id) { + return types.containsKey(id) || expressions.containsKey(id); + } + + public Expression getInput(String id) { + if (inputs.containsKey(id)) { + return inputs.get(id); + } + throw new ParsingException("Reference to undefined input variable '%s'", id); + } + + public void addInput(String id, Expression value) { + if (inputs.containsKey(id)) { + throw new ParsingException("Duplicated input definition '%s'", id); + } + inputs.put(id, value); + } + + public Type getType(String id) { + Type type = types.get(id); + if (type == null) { + throw new ParsingException("Reference to undefined type '%s'", id); + } + return type; + } + + public Type addType(String id, Type type) { + if (types.containsKey(id) || expressions.containsKey(id)) { + throw new ParsingException("Duplicated definition '%s'", id); + } + types.put(id, type); + return type; + } + + public Expression getExpression(String id) { + Expression expression = expressions.get(id); + if (expression == null) { + throw new ParsingException("Reference to undefined expression '%s'", id); + } + return expression; + } + + public Expression addExpression(String id, Expression value) { + if (types.containsKey(id) || expressions.containsKey(id)) { + throw new ParsingException("Duplicated definition '%s'", id); + } + expressions.put(id, value); + return value; + } + + public Set getVariables() { + return expressions.values().stream() + .filter(ScopedPointerVariable.class::isInstance) + .map(v -> (ScopedPointerVariable) v) + .collect(Collectors.toSet()); + } + + public MemoryObject allocateVariable(String id, int bytes) { + MemoryObject memObj = program.getMemory().allocateVirtual(bytes, true, null); + memObj.setName(id); + return memObj; + } + + // TODO: Proper implementation of pointers + // where ScopedPointer uses ScopedPointerType + public String getPointerStorageClass(String id) { + Expression expression = getExpression(id); + // Pointers to variables and references from OpAccessChain + if (expression instanceof ScopedPointer pointer) { + return pointer.getScopeId(); + } + // Pointers passed via function argument registers + if (expression.getType() instanceof ScopedPointerType pointerType) { + return pointerType.getScopeId(); + } + throw new ParsingException("Reference to undefined pointer '%s'", id); + } + + public Register addRegister(String id, String typeId) { + Type type = getType(typeId); + if (type instanceof ScopedPointerType) { + throw new ParsingException("Register cannot be a pointer"); + } + return getCurrentFunctionOrThrowError().newRegister(id, type); + } + + public Expression makeUndefinedValue(Type type) { + return program.newConstant(type); + } + + public Event addEvent(Event event) { + if (currentFunction == null) { + throw new ParsingException("Attempt to add an event outside a function definition"); + } + if (!controlFlowBuilder.isInsideBlock()) { + throw new ParsingException("Attempt to add an event outside a control flow block"); + } + if (event instanceof RegWriter regWriter) { + Register register = regWriter.getResultRegister(); + addExpression(register.getName(), register); + } + currentFunction.append(event); + return event; + } + + public FunctionType getCurrentFunctionType() { + return getCurrentFunctionOrThrowError().getFunctionType(); + } + + public String getCurrentFunctionName() { + return getCurrentFunctionOrThrowError().getName(); + } + + public void startCurrentFunction(Function function) { + if (currentFunction != null) { + throw new ParsingException("Attempt to define function '%s' " + + "inside a definition of another function '%s'", + function.getName(), currentFunction.getName()); + } + addExpression(function.getName(), function); + for (Register register : function.getParameterRegisters()) { + addExpression(register.getName(), register); + } + program.addFunction(function); + currentFunction = function; + } + + public void endCurrentFunction() { + if (currentFunction == null) { + throw new ParsingException("Illegal attempt to exit a function definition"); + } + currentFunction = null; + } + + private void validateBeforeBuild() { + if (nextOps != null) { + throw new ParsingException("Missing expected op: %s", + String.join(",", nextOps)); + + } + if (currentFunction != null) { + throw new ParsingException("Unclosed definition for function '%s'", + currentFunction.getName()); + } + expressions.values().forEach(expression -> { + if (expression instanceof Function function) { + function.getEvents().forEach(event -> { + if (event instanceof FunctionCall call) { + String calledId = call.getCalledFunction().getName(); + if (!expressions.containsKey(calledId) + || !(expressions.get(calledId) instanceof Function)) { + throw new ParsingException("Call to undefined function '%s'", calledId); + } + } + }); + } + }); + } + + private Function getEntryPointFunction() { + if (entryPointId == null) { + throw new ParsingException("Cannot build the program, entryPointId is missing"); + } + Expression expression = expressions.get(entryPointId); + if (expression == null) { + throw new ParsingException("Cannot build the program, missing function definition '%s'", entryPointId); + } + if (expression instanceof Function function) { + if (function.hasReturnValue()) { + throw new ParsingException("Entry point function %s is not a void function", entryPointId); + } + return function; + } + throw new ParsingException("Entry point expression '%s' must be a function", entryPointId); + } + + private Function getCurrentFunctionOrThrowError() { + if (currentFunction != null) { + return currentFunction; + } + throw new ParsingException("Attempt to reference current function " + + "outside of a function definition"); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/decorations/BuiltIn.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/decorations/BuiltIn.java new file mode 100644 index 0000000000..23341ae7ef --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/decorations/BuiltIn.java @@ -0,0 +1,120 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.Type; +import com.dat3m.dartagnan.expression.misc.ConstructExpr; +import com.dat3m.dartagnan.expression.type.ArrayType; +import com.dat3m.dartagnan.expression.type.IntegerType; +import com.dat3m.dartagnan.expression.type.TypeFactory; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.utils.ThreadGrid; +import com.dat3m.dartagnan.program.memory.MemoryObject; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class BuiltIn implements Decoration { + + private static final TypeFactory types = TypeFactory.getInstance(); + private static final ExpressionFactory expressions = ExpressionFactory.getInstance(); + private final ThreadGrid grid; + private final Map mapping; + private int tid; + + public BuiltIn(ThreadGrid grid) { + this.grid = grid; + this.mapping = new HashMap<>(); + } + + public void setThreadId(int tid) { + this.tid = tid; + } + + @Override + public void addDecoration(String id, String... params) { + if (params.length != 1) { + throw new ParsingException("Illegal decoration '%s' for '%s'", + getClass().getSimpleName(), id); + } + if (mapping.containsKey(params[0])) { + throw new ParsingException("Multiple '%s' decorations for '%s'", + getClass().getSimpleName(), id); + } + mapping.put(id, params[0]); + } + + public void decorate(String id, MemoryObject memObj, Type type) { + if (mapping.containsKey(id)) { + Expression expression = getDecoration(id, type); + if (expression instanceof ConstructExpr cExpr) { + Type elementType = getArrayElementType(id, type); + int size = types.getMemorySizeInBytes(elementType); + memObj.setInitialValue(0, cExpr.getOperands().get(0)); + memObj.setInitialValue(size, cExpr.getOperands().get(1)); + memObj.setInitialValue(size * 2, cExpr.getOperands().get(2)); + } else { + memObj.setInitialValue(0, expression); + } + } + } + + public boolean hasDecoration(String id) { + return mapping.containsKey(id); + } + + public Expression getDecoration(String id, Type type) { + if (mapping.containsKey(id)) { + return getDecorationExpressions(id, type); + } + return null; + } + + private Expression getDecorationExpressions(String id, Type type) { + return switch (mapping.get(id)) { + // BuiltIn decorations according to the Vulkan API + case "SubgroupLocalInvocationId" -> makeScalar(id, type, tid % grid.sgSize()); + case "LocalInvocationId" -> makeArray(id, type, tid % grid.wgSize(), 0, 0); + case "LocalInvocationIndex" -> makeScalar(id, type, tid % grid.wgSize()); // scalar of LocalInvocationId + case "GlobalInvocationId" -> makeArray(id, type, tid % grid.dvSize(), 0, 0); + case "DeviceIndex" -> makeScalar(id, type, 0); + case "SubgroupId" -> makeScalar(id, type, grid.sgId(tid)); + case "WorkgroupId" -> makeArray(id, type, grid.wgId(tid), 0, 0); + case "SubgroupSize" -> makeScalar(id, type, grid.sgSize()); + case "WorkgroupSize" -> makeArray(id, type, grid.wgSize(), 1, 1); + default -> throw new ParsingException("Unsupported decoration '%s'", mapping.get(id)); + }; + } + + private Expression makeArray(String id, Type type, int x, int y, int z) { + List operands = new ArrayList<>(); + IntegerType elementType = getArrayElementType(id, type); + operands.add(expressions.makeValue(x, elementType)); + operands.add(expressions.makeValue(y, elementType)); + operands.add(expressions.makeValue(z, elementType)); + return expressions.makeArray(elementType, operands, true); + } + + private Expression makeScalar(String id, Type type, int x) { + IntegerType iType = getIntegerType(id, type); + return expressions.makeValue(x, iType); + } + + private IntegerType getArrayElementType(String id, Type type) { + if (type instanceof ArrayType aType && aType.getNumElements() == 3) { + return getIntegerType(id, aType.getElementType()); + } + throw new ParsingException("Illegal type of element '%s', " + + "expected array of three elements but received '%s'", id, type); + } + + private IntegerType getIntegerType(String id, Type type) { + if (type instanceof IntegerType iType && iType.getBitWidth() == 32) { + return iType; + } + throw new ParsingException("Illegal type in '%s', " + + "expected a 32-bit integer but received '%s'", id, type); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/decorations/Decoration.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/decorations/Decoration.java new file mode 100644 index 0000000000..0c4eab1754 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/decorations/Decoration.java @@ -0,0 +1,6 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations; + +public interface Decoration { + + void addDecoration(String id, String... params); +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/decorations/DecorationType.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/decorations/DecorationType.java new file mode 100644 index 0000000000..f33ad719b0 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/decorations/DecorationType.java @@ -0,0 +1,34 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations; + +public enum DecorationType { + ARRAY_STRIDE, + BINDING, + BLOCK, + BUFFER_BLOCK, + BUILT_IN, + COHERENT, + DESCRIPTOR_SET, + OFFSET, + NO_CONTRACTION, + NO_PERSPECTIVE, + NON_WRITABLE, + SPEC_ID; + + public static DecorationType fromString(String type) { + return switch (type) { + case "ArrayStride" -> ARRAY_STRIDE; + case "Binding" -> BINDING; + case "Block" -> BLOCK; + case "BufferBlock" -> BUFFER_BLOCK; + case "BuiltIn" -> BUILT_IN; + case "Coherent" -> COHERENT; + case "DescriptorSet" -> DESCRIPTOR_SET; + case "Offset" -> OFFSET; + case "NoContraction" -> NO_CONTRACTION; + case "NoPerspective" -> NO_PERSPECTIVE; + case "NonWritable" -> NON_WRITABLE; + case "SpecId" -> SPEC_ID; + default -> throw new IllegalArgumentException("Unsupported decoration type " + type); + }; + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/decorations/SpecId.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/decorations/SpecId.java new file mode 100644 index 0000000000..1740018f96 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/decorations/SpecId.java @@ -0,0 +1,28 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations; + +import com.dat3m.dartagnan.exception.ParsingException; + +import java.util.HashMap; +import java.util.Map; + +public class SpecId implements Decoration { + + private final Map mapping = new HashMap<>(); + + @Override + public void addDecoration(String id, String... params) { + if (params.length != 1) { + throw new ParsingException("Illegal decoration '%s' for '%s'", + getClass().getSimpleName(), id); + } + if (mapping.containsKey(id)) { + throw new ParsingException("Duplicated decoration '%s' for '%s'", + getClass().getSimpleName(), id); + } + mapping.put(id, params[0]); + } + + public String getValue(String id) { + return mapping.get(id); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/extenstions/VisitorExtension.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/extenstions/VisitorExtension.java new file mode 100644 index 0000000000..349d2ca5d5 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/extenstions/VisitorExtension.java @@ -0,0 +1,10 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv.extenstions; + +import com.dat3m.dartagnan.parsers.SpirvBaseVisitor; + +import java.util.Set; + +public abstract class VisitorExtension extends SpirvBaseVisitor { + + public abstract Set getSupportedInstructions(); +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/extenstions/VisitorExtensionClspvReflection.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/extenstions/VisitorExtensionClspvReflection.java new file mode 100644 index 0000000000..f08a39da6d --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/extenstions/VisitorExtensionClspvReflection.java @@ -0,0 +1,201 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv.extenstions; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.Type; +import com.dat3m.dartagnan.expression.integers.IntLiteral; +import com.dat3m.dartagnan.expression.type.AggregateType; +import com.dat3m.dartagnan.expression.type.ArrayType; +import com.dat3m.dartagnan.expression.type.IntegerType; +import com.dat3m.dartagnan.expression.type.TypeFactory; +import com.dat3m.dartagnan.parsers.SpirvParser; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.builders.ProgramBuilder; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.utils.ThreadGrid; +import com.dat3m.dartagnan.program.memory.ScopedPointerVariable; +import com.dat3m.dartagnan.program.event.Tag; + +import java.util.List; +import java.util.Set; + +public class VisitorExtensionClspvReflection extends VisitorExtension { + + private static final TypeFactory types = TypeFactory.getInstance(); + private static final ExpressionFactory expressions = ExpressionFactory.getInstance(); + + private final ProgramBuilder builder; + private ScopedPointerVariable pushConstant; + private AggregateType pushConstantType; + private int pushConstantIndex = 0; + private int pushConstantOffset = 0; + + public VisitorExtensionClspvReflection(ProgramBuilder builder) { + this.builder = builder; + } + + @Override + public Void visitKernel(SpirvParser.KernelContext ctx) { + // Do nothing, kernel name and the number of arguments + return null; + } + + @Override + public Void visitArgumentInfo(SpirvParser.ArgumentInfoContext ctx) { + // Do nothing, variable name in OpenCL + return null; + } + + @Override + public Void visitArgumentStorageBuffer(SpirvParser.ArgumentStorageBufferContext ctx) { + // Do nothing, variable index in OpenCL and Spir-V and descriptor set + return null; + } + + @Override + public Void visitArgumentWorkgroup(SpirvParser.ArgumentWorkgroupContext ctx) { + // Do nothing, default size of workgroup buffer defined in spec constant + return null; + } + + @Override + public Void visitSpecConstantWorkgroupSize(SpirvParser.SpecConstantWorkgroupSizeContext ctx) { + // Do nothing, will be overwritten by BuiltIn WorkgroupSize + return null; + } + + @Override + public Void visitPushConstantGlobalOffset(SpirvParser.PushConstantGlobalOffsetContext ctx) { + return setPushConstantValue("PushConstantGlobalOffset", ctx.sizeIdRef().getText()); + } + + @Override + public Void visitPushConstantGlobalSize(SpirvParser.PushConstantGlobalSizeContext ctx) { + return setPushConstantValue("PushConstantGlobalSize", ctx.sizeIdRef().getText()); + } + + @Override + public Void visitPushConstantEnqueuedLocalSize(SpirvParser.PushConstantEnqueuedLocalSizeContext ctx) { + return setPushConstantValue("PushConstantEnqueuedLocalSize", ctx.sizeIdRef().getText()); + } + + @Override + public Void visitPushConstantNumWorkgroups(SpirvParser.PushConstantNumWorkgroupsContext ctx) { + return setPushConstantValue("PushConstantNumWorkgroups", ctx.sizeIdRef().getText()); + } + + @Override + public Void visitPushConstantRegionOffset(SpirvParser.PushConstantRegionOffsetContext ctx) { + return setPushConstantValue("PushConstantRegionOffset", ctx.sizeIdRef().getText()); + } + + @Override + public Void visitPushConstantRegionGroupOffset(SpirvParser.PushConstantRegionGroupOffsetContext ctx) { + return setPushConstantValue("PushConstantRegionGroupOffset", ctx.sizeIdRef().getText()); + } + + @Override + public Void visitArgumentPodPushConstant(SpirvParser.ArgumentPodPushConstantContext ctx) { + initPushConstant(); + if (pushConstantIndex >= pushConstantType.getDirectFields().size()) { + throw new ParsingException("Out of bounds definition 'ArgumentPodPushConstant' in PushConstant '%s'", + pushConstant.getId()); + } + Type type = pushConstantType.getDirectFields().get(pushConstantIndex); + int typeSize = types.getMemorySizeInBytes(type); + if (typeSize != getExpressionAsConstInteger(ctx.sizeIdRef().getText())) { + throw new ParsingException("Unexpected offset in PushConstant '%s' element '%s'", + pushConstant.getId(), pushConstantIndex); + } + pushConstantOffset += typeSize; + pushConstantIndex++; + return null; + } + + private Void setPushConstantValue(String decorationId, String sizeId) { + initPushConstant(); + if (pushConstantIndex >= pushConstantType.getDirectFields().size()) { + throw new ParsingException("Out of bounds definition '%s' in PushConstant '%s'", + decorationId, pushConstant.getId()); + } + Type type = pushConstantType.getDirectFields().get(pushConstantIndex); + int typeSize = types.getMemorySizeInBytes(type); + int expectedSize = getExpressionAsConstInteger(sizeId); + if (type instanceof ArrayType aType && aType.getNumElements() == 3 && typeSize == expectedSize) { + Type elType = aType.getElementType(); + if (elType instanceof IntegerType iType) { + List values = computePushConstantValue(decorationId); + int localOffset = 0; + for (int value : values) { + Expression elExpr = expressions.makeValue(value, iType); + pushConstant.setInitialValue(pushConstantOffset + localOffset, elExpr); + localOffset += types.getMemorySizeInBytes(elExpr.getType()); + } + pushConstantOffset += localOffset; + pushConstantIndex++; + return null; + } + } + throw new ParsingException("Unexpected element type in '%s' at index %s", + pushConstant.getId(), pushConstantIndex); + } + + private List computePushConstantValue(String command) { + ThreadGrid grid = builder.getThreadGrid(); + return switch (command) { + case "PushConstantGlobalSize" -> List.of(grid.dvSize(), 1, 1); + case "PushConstantEnqueuedLocalSize" -> List.of(grid.wgSize(), 1, 1); + case "PushConstantNumWorkgroups" -> List.of(grid.qfSize() / grid.wgSize(), 1, 1); + case "PushConstantGlobalOffset", + "PushConstantRegionOffset", + "PushConstantRegionGroupOffset" + -> List.of(0, 0, 0); + default -> throw new ParsingException("Unsupported PushConstant command '%s'", command); + }; + } + + // TODO: Better way to identify PushConstant using kernel and arg info methods + private void initPushConstant() { + if (pushConstant == null) { + List variables = builder.getVariables().stream() + .filter(v -> Tag.Spirv.SC_PUSH_CONSTANT.equals(v.getScopeId())) + .toList(); + if (variables.size() == 1) { + pushConstant = variables.get(0); + Type type = pushConstant.getInnerType(); + if (type instanceof AggregateType agType) { + pushConstantType = agType; + return; + } + throw new ParsingException("Unexpected type '%s' for PushConstant '%s'", + type, pushConstant.getId()); + } + throw new ParsingException("Cannot identify PushConstant referenced by CLSPV extension"); + } + } + + private int getExpressionAsConstInteger(String id) { + Expression expression = builder.getExpression(id); + if (expression instanceof IntLiteral iExpr) { + return iExpr.getValueAsInt(); + } + throw new ParsingException("Expression '%s' is not an integer constant", id); + } + + @Override + public Set getSupportedInstructions() { + return Set.of( + "Kernel", + "ArgumentInfo", + "ArgumentStorageBuffer", + "ArgumentWorkgroup", + "ArgumentPodPushConstant", + "PushConstantGlobalOffset", + "PushConstantGlobalSize", + "PushConstantEnqueuedLocalSize", + "PushConstantNumWorkgroups", + "PushConstantRegionOffset", + "PushConstantRegionGroupOffset", + "SpecConstantWorkgroupSize" + ); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/helpers/HelperInputs.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/helpers/HelperInputs.java new file mode 100644 index 0000000000..dc01fc65e0 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/helpers/HelperInputs.java @@ -0,0 +1,91 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv.helpers; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.Type; +import com.dat3m.dartagnan.expression.integers.IntLiteral; +import com.dat3m.dartagnan.expression.misc.ConstructExpr; +import com.dat3m.dartagnan.expression.type.*; + +import java.util.ArrayList; +import java.util.List; + +public class HelperInputs { + + private static final TypeFactory types = TypeFactory.getInstance(); + private static final ExpressionFactory expressions = ExpressionFactory.getInstance(); + + private HelperInputs(){ + } + + public static Expression castInput(String id, Type type, Expression value) { + if (type instanceof ArrayType aType) { + return castArray(id, aType, value); + } + if (type instanceof AggregateType aType) { + return castAggregate(id, aType, value); + } + return castScalar(id, type, value); + } + + private static Expression castArray(String id, ArrayType type, Expression value) { + if (value instanceof ConstructExpr aValue) { + int expectedSize = type.getNumElements(); + int actualSize = aValue.getOperands().size(); + if (expectedSize != -1 && expectedSize != actualSize) { + throw new ParsingException(errorMismatchingElementCount(id, expectedSize, actualSize)); + } + Type elementType = type.getElementType(); + List elements = new ArrayList<>(); + for (int i = 0; i < actualSize; i++) { + elements.add(castInput(String.format("%s[%d]", id, i), elementType, aValue.getOperands().get(i))); + } + return expressions.makeArray(elements.get(0).getType(), elements, true); + } + throw new ParsingException(errorMismatchingType(id, type, value.getType())); + } + + private static Expression castAggregate(String id, AggregateType type, Expression value) { + if (value instanceof ConstructExpr aValue) { + int expectedSize = type.getDirectFields().size(); + int actualSize = aValue.getOperands().size(); + if (expectedSize != actualSize) { + throw new ParsingException(errorMismatchingElementCount(id, expectedSize, actualSize)); + } + List elements = new ArrayList<>(); + for (int i = 0; i < actualSize; i++) { + elements.add(castInput(id, type.getDirectFields().get(i), aValue.getOperands().get(i))); + } + return expressions.makeConstruct(elements); + } + throw new ParsingException(errorMismatchingType(id, type, value.getType())); + } + + private static Expression castScalar(String id, Type type, Expression value) { + if (value.getType().equals(types.getArchType())) { + if (value instanceof IntLiteral iConst) { + int iValue = iConst.getValueAsInt(); + if (type instanceof BooleanType) { + return iValue == 0 ? expressions.makeFalse() : expressions.makeTrue(); + } + if (type instanceof IntegerType iType) { + return expressions.makeValue(iValue, iType); + } + throw new ParsingException("Unexpected element type '%s' for variable '%s'", type, id); + } + throw new ParsingException("Illegal input for variable '%s', the value is not constant", id); + } + throw new ParsingException(errorMismatchingType(id, type, value.getType())); + } + + private static String errorMismatchingType(String id, Type expected, Type actual) { + return String.format("Mismatching value type for variable '%s', " + + "expected '%s' but received '%s'", id, expected, actual); + } + + private static String errorMismatchingElementCount(String id, int expected, int actual) { + return String.format("Unexpected number of elements in variable '%s', " + + "expected %d but received %d", id, expected, actual); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/helpers/HelperTags.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/helpers/HelperTags.java new file mode 100644 index 0000000000..86859ea2ca --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/helpers/HelperTags.java @@ -0,0 +1,107 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv.helpers; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.integers.IntLiteral; +import com.google.common.collect.Sets; + +import java.util.*; + +import static com.dat3m.dartagnan.program.event.Tag.Spirv.*; + +public class HelperTags { + private static final List scopes = mkScopesList(); + private static final Map semantics = mkSemanticsMap(); + + private HelperTags() { + } + + public static Set parseMemorySemanticsTags(String id, Expression expr) { + int value = getIntValue(id, expr); + Set tags = new HashSet<>(); + for (int i = 1; i <= value; i <<= 1) { + if ((i & value) > 0) { + if (!semantics.containsKey(i)) { + throw new ParsingException("Unexpected memory semantics bits"); + } + tags.add(semantics.get(i)); + } + } + int moSize = Sets.intersection(moTags, tags).size(); + if (moSize > 1) { + throw new ParsingException("Selected multiple non-relaxed memory order bits"); + } + if (moSize == 0) { + tags.add(RELAXED); + } + return tags; + } + + public static String parseScope(String id, Expression expr) { + int value = getIntValue(id, expr); + if (value >= 0 && value < scopes.size()) { + return scopes.get(value); + } + throw new ParsingException("Illegal scope value %d", value); + } + + public static String parseStorageClass(String cls) { + return switch (cls) { + case "UniformConstant" -> SC_UNIFORM_CONSTANT; + case "Input" -> SC_INPUT; + case "Uniform" -> SC_UNIFORM; + case "Output" -> SC_OUTPUT; + case "Workgroup" -> SC_WORKGROUP; + case "CrossWorkgroup" -> SC_CROSS_WORKGROUP; + case "Private" -> SC_PRIVATE; + case "Function" -> SC_FUNCTION; + case "Generic" -> SC_GENERIC; + case "PushConstant" -> SC_PUSH_CONSTANT; + case "StorageBuffer" -> SC_STORAGE_BUFFER; + case "PhysicalStorageBuffer" -> SC_PHYS_STORAGE_BUFFER; + default -> throw new ParsingException("Unsupported storage class '%s'", cls); + }; + } + + private static int getIntValue(String id, Expression expr) { + if (expr instanceof IntLiteral iValue) { + try { + return iValue.getValue().intValue(); + } catch (IllegalArgumentException e) { + throw new ParsingException("Illegal tag value at %s. %s", id, e.getMessage()); + } + } + throw new ParsingException("Non-constant tags are not supported. " + + "Found non-constant tag at '%s'", id); + } + + private static List mkScopesList() { + return List.of( + CROSS_DEVICE, + DEVICE, + WORKGROUP, + SUBGROUP, + INVOCATION, + QUEUE_FAMILY, + SHADER_CALL); + } + + private static Map mkSemanticsMap() { + Map map = new HashMap<>(); + map.put(0x2, ACQUIRE); + map.put(0x4, RELEASE); + map.put(0x8, ACQ_REL); + map.put(0x10, SEQ_CST); + map.put(0x40, SEM_UNIFORM); + map.put(0x80, SEM_SUBGROUP); + map.put(0x100, SEM_WORKGROUP); + map.put(0x200, SEM_CROSS_WORKGROUP); + map.put(0x400, SEM_ATOMIC_COUNTER); + map.put(0x800, SEM_IMAGE); + map.put(0x1000, SEM_OUTPUT); + map.put(0x2000, SEM_AVAILABLE); + map.put(0x4000, SEM_VISIBLE); + map.put(0x8000, SEM_VOLATILE); + return map; + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/helpers/HelperTypes.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/helpers/HelperTypes.java new file mode 100644 index 0000000000..1d278b69df --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/helpers/HelperTypes.java @@ -0,0 +1,157 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv.helpers; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.Type; +import com.dat3m.dartagnan.expression.integers.IntLiteral; +import com.dat3m.dartagnan.expression.type.AggregateType; +import com.dat3m.dartagnan.expression.type.ArrayType; +import com.dat3m.dartagnan.expression.type.IntegerType; +import com.dat3m.dartagnan.expression.type.TypeFactory; + +import java.util.List; + +import static com.dat3m.dartagnan.expression.integers.IntBinaryOp.ADD; +import static com.dat3m.dartagnan.expression.integers.IntBinaryOp.MUL; + +public class HelperTypes { + + private static final TypeFactory types = TypeFactory.getInstance(); + private static final ExpressionFactory expressions = ExpressionFactory.getInstance(); + private static final IntegerType archType = types.getArchType(); + + private HelperTypes() { + } + + public static Type getMemberType(String id, Type type, List indexes) { + if (!indexes.isEmpty()) { + id += "[" + indexes.get(0) + "]"; + if (type instanceof ArrayType aType) { + return getArrayMemberType(id, aType, indexes); + } + if (type instanceof AggregateType aType) { + return getStructMemberType(id, aType, indexes); + } + throw new ParsingException(indexTooDeepError(id)); + } + return type; + } + + public static int getMemberOffset(String id, int offset, Type type, List indexes) { + if (!indexes.isEmpty()) { + id += "[" + indexes.get(0) + "]"; + if (type instanceof ArrayType aType) { + return getArrayMemberOffset(id, offset, aType, indexes); + } + if (type instanceof AggregateType aType) { + return getStructMemberOffset(id, offset, aType, indexes); + } + throw new ParsingException(indexTooDeepError(id)); + } + return offset; + } + + public static Expression getMemberAddress(String id, Expression base, Type type, List indexes) { + if (!indexes.isEmpty()) { + id += "[" + indexes.get(0) + "]"; + if (type instanceof ArrayType aType) { + return getArrayMemberAddress(id, base, aType, indexes); + } + if (type instanceof AggregateType aType) { + return getStructMemberAddress(id, base, aType, indexes); + } + throw new ParsingException(indexTooDeepError(id)); + } + return base; + } + + private static Type getArrayMemberType(String id, ArrayType type, List indexes) { + int index = indexes.get(0); + if (!type.hasKnownNumElements() || index < type.getNumElements()) { + return getMemberType(id, type.getElementType(), indexes.subList(1, indexes.size())); + } + throw new ParsingException(indexOutOfBoundsError(id)); + } + + private static Type getStructMemberType(String id, AggregateType type, List indexes) { + int index = indexes.get(0); + if (index >= 0) { + if (index < type.getDirectFields().size()) { + return getMemberType(id, type.getDirectFields().get(index), indexes.subList(1, indexes.size())); + } + throw new ParsingException(indexOutOfBoundsError(id)); + } + throw new ParsingException(indexNonConstantForStructError(id)); + } + + private static int getArrayMemberOffset(String id, int offset, ArrayType type, List indexes) { + int index = indexes.get(0); + if (index >= 0) { + if (type.getNumElements() < 0 || index < type.getNumElements()) { + Type elType = type.getElementType(); + offset += types.getOffsetInBytes(type, index); + return getMemberOffset(id, offset, elType, indexes.subList(1, indexes.size())); + } + throw new ParsingException(indexOutOfBoundsError(id)); + } + throw new ParsingException(indexNonConstantError(id)); + } + + private static int getStructMemberOffset(String id, int offset, AggregateType type, List indexes) { + int index = indexes.get(0); + if (index >= 0) { + if (index < type.getDirectFields().size()) { + offset += types.getOffsetInBytes(type, index); + Type elType = type.getDirectFields().get(index); + return getMemberOffset(id, offset, elType, indexes.subList(1, indexes.size())); + } + throw new ParsingException(indexOutOfBoundsError(id)); + } + throw new ParsingException(indexNonConstantError(id)); + } + + private static Expression getArrayMemberAddress(String id, Expression base, ArrayType type, List indexes) { + Type elementType = type.getElementType(); + int size = types.getMemorySizeInBytes(elementType); + IntLiteral sizeExpr = expressions.makeValue(size, archType); + Expression indexExpr = expressions.makeIntegerCast(indexes.get(0), archType, false); + Expression offsetExpr = expressions.makeBinary(sizeExpr, MUL, indexExpr); + Expression expression = expressions.makeBinary(base, ADD, offsetExpr); + return getMemberAddress(id, expression, elementType, indexes.subList(1, indexes.size())); + } + + private static Expression getStructMemberAddress(String id, Expression base, AggregateType type, List indexes) { + Expression indexExpr = indexes.get(0); + if (indexExpr instanceof IntLiteral intLiteral) { + int index = intLiteral.getValueAsInt(); + if (index < type.getDirectFields().size()) { + int offset = 0; + for (int i = 0; i < index; i++) { + offset += types.getMemorySizeInBytes(type.getDirectFields().get(i)); + } + IntLiteral offsetExpr = expressions.makeValue(offset, archType); + Expression expression = expressions.makeBinary(base, ADD, offsetExpr); + return getMemberAddress(id, expression, type.getDirectFields().get(index), indexes.subList(1, indexes.size())); + } + throw new ParsingException(indexOutOfBoundsError(id)); + } + throw new ParsingException(indexNonConstantForStructError(id)); + } + + private static String indexTooDeepError(String id) { + return String.format("Index is too deep for variable '%s'", id); + } + + private static String indexOutOfBoundsError(String id) { + return String.format("Index is out of bounds for variable '%s'", id); + } + + private static String indexNonConstantError(String id) { + return String.format("Index is non-constant for variable '%s'", id); + } + + private static String indexNonConstantForStructError(String id) { + return String.format("Index of a struct member is non-constant for variable '%s'", id); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/utils/MemoryTransformer.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/utils/MemoryTransformer.java new file mode 100644 index 0000000000..16b4062580 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/utils/MemoryTransformer.java @@ -0,0 +1,128 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv.utils; + +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.processing.ExprTransformer; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations.BuiltIn; +import com.dat3m.dartagnan.program.Function; +import com.dat3m.dartagnan.program.Program; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.Thread; +import com.dat3m.dartagnan.program.event.Tag; +import com.dat3m.dartagnan.program.memory.MemoryObject; +import com.dat3m.dartagnan.program.memory.ScopedPointerVariable; +import com.dat3m.dartagnan.program.memory.VirtualMemoryObject; +import com.dat3m.dartagnan.program.misc.NonDetValue; + +import java.util.*; +import java.util.function.IntUnaryOperator; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static java.util.stream.Collectors.toMap; + +public class MemoryTransformer extends ExprTransformer { + + // Thread / Subgroup / Workgroup / QueueFamily / Device + private static final List namePrefixes = List.of("T", "S", "W", "Q", "D"); + + private final Function function; + private final BuiltIn builtIn; + private final List> scopeMapping; + private final Map pointerMapping; + private final List scopeIdProvider; + private final List namePrefixIdxProvider; + private Map registerMapping; + private int tid; + + public MemoryTransformer(ThreadGrid grid, Function function, BuiltIn builtIn, Set variables) { + this.function = function; + this.builtIn = builtIn; + this.scopeMapping = Stream.generate(() -> new HashMap()).limit(namePrefixes.size()).toList(); + this.pointerMapping = variables.stream().collect(Collectors.toMap((ScopedPointerVariable::getAddress), (v -> v))); + this.scopeIdProvider = List.of(grid::thId, grid::sgId, grid::wgId, grid::qfId, grid::dvId); + this.namePrefixIdxProvider = List.of( + i -> i, + i -> i / grid.sgSize(), + i -> i / grid.wgSize(), + i -> i / grid.qfSize(), + i -> i / grid.dvSize()); + } + + public Register getRegisterMapping(Register register) { + return registerMapping.get(register); + } + + public void setThread(Thread thread) { + int newTid = thread.getId(); + int depth = getScopeIdx(newTid, scopeIdProvider); + for (int i = 0; i <= depth; i++) { + scopeMapping.get(i).clear(); + } + tid = newTid; + builtIn.setThreadId(tid); + registerMapping = function.getRegisters().stream().collect( + toMap(r -> r, r -> thread.getOrNewRegister(r.getName(), r.getType()))); + } + + @Override + public Expression visitRegister(Register register) { + return registerMapping.get(register); + } + + @Override + public Expression visitMemoryObject(MemoryObject memObj) { + String storageClass = pointerMapping.get(memObj).getScopeId(); + return switch (storageClass) { + // Device-level memory (keep the same instance) + case Tag.Spirv.SC_UNIFORM_CONSTANT, + Tag.Spirv.SC_UNIFORM, + Tag.Spirv.SC_OUTPUT, + Tag.Spirv.SC_PUSH_CONSTANT, + Tag.Spirv.SC_STORAGE_BUFFER, + Tag.Spirv.SC_PHYS_STORAGE_BUFFER -> memObj; + // Private memory (copy for each new thread) + case Tag.Spirv.SC_PRIVATE, + Tag.Spirv.SC_FUNCTION, + Tag.Spirv.SC_INPUT -> applyMapping(memObj, 0); + // Workgroup-level memory (copy for each new workgroup) + case Tag.Spirv.SC_WORKGROUP -> applyMapping(memObj, 2); + default -> throw new UnsupportedOperationException( + "Unsupported storage class " + storageClass); + }; + } + + private Expression applyMapping(MemoryObject memObj, int scopeDepth) { + Program program = function.getProgram(); + Map mapping = scopeMapping.get(scopeDepth); + if (!mapping.containsKey(memObj)) { + MemoryObject copy = memObj instanceof VirtualMemoryObject + ? program.getMemory().allocateVirtual(memObj.size(), true, null) + : program.getMemory().allocate(memObj.size()); + copy.setName(makeVariableName(scopeDepth, memObj.getName())); + for (int offset : memObj.getInitializedFields()) { + Expression value = memObj.getInitialValue(offset); + if (value instanceof NonDetValue) { + value = program.newConstant(value.getType()); + } + copy.setInitialValue(offset, value); + } + builtIn.decorate(memObj.getName(), copy, pointerMapping.get(memObj).getInnerType()); + mapping.put(memObj, copy); + } + return mapping.getOrDefault(memObj, memObj); + } + + private int getScopeIdx(int newTid, List f) { + for (int i = f.size() - 1; i >= 0; i--) { + if (f.get(i).applyAsInt(newTid) != f.get(i).applyAsInt(tid)) { + return i; + } + } + return -1; + } + + private String makeVariableName(int idx, String base) { + return String.format("%s@%s%s", base, namePrefixes.get(idx), + namePrefixIdxProvider.get(idx).applyAsInt(tid)); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/utils/ThreadCreator.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/utils/ThreadCreator.java new file mode 100644 index 0000000000..789acfdade --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/utils/ThreadCreator.java @@ -0,0 +1,89 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv.utils; + +import com.dat3m.dartagnan.expression.type.FunctionType; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations.BuiltIn; +import com.dat3m.dartagnan.program.*; +import com.dat3m.dartagnan.program.Thread; +import com.dat3m.dartagnan.program.event.*; +import com.dat3m.dartagnan.program.event.core.Label; +import com.dat3m.dartagnan.program.event.core.threading.ThreadStart; +import com.dat3m.dartagnan.program.event.functions.Return; +import com.dat3m.dartagnan.program.memory.Memory; +import com.dat3m.dartagnan.program.memory.ScopedPointerVariable; +import com.google.common.collect.Lists; + +import java.util.*; + +public class ThreadCreator { + + private final ThreadGrid grid; + private final Function function; + private final Set variables; + private final MemoryTransformer transformer; + + public ThreadCreator(ThreadGrid grid, Function function, Set variables, BuiltIn builtIn) { + this.grid = grid; + this.function = function; + this.variables = variables; + this.transformer = new MemoryTransformer(grid, function, builtIn, variables); + } + + public void create() { + Program program = function.getProgram(); + for (int i = 0; i < grid.dvSize(); i++) { + program.addThread(createThreadFromFunction(i)); + } + deleteLocalFunctionVariables(); + } + + private Thread createThreadFromFunction(int tid) { + String name = function.getName(); + FunctionType type = function.getFunctionType(); + List args = Lists.transform(function.getParameterRegisters(), Register::getName); + ThreadStart start = EventFactory.newThreadStart(null); + ScopeHierarchy scope = grid.getScoreHierarchy(tid); + Thread thread = new Thread(name, type, args, tid, start, scope, Set.of()); + thread.copyDummyCountFrom(function); + copyThreadEvents(thread); + transformReturnEvents(thread); + return thread; + } + + private void copyThreadEvents(Thread thread) { + List body = new ArrayList<>(); + Map eventCopyMap = new HashMap<>(); + function.getEvents().forEach(e -> body.add(eventCopyMap.computeIfAbsent(e, Event::getCopy))); + transformer.setThread(thread); + for (Event copy : body) { + if (copy instanceof EventUser user) { + user.updateReferences(eventCopyMap); + } + if (copy instanceof RegReader reader) { + reader.transformExpressions(transformer); + } + if (copy instanceof RegWriter regWriter) { + regWriter.setResultRegister(transformer.getRegisterMapping(regWriter.getResultRegister())); + } + } + thread.getEntry().insertAfter(body); + } + + private void transformReturnEvents(Thread thread) { + Label returnLabel = EventFactory.newLabel("RETURN_OF_T" + thread.getId()); + Label endLabel = EventFactory.newLabel("END_OF_T" + thread.getId()); + for (Return event : thread.getEvents(Return.class)) { + event.replaceBy(EventFactory.newGoto(returnLabel)); + } + thread.append(returnLabel); + thread.append(endLabel); + } + + private void deleteLocalFunctionVariables() { + Memory memory = function.getProgram().getMemory(); + variables.forEach(v -> { + if (v.getAddress().isThreadLocal()) { + memory.deleteMemoryObject(v.getAddress()); + } + }); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/utils/ThreadGrid.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/utils/ThreadGrid.java new file mode 100644 index 0000000000..3b947397b1 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/utils/ThreadGrid.java @@ -0,0 +1,66 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv.utils; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.program.ScopeHierarchy; + +import java.util.List; + +public class ThreadGrid { + + private final int sg; + private final int wg; + private final int qf; + private final int dv; + + public ThreadGrid(int sg, int wg, int qf, int dv) { + List elements = List.of(sg, wg, qf, dv); + if (elements.stream().anyMatch(i -> i <= 0)) { + throw new ParsingException("Thread grid dimensions must be positive"); + } + this.sg = sg; + this.wg = wg; + this.qf = qf; + this.dv = dv; + } + + public int sgSize() { + return sg; + } + + public int wgSize() { + return sg * wg; + } + + public int qfSize() { + return sg * wg * qf; + } + + public int dvSize() { + return sg * wg * qf * dv; + } + + public int thId(int tid) { + return tid % sgSize(); + } + + public int sgId(int tid) { + return (tid % wgSize()) / sgSize(); + } + + public int wgId(int tid) { + return (tid % qfSize()) / wgSize(); + } + + public int qfId(int tid) { + return (tid % dvSize()) / qfSize(); + } + + public int dvId(int tid) { + return tid / dvSize(); + } + + public ScopeHierarchy getScoreHierarchy(int tid) { + return ScopeHierarchy.ScopeHierarchyForVulkan(qfId(tid), wgId(tid), sgId(tid)); + + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/ScopeHierarchy.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/ScopeHierarchy.java index 28b0450fa0..3bffa27557 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/ScopeHierarchy.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/ScopeHierarchy.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; public class ScopeHierarchy{ @@ -31,7 +32,7 @@ public static ScopeHierarchy ScopeHierarchyForPTX(int gpu, int cta) { return scopeHierarchy; } - public ArrayList getScopes() { + public List getScopes() { return new ArrayList<>(scopeIds.keySet()); } @@ -45,7 +46,7 @@ public boolean canSyncAtScope(ScopeHierarchy other, String scope) { return false; } - ArrayList scopes = this.getScopes(); + List scopes = this.getScopes(); int validIndex = scopes.indexOf(scope); // scopes(0) is highest in hierarchy // i = 0 is global, every thread will always have the same id, so start from i = 1 diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/BranchEquivalence.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/BranchEquivalence.java index 8573199219..52fa863365 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/BranchEquivalence.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/analysis/BranchEquivalence.java @@ -5,6 +5,7 @@ import com.dat3m.dartagnan.program.Thread; import com.dat3m.dartagnan.program.event.Event; import com.dat3m.dartagnan.program.event.core.CondJump; +import com.dat3m.dartagnan.program.event.core.ControlBarrier; import com.dat3m.dartagnan.program.event.core.Label; import com.dat3m.dartagnan.program.event.core.threading.ThreadStart; import com.dat3m.dartagnan.utils.dependable.DependencyGraph; @@ -143,6 +144,11 @@ private Branch computeBranchDecomposition(Event root, Map event2B b2.parents.add(branch); return branch; } + } else if (succ instanceof ControlBarrier barrier) { + final Branch succBranch = computeBranchDecomposition(barrier.getSuccessor(), event2BranchMap, branches); + branch.children.add(succBranch); + succBranch.parents.add(branch); + return branch; } else { // No branching happened, thus we stay on the current branch succ = succ.getSuccessor(); @@ -265,10 +271,12 @@ private void computeMustSuccSet(Branch b) { Set commonSucc = null; for (Branch br : b.children) { computeMustSuccSet(br); - if (commonSucc == null) { - commonSucc = new HashSet<>(br.mustSucc); - } else { - commonSucc.retainAll(br.mustSucc); + if (!isEndingWithControlBarrier(b)) { + if (commonSucc == null) { + commonSucc = new HashSet<>(br.mustSucc); + } else { + commonSucc.retainAll(br.mustSucc); + } } } if (commonSucc != null) { @@ -277,6 +285,14 @@ private void computeMustSuccSet(Branch b) { b.mustSuccComputed = true; } + private boolean isEndingWithControlBarrier(Branch branch) { + if (!branch.events.isEmpty()) { + int last = branch.events.size() - 1; + return branch.events.get(last) instanceof ControlBarrier; + } + return false; + } + //========================== Equivalence class computations ========================= private void createBranchClasses(BranchDecomposition decomposition) { diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/EventFactory.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/EventFactory.java index 6ecd0954dc..cc796e6417 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/EventFactory.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/EventFactory.java @@ -5,6 +5,7 @@ import com.dat3m.dartagnan.expression.Type; import com.dat3m.dartagnan.expression.booleans.BoolLiteral; import com.dat3m.dartagnan.expression.integers.IntBinaryOp; +import com.dat3m.dartagnan.expression.integers.IntCmpOp; import com.dat3m.dartagnan.expression.type.FunctionType; import com.dat3m.dartagnan.expression.type.IntegerType; import com.dat3m.dartagnan.expression.type.TypeFactory; @@ -16,7 +17,9 @@ import com.dat3m.dartagnan.program.event.arch.ptx.PTXAtomOp; import com.dat3m.dartagnan.program.event.arch.ptx.PTXRedOp; import com.dat3m.dartagnan.program.event.arch.tso.TSOXchg; +import com.dat3m.dartagnan.program.event.arch.vulkan.VulkanCmpXchg; import com.dat3m.dartagnan.program.event.arch.vulkan.VulkanRMW; +import com.dat3m.dartagnan.program.event.arch.vulkan.VulkanRMWExtremum; import com.dat3m.dartagnan.program.event.arch.vulkan.VulkanRMWOp; import com.dat3m.dartagnan.program.event.core.*; import com.dat3m.dartagnan.program.event.core.annotations.FunCallMarker; @@ -35,6 +38,7 @@ import com.dat3m.dartagnan.program.event.lang.pthread.InitLock; import com.dat3m.dartagnan.program.event.lang.pthread.Lock; import com.dat3m.dartagnan.program.event.lang.pthread.Unlock; +import com.dat3m.dartagnan.program.event.lang.spirv.*; import com.dat3m.dartagnan.program.event.lang.svcomp.*; import com.dat3m.dartagnan.program.memory.MemoryObject; @@ -122,8 +126,8 @@ public static GenericVisibleEvent newFenceOpt(String name, String opt) { return fence; } - public static FenceWithId newFenceWithId(String name, Expression fenceId) { - return new FenceWithId(name, fenceId); + public static ControlBarrier newControlBarrier(String name, Expression fenceId) { + return new ControlBarrier(name, fenceId); } public static Init newInit(MemoryObject base, int offset) { @@ -748,6 +752,54 @@ public static VulkanRMWOp newRMWOp(Expression address, Register register, Expres IntBinaryOp op, String mo, String scope) { return new VulkanRMWOp(register, address, op, value, mo, scope); } + + public static VulkanRMWExtremum newRMWExtremum(Expression address, Register register, IntCmpOp op, + Expression value, String mo, String scope) { + return new VulkanRMWExtremum(register, address, op, value, mo, scope); + } + + public static VulkanCmpXchg newVulkanCmpXchg(Expression address, Register register, Expression expected, + Expression value, String mo, String scope) { + return new VulkanCmpXchg(register, address, expected, value, mo, scope); + } + } + + // ============================================================================================= + // =========================================== Spir-V ========================================== + // ============================================================================================= + + public static class Spirv { + private Spirv() {} + + public static SpirvLoad newSpirvLoad(Register register, Expression address, String scope, + Set tags) { + return new SpirvLoad(register, address, scope, tags); + } + + public static SpirvStore newSpirvStore(Expression address, Expression value, String scope, + Set tags) { + return new SpirvStore(address, value, scope, tags); + } + + public static SpirvXchg newSpirvXchg(Register register, Expression address, Expression value, + String scope, Set tags) { + return new SpirvXchg(register, address, value, scope, tags); + } + + public static SpirvRmw newSpirvRmw(Register register, Expression address, IntBinaryOp op, Expression value, + String scope, Set tags) { + return new SpirvRmw(register, address, op, value, scope, tags); + } + + public static SpirvCmpXchg newSpirvCmpXchg(Register register, Expression address, Expression cmp, Expression value, + String scope, Set eqTags, Set neqTags) { + return new SpirvCmpXchg(register, address, cmp, value, scope, eqTags, neqTags); + } + + public static SpirvRmwExtremum newSpirvRmwExtremum(Register register, Expression address, IntCmpOp op, Expression value, + String scope, Set tags) { + return new SpirvRmwExtremum(register, address, op, value, scope, tags); + } } } \ No newline at end of file diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/EventVisitor.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/EventVisitor.java index aa5e50273d..698fd8c12b 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/EventVisitor.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/EventVisitor.java @@ -6,7 +6,9 @@ import com.dat3m.dartagnan.program.event.arch.ptx.PTXAtomOp; import com.dat3m.dartagnan.program.event.arch.ptx.PTXRedOp; import com.dat3m.dartagnan.program.event.arch.tso.TSOXchg; +import com.dat3m.dartagnan.program.event.arch.vulkan.VulkanCmpXchg; import com.dat3m.dartagnan.program.event.arch.vulkan.VulkanRMW; +import com.dat3m.dartagnan.program.event.arch.vulkan.VulkanRMWExtremum; import com.dat3m.dartagnan.program.event.arch.vulkan.VulkanRMWOp; import com.dat3m.dartagnan.program.event.core.*; import com.dat3m.dartagnan.program.event.core.annotations.CodeAnnotation; @@ -18,6 +20,7 @@ import com.dat3m.dartagnan.program.event.lang.pthread.Unlock; import com.dat3m.dartagnan.program.event.lang.svcomp.BeginAtomic; import com.dat3m.dartagnan.program.event.lang.svcomp.EndAtomic; +import com.dat3m.dartagnan.program.event.lang.spirv.*; public interface EventVisitor { @@ -97,11 +100,21 @@ public interface EventVisitor { default T visitEndAtomic(EndAtomic e) { return visitEvent(e); } // ------------------ GPU Events ------------------ - default T visitFenceWithId(FenceWithId e) { return visitEvent(e); } + default T visitControlBarrier(ControlBarrier e) { return visitEvent(e); } default T visitPtxRedOp(PTXRedOp e) { return visitMemEvent(e); } default T visitPtxAtomOp(PTXAtomOp e) { return visitMemEvent(e); } default T visitPtxAtomCAS(PTXAtomCAS e) { return visitMemEvent(e); } default T visitPtxAtomExch(PTXAtomExch e) { return visitMemEvent(e); } default T visitVulkanRMW(VulkanRMW e) { return visitMemEvent(e); } + default T visitVulkanRMWExtremum(VulkanRMWExtremum e) { return visitMemEvent(e); } default T visitVulkanRMWOp(VulkanRMWOp e) { return visitMemEvent(e); } -} \ No newline at end of file + default T visitVulkanCmpXchg(VulkanCmpXchg e) { return visitMemEvent(e); } + + // ------------------ Spir-V Events ------------------ + default T visitSpirvLoad(SpirvLoad e) { return visitMemEvent(e); } + default T visitSpirvStore(SpirvStore e) { return visitMemEvent(e); } + default T visitSpirvRMW(SpirvRmw e) { return visitMemEvent(e); } + default T visitSpirvXchg(SpirvXchg e) { return visitMemEvent(e); } + default T visitSpirvCmpXchg(SpirvCmpXchg e) { return visitMemEvent(e); } + default T visitSpirvRmwExtremum(SpirvRmwExtremum e) { return visitMemEvent(e); } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/Tag.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/Tag.java index 1de6abe7e7..b4cb282558 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/Tag.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/Tag.java @@ -3,6 +3,7 @@ import com.dat3m.dartagnan.configuration.Arch; import java.util.List; +import java.util.Set; /* Tags can be attached to any event. @@ -198,7 +199,7 @@ public static String storeMO(String mo) { return mo.equals(MO_RELEASE) ? MO_RELEASE : MO_ONCE; } - // NOTE: The order below needs to be in sync with /include/lkmm.h + // NOTE: The order below needs to be in sync with /include/lkmm.h public static String intToMo(int i) { return switch (i) { case 0 -> MO_RELAXED; @@ -363,12 +364,128 @@ public static String storeMO(String mo) { } } + // ============================================================================================= + // ========================================= Spir-V ============================================ + // ============================================================================================= + public static final class Spirv { + // Barriers + public static final String CONTROL = "SPV_CONTROL"; + + // Memory order + public static final String RELAXED = "SPV_RELAXED"; + public static final String ACQUIRE = "SPV_ACQUIRE"; + public static final String RELEASE = "SPV_RELEASE"; + public static final String ACQ_REL = "SPV_ACQ_REL"; + public static final String SEQ_CST = "SPV_SEQ_CST"; + + // Scope + public static final String CROSS_DEVICE = "SPV_CROSS_DEVICE"; + public static final String DEVICE = "SPV_DEVICE"; + public static final String WORKGROUP = "SPV_WORKGROUP"; + public static final String SUBGROUP = "SPV_SUBGROUP"; + public static final String INVOCATION = "SPV_INVOCATION"; + public static final String QUEUE_FAMILY = "SPV_QUEUE_FAMILY"; + public static final String SHADER_CALL = "SPV_SHADER_CALL"; + + // Memory access (non-atomic) + public static final String MEM_VOLATILE = "SPV_MEM_VOLATILE"; + public static final String MEM_NON_TEMPORAL = "SPV_MEM_NON_TEMPORAL"; + public static final String MEM_NON_PRIVATE = "SPV_MEM_NON_PRIVATE"; + public static final String MEM_AVAILABLE = "SPV_MEM_AVAILABLE"; + public static final String MEM_VISIBLE = "SPV_MEM_VISIBLE"; + + // Memory semantics (atomic) + public static final String SEM_AVAILABLE = "SPV_SEM_AVAILABLE"; + public static final String SEM_VISIBLE = "SPV_SEM_VISIBLE"; + public static final String SEM_VOLATILE = "SPV_SEM_VOLATILE"; + + // Memory semantics storage class (atomic) + public static final String SEM_UNIFORM = "SPV_SEM_UNIFORM"; + public static final String SEM_SUBGROUP = "SPV_SEM_SUBGROUP"; + public static final String SEM_WORKGROUP = "SPV_SEM_WORKGROUP"; + public static final String SEM_CROSS_WORKGROUP = "SPV_SEM_CROSS_WORKGROUP"; + public static final String SEM_ATOMIC_COUNTER = "SPV_SEM_ATOMIC_COUNTER"; + public static final String SEM_IMAGE = "SPV_SEM_IMAGE"; + public static final String SEM_OUTPUT = "SPV_SEM_OUTPUT"; + + // Storage class + public static final String SC_UNIFORM_CONSTANT = "SPV_SC_UNIFORM_CONSTANT"; + public static final String SC_INPUT = "SPV_SC_INPUT"; + public static final String SC_UNIFORM = "SPV_SC_UNIFORM"; + public static final String SC_OUTPUT = "SPV_SC_OUTPUT"; + public static final String SC_WORKGROUP = "SPV_SC_WORKGROUP"; + public static final String SC_CROSS_WORKGROUP = "SPV_SC_CROSS_WORKGROUP"; + public static final String SC_PRIVATE = "SPV_SC_PRIVATE"; + public static final String SC_FUNCTION = "SPV_SC_FUNCTION"; + public static final String SC_GENERIC = "SPV_SC_GENERIC"; + public static final String SC_PUSH_CONSTANT = "SPV_SC_PUSH_CONSTANT"; + public static final String SC_STORAGE_BUFFER = "SPV_CS_STORAGE_BUFFER"; + public static final String SC_PHYS_STORAGE_BUFFER = "SPV_CS_PHYS_STORAGE_BUFFER"; + + public static final Set storageClassTags = Set.of( + SC_UNIFORM_CONSTANT, + SC_INPUT, + SC_UNIFORM, + SC_OUTPUT, + SC_WORKGROUP, + SC_CROSS_WORKGROUP, + SC_PRIVATE, + SC_FUNCTION, + SC_GENERIC, + SC_PUSH_CONSTANT, + SC_STORAGE_BUFFER, + SC_PHYS_STORAGE_BUFFER + ); + public static final Set scopeTags = Set.of( + INVOCATION, + SUBGROUP, + WORKGROUP, + DEVICE, + CROSS_DEVICE, + QUEUE_FAMILY, + SHADER_CALL + ); + public static final Set moTags = Set.of( + RELAXED, + ACQUIRE, + RELEASE, + ACQ_REL, + SEQ_CST + ); + + public static boolean isSpirvTag(String tag) { + return tag != null && tag.startsWith("SPV_"); + } + + public static String getStorageClassTag(Set tags) { + return filterOne("storage class", tags, storageClassTags); + } + + public static String getScopeTag(Set tags) { + return filterOne("scope", tags, scopeTags); + } + + public static String getMoTag(Set tags) { + return filterOne("memory order", tags, moTags); + } + + private static String filterOne(String type, Set tags, Set filter) { + List filtered = tags.stream().filter(filter::contains).toList(); + if (filtered.isEmpty()) { + throw new IllegalArgumentException("Cannot find a tag for " + type); + } + if (filtered.size() > 1) { + throw new IllegalArgumentException("Multiple tags for " + type); + } + return filtered.get(0); + } + } + public static String getScopeTag(Event e, Arch arch) { return switch (arch) { case PTX -> PTX.getScopeTags().stream().filter(e::hasTag).findFirst().orElse(""); case VULKAN -> Vulkan.getScopeTags().stream().filter(e::hasTag).findFirst().orElse(""); default -> throw new UnsupportedOperationException("Scope tags not implemented for architecture " + arch); }; - } } \ No newline at end of file diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/TagSet.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/TagSet.java index 745161825e..16f10996ca 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/TagSet.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/TagSet.java @@ -1,5 +1,7 @@ package com.dat3m.dartagnan.program.event; +import com.google.common.base.Preconditions; + import java.util.*; public final class TagSet extends AbstractSet { @@ -8,6 +10,7 @@ public final class TagSet extends AbstractSet { @Override public boolean add(String tag) { + Preconditions.checkNotNull(tag); final int index = Collections.binarySearch(sortedTags, tag); if (index < 0) { sortedTags.add(~index, tag); @@ -26,14 +29,12 @@ public boolean contains(Object o) { @Override public boolean remove(Object o) { - if (!(o instanceof String tag)) { - return false; - } - - final int index = Collections.binarySearch(sortedTags, tag); - if (index >= 0) { - sortedTags.remove(index); - return true; + if (o instanceof String tag) { + final int index = Collections.binarySearch(sortedTags, tag); + if (index >= 0) { + sortedTags.remove(index); + return true; + } } return false; } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/arch/vulkan/VulkanCmpXchg.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/arch/vulkan/VulkanCmpXchg.java new file mode 100644 index 0000000000..7a019e4e1c --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/arch/vulkan/VulkanCmpXchg.java @@ -0,0 +1,35 @@ +package com.dat3m.dartagnan.program.event.arch.vulkan; + +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.EventVisitor; +import com.dat3m.dartagnan.program.event.Tag; +import com.dat3m.dartagnan.program.event.common.RMWCmpXchgBase; + +public class VulkanCmpXchg extends RMWCmpXchgBase { + + public VulkanCmpXchg(Register register, Expression address, Expression expected, Expression value, + String mo, String scope) { + super(register, address, expected, value, true, mo); + this.addTags(Tag.Vulkan.ATOM, scope); + } + + private VulkanCmpXchg(VulkanCmpXchg other) { + super(other); + } + + @Override + public String defaultString() { + return String.format("%s := cmp_xchg[%s](%s, %s, %s)", resultRegister, mo, storeValue, expectedValue, address); + } + + @Override + public VulkanCmpXchg getCopy() { + return new VulkanCmpXchg(this); + } + + @Override + public T accept(EventVisitor visitor) { + return visitor.visitVulkanCmpXchg(this); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/arch/vulkan/VulkanRMWExtremum.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/arch/vulkan/VulkanRMWExtremum.java new file mode 100644 index 0000000000..0a6106cc51 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/arch/vulkan/VulkanRMWExtremum.java @@ -0,0 +1,43 @@ +package com.dat3m.dartagnan.program.event.arch.vulkan; + +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.integers.IntCmpOp; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.EventVisitor; +import com.dat3m.dartagnan.program.event.Tag; +import com.dat3m.dartagnan.program.event.common.RMWXchgBase; + +public class VulkanRMWExtremum extends RMWXchgBase { + + private final IntCmpOp operator; + + public VulkanRMWExtremum(Register register, Expression address, IntCmpOp op, Expression value, String mo, String scope) { + super(register, address, value, mo); + this.addTags(Tag.Vulkan.ATOM, scope); + this.operator = op; + } + + private VulkanRMWExtremum(VulkanRMWExtremum other) { + super(other); + this.operator = other.operator; + } + + public IntCmpOp getOperator() { + return operator; + } + + @Override + public String defaultString() { + return String.format("%s := rmw_ext[%s](%s, %s, %s)", resultRegister, mo, storeValue, address, operator.getName()); + } + + @Override + public VulkanRMWExtremum getCopy() { + return new VulkanRMWExtremum(this); + } + + @Override + public T accept(EventVisitor visitor) { + return visitor.visitVulkanRMWExtremum(this); + } +} \ No newline at end of file diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/core/ControlBarrier.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/core/ControlBarrier.java new file mode 100644 index 0000000000..c705209e0d --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/core/ControlBarrier.java @@ -0,0 +1,66 @@ +package com.dat3m.dartagnan.program.event.core; + +import com.dat3m.dartagnan.encoding.EncodingContext; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionVisitor; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.EventVisitor; +import com.dat3m.dartagnan.program.event.RegReader; +import com.dat3m.dartagnan.program.event.Tag; +import org.sosy_lab.java_smt.api.BooleanFormula; + +import java.util.HashSet; +import java.util.Set; + +public class ControlBarrier extends GenericVisibleEvent implements RegReader { + private Expression id; + + public ControlBarrier(String name, Expression id) { + super(name, Tag.FENCE); + this.id = id; + } + + private ControlBarrier(ControlBarrier other) { + super(other); + this.id = other.id; + } + + public Expression getId() { + return id; + } + + @Override + public void transformExpressions(ExpressionVisitor exprTransformer) { + this.id = id.accept(exprTransformer); + } + + @Override + public Set getRegisterReads() { + return Register.collectRegisterReads(id, Register.UsageType.OTHER, new HashSet<>()); + } + + @Override + public String defaultString() { + return String.format("%s := barrier_id[%s]", name, id); + } + + @Override + public ControlBarrier getCopy() { + return new ControlBarrier(this); + } + + @Override + public T accept(EventVisitor visitor) { + return visitor.visitControlBarrier(this); + } + + @Override + public BooleanFormula encodeExec(EncodingContext ctx) { + return ctx.getBooleanFormulaManager().implication(ctx.execution(this), ctx.controlFlow(this)); + } + + @Override + public boolean cfImpliesExec() { + return false; + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/core/FenceWithId.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/core/FenceWithId.java deleted file mode 100644 index 9fa49b7457..0000000000 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/core/FenceWithId.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.dat3m.dartagnan.program.event.core; - -import com.dat3m.dartagnan.expression.Expression; -import com.dat3m.dartagnan.expression.ExpressionVisitor; -import com.dat3m.dartagnan.program.Register; -import com.dat3m.dartagnan.program.event.EventVisitor; -import com.dat3m.dartagnan.program.event.RegReader; -import com.dat3m.dartagnan.program.event.Tag; - -import java.util.HashSet; -import java.util.Set; - -public class FenceWithId extends GenericVisibleEvent implements RegReader { - private Expression fenceID; - - public FenceWithId(String name, Expression fenceID) { - super(name, Tag.FENCE); - this.fenceID = fenceID; - } - - private FenceWithId(FenceWithId other) { - super(other); - this.fenceID = other.fenceID; - } - - public Expression getFenceID() { - return fenceID; - } - - @Override - public void transformExpressions(ExpressionVisitor exprTransformer) { - this.fenceID = fenceID.accept(exprTransformer); - } - - @Override - public Set getRegisterReads() { - return Register.collectRegisterReads(fenceID, Register.UsageType.OTHER, new HashSet<>()); - } - - @Override - public String defaultString() { - return String.format("%s := fence_id[%s]", name, fenceID); - } - - @Override - public FenceWithId getCopy() { - return new FenceWithId(this); - } - - @Override - public T accept(EventVisitor visitor) { - return visitor.visitFenceWithId(this); - } -} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/spirv/SpirvCmpXchg.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/spirv/SpirvCmpXchg.java new file mode 100644 index 0000000000..d8ac840b23 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/spirv/SpirvCmpXchg.java @@ -0,0 +1,78 @@ +package com.dat3m.dartagnan.program.event.lang.spirv; + +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.EventVisitor; +import com.dat3m.dartagnan.program.event.common.RMWCmpXchgBase; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import static com.dat3m.dartagnan.program.event.Tag.Spirv.*; + +public class SpirvCmpXchg extends RMWCmpXchgBase { + + private static final List moStrength = List.of(RELAXED, RELEASE, ACQUIRE, ACQ_REL, SEQ_CST); + + private final String scope; + private final String eqMo; + private final Set eqTags; + + public SpirvCmpXchg(Register register, Expression address, Expression cmp, Expression value, String scope, Set eqTags, Set neqTags) { + super(register, address, cmp, value, true, getMoTag(neqTags)); + this.scope = scope; + this.eqMo = getMoTag(eqTags); + this.eqTags = mkEqTags(eqTags); + addTags(scope); + addTags(neqTags); + validateMemoryOrder(); + } + + private SpirvCmpXchg(SpirvCmpXchg other) { + super(other); + this.scope = other.scope; + this.eqMo = other.eqMo; + this.eqTags = Set.copyOf(other.eqTags); + } + + public Set getEqTags() { + return Set.copyOf(eqTags); + } + + @Override + public String defaultString() { + return String.format("%s := spirv_cmpxchg[%s, %s, %s](%s, %s, %s)", + resultRegister, eqMo, mo, scope, address, expectedValue, storeValue); + } + + @Override + public SpirvCmpXchg getCopy() { + return new SpirvCmpXchg(this); + } + + @Override + public T accept(EventVisitor visitor) { + return visitor.visitSpirvCmpXchg(this); + } + + private Set mkEqTags(Set eqTags) { + Set tags = new HashSet<>(getTags()); + tags.remove(mo); + tags.addAll(eqTags); + tags.add(scope); + return Set.copyOf(tags); + } + + private void validateMemoryOrder() { + if (mo.equals(RELEASE) || mo.equals(ACQ_REL)) { + throw new IllegalArgumentException( + String.format("%s cannot have unequal memory order '%s'", + getClass().getSimpleName(), mo)); + } + if (moStrength.indexOf(mo) > moStrength.indexOf(eqMo)) { + throw new IllegalArgumentException( + String.format("Unequal semantics '%s' is stronger than equal semantics '%s'", mo, eqMo)); + } + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/spirv/SpirvLoad.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/spirv/SpirvLoad.java new file mode 100644 index 0000000000..f8419e3cf3 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/spirv/SpirvLoad.java @@ -0,0 +1,56 @@ +package com.dat3m.dartagnan.program.event.lang.spirv; + +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.EventVisitor; +import com.dat3m.dartagnan.program.event.common.LoadBase; + +import java.util.Set; + +import static com.dat3m.dartagnan.program.event.Tag.Spirv.*; + +public class SpirvLoad extends LoadBase { + + private final String scope; + + public SpirvLoad(Register register, Expression address, String scope, Set tags) { + super(register, address, getMoTag(tags)); + this.scope = scope; + addTags(scope); + addTags(tags); + validate(); + } + + private SpirvLoad(SpirvLoad other) { + super(other); + this.scope = other.scope; + } + + @Override + public String defaultString() { + return String.format("%s = spirv_load[%s, %s](%s)", resultRegister, mo, scope, address); + } + + @Override + public SpirvLoad getCopy() { + return new SpirvLoad(this); + } + + @Override + public T accept(EventVisitor visitor) { + return visitor.visitSpirvLoad(this); + } + + private void validate() { + if (mo.equals(RELEASE) || mo.equals(ACQ_REL)) { + throw new IllegalArgumentException( + String.format("%s cannot have memory order '%s'", + getClass().getSimpleName(), mo)); + } + if (getTags().contains(SEM_AVAILABLE)) { + throw new IllegalArgumentException( + String.format("%s cannot have semantics '%s'", + getClass().getSimpleName(), SEM_AVAILABLE)); + } + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/spirv/SpirvRmw.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/spirv/SpirvRmw.java new file mode 100644 index 0000000000..7c62d2b0e3 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/spirv/SpirvRmw.java @@ -0,0 +1,44 @@ +package com.dat3m.dartagnan.program.event.lang.spirv; + +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.integers.IntBinaryOp; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.EventVisitor; +import com.dat3m.dartagnan.program.event.common.RMWOpResultBase; + +import java.util.Set; + +import static com.dat3m.dartagnan.program.event.Tag.Spirv.getMoTag; + +public class SpirvRmw extends RMWOpResultBase { + + private final String scope; + + public SpirvRmw(Register register, Expression address, IntBinaryOp op, Expression operand, String scope, Set tags) { + super(register, address, op, operand, getMoTag(tags)); + this.scope = scope; + addTags(scope); + addTags(tags); + } + + private SpirvRmw(SpirvRmw other) { + super(other); + this.scope = other.scope; + } + + @Override + public String defaultString() { + return String.format("%s := spirv_rmw_%s[%s, %s](%s, %s)", + resultRegister, operator.getName(), mo, scope, address, operand); + } + + @Override + public SpirvRmw getCopy() { + return new SpirvRmw(this); + } + + @Override + public T accept(EventVisitor visitor) { + return visitor.visitSpirvRMW(this); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/spirv/SpirvRmwExtremum.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/spirv/SpirvRmwExtremum.java new file mode 100644 index 0000000000..22301826f2 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/spirv/SpirvRmwExtremum.java @@ -0,0 +1,51 @@ +package com.dat3m.dartagnan.program.event.lang.spirv; + +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.integers.IntCmpOp; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.EventVisitor; +import com.dat3m.dartagnan.program.event.common.RMWXchgBase; + +import java.util.Set; + +import static com.dat3m.dartagnan.program.event.Tag.Spirv.getMoTag; + +public class SpirvRmwExtremum extends RMWXchgBase { + + private final String scope; + private final IntCmpOp operator; + + public SpirvRmwExtremum(Register register, Expression address, IntCmpOp op, Expression value, String scope, Set tags) { + super(register, address, value, getMoTag(tags)); + this.scope = scope; + this.operator = op; + addTags(scope); + addTags(tags); + } + + private SpirvRmwExtremum(SpirvRmwExtremum other) { + super(other); + this.scope = other.scope; + this.operator = other.operator; + } + + public IntCmpOp getOperator() { + return operator; + } + + @Override + public String defaultString() { + return String.format("%s := spirv_rmw_ext%s[%s, %s](%s, %s, %s)", + resultRegister, operator.getName(), mo, scope, address, storeValue, operator.getName()); + } + + @Override + public SpirvRmwExtremum getCopy() { + return new SpirvRmwExtremum(this); + } + + @Override + public T accept(EventVisitor visitor) { + return visitor.visitSpirvRmwExtremum(this); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/spirv/SpirvStore.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/spirv/SpirvStore.java new file mode 100644 index 0000000000..224959a214 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/spirv/SpirvStore.java @@ -0,0 +1,55 @@ +package com.dat3m.dartagnan.program.event.lang.spirv; + +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.program.event.EventVisitor; +import com.dat3m.dartagnan.program.event.common.StoreBase; + +import java.util.Set; + +import static com.dat3m.dartagnan.program.event.Tag.Spirv.*; + +public class SpirvStore extends StoreBase { + + private final String scope; + + public SpirvStore(Expression address, Expression value, String scope, Set tags) { + super(address, value, getMoTag(tags)); + this.scope = scope; + addTags(scope); + addTags(tags); + validateMemoryOrder(); + } + + private SpirvStore(SpirvStore other) { + super(other); + this.scope = other.scope; + } + + @Override + public String defaultString() { + return String.format("spirv_store[%s, %s](%s, %s)", mo, scope, address, value); + } + + @Override + public SpirvStore getCopy() { + return new SpirvStore(this); + } + + @Override + public T accept(EventVisitor visitor) { + return visitor.visitSpirvStore(this); + } + + private void validateMemoryOrder() { + if (mo.equals(ACQUIRE) || mo.equals(ACQ_REL)) { + throw new IllegalArgumentException( + String.format("%s cannot have memory order '%s'", + getClass().getSimpleName(), mo)); + } + if (getTags().contains(SEM_VISIBLE)) { + throw new IllegalArgumentException( + String.format("%s cannot have semantics '%s'", + getClass().getSimpleName(), SEM_VISIBLE)); + } + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/spirv/SpirvXchg.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/spirv/SpirvXchg.java new file mode 100644 index 0000000000..9e6bd8a77f --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/lang/spirv/SpirvXchg.java @@ -0,0 +1,43 @@ +package com.dat3m.dartagnan.program.event.lang.spirv; + +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.EventVisitor; +import com.dat3m.dartagnan.program.event.common.RMWXchgBase; + +import java.util.Set; + +import static com.dat3m.dartagnan.program.event.Tag.Spirv.getMoTag; + +public class SpirvXchg extends RMWXchgBase { + + private final String scope; + + public SpirvXchg(Register register, Expression address, Expression value, String scope, Set tags) { + super(register, address, value, getMoTag(tags)); + this.scope = scope; + addTags(scope); + addTags(tags); + } + + private SpirvXchg(SpirvXchg other) { + super(other); + this.scope = other.scope; + } + + @Override + public String defaultString() { + return String.format("%s := spirv_xchg[%s, %s](%s, %s)", + resultRegister, mo, scope, address, storeValue); + } + + @Override + public SpirvXchg getCopy() { + return new SpirvXchg(this); + } + + @Override + public T accept(EventVisitor visitor) { + return visitor.visitSpirvXchg(this); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/memory/Location.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/memory/Location.java index b19ec60def..094ecf5592 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/memory/Location.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/memory/Location.java @@ -2,18 +2,18 @@ import com.dat3m.dartagnan.expression.ExpressionKind; import com.dat3m.dartagnan.expression.ExpressionVisitor; +import com.dat3m.dartagnan.expression.Type; import com.dat3m.dartagnan.expression.base.LeafExpressionBase; -import com.dat3m.dartagnan.expression.type.IntegerType; -import com.dat3m.dartagnan.expression.type.TypeFactory; -public class Location extends LeafExpressionBase { +// TODO: Should be replaced with a Pointer class +public class Location extends LeafExpressionBase { private final String name; private final MemoryObject base; private final int offset; - public Location(String name, MemoryObject base, int offset) { - super(TypeFactory.getInstance().getArchType()); + public Location(String name, Type type, MemoryObject base, int offset) { + super(type); this.name = name; this.base = base; this.offset = offset; diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/memory/MemoryObject.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/memory/MemoryObject.java index 023c70e290..cc0de95fbe 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/memory/MemoryObject.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/memory/MemoryObject.java @@ -5,8 +5,11 @@ import com.dat3m.dartagnan.expression.ExpressionVisitor; import com.dat3m.dartagnan.expression.Type; import com.dat3m.dartagnan.expression.base.LeafExpressionBase; +import com.dat3m.dartagnan.expression.misc.ConstructExpr; +import com.dat3m.dartagnan.expression.type.*; import com.dat3m.dartagnan.program.event.core.Alloc; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeMap; @@ -19,6 +22,8 @@ */ public class MemoryObject extends LeafExpressionBase { + private static final TypeFactory types = TypeFactory.getInstance(); + // TODO: (TH) I think is mostly useless. // Its only benefit is that we can have different memory objects with the same name (but why would we?) private final int id; @@ -77,8 +82,29 @@ public Expression getInitialValue(int offset) { * @param value New value to be read at the start of each execution. */ public void setInitialValue(int offset, Expression value) { - checkArgument(offset >= 0 && offset < size, "array index out of bounds"); - initialValues.put(offset, value); + if (value.getType() instanceof ArrayType arrayType) { + checkArgument(value instanceof ConstructExpr); + final ConstructExpr constArray = (ConstructExpr) value; + final List arrayElements = constArray.getOperands(); + for (int i = 0; i < arrayElements.size(); i++) { + final int innerOffset = types.getOffsetInBytes(arrayType, i); + setInitialValue(offset + innerOffset, arrayElements.get(i)); + } + } else if (value.getType() instanceof AggregateType aggregateType) { + checkArgument(value instanceof ConstructExpr); + final ConstructExpr constStruct = (ConstructExpr) value; + final List structElements = constStruct.getOperands(); + for (int i = 0; i < structElements.size(); i++) { + int innerOffset = types.getOffsetInBytes(aggregateType, i); + setInitialValue(offset + innerOffset, structElements.get(i)); + } + } else if (value.getType() instanceof IntegerType + || value.getType() instanceof BooleanType) { + checkArgument(offset >= 0 && offset < size, "array index out of bounds"); + initialValues.put(offset, value); + } else { + throw new UnsupportedOperationException("Unrecognized constant value: " + value); + } } @Override diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/memory/ScopedPointer.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/memory/ScopedPointer.java new file mode 100644 index 0000000000..0231806202 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/memory/ScopedPointer.java @@ -0,0 +1,66 @@ +package com.dat3m.dartagnan.program.memory; + +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionKind; +import com.dat3m.dartagnan.expression.ExpressionVisitor; +import com.dat3m.dartagnan.expression.Type; +import com.dat3m.dartagnan.expression.base.LeafExpressionBase; +import com.dat3m.dartagnan.expression.type.IntegerType; +import com.dat3m.dartagnan.expression.type.TypeFactory; + +import java.util.Objects; + +public class ScopedPointer extends LeafExpressionBase { + + private final String id; + private final String scopeId; + private final Type innerType; + private final Expression address; + + public ScopedPointer(String id, String scopeId, Type innerType, Expression address) { + super(TypeFactory.getInstance().getArchType()); + this.id = id; + this.scopeId = scopeId; + this.innerType = innerType; + this.address = address; + } + + public String getId() { + return id; + } + + public String getScopeId() { + return scopeId; + } + + public Type getInnerType() { + return innerType; + } + + public Expression getAddress() { + return address; + } + + @Override + public ExpressionKind getKind() { + return ExpressionKind.Other.MEMORY_ADDR; + } + + @Override + public T accept(ExpressionVisitor visitor) { + return getAddress().accept(visitor); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof ScopedPointer that)) return false; + if (!super.equals(o)) return false; + return Objects.equals(id, that.id) && Objects.equals(scopeId, that.scopeId) && Objects.equals(innerType, that.innerType) && Objects.equals(address, that.address); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), id, scopeId, innerType, address); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/memory/ScopedPointerVariable.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/memory/ScopedPointerVariable.java new file mode 100644 index 0000000000..4393f15d51 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/memory/ScopedPointerVariable.java @@ -0,0 +1,20 @@ +package com.dat3m.dartagnan.program.memory; + +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.Type; + +public class ScopedPointerVariable extends ScopedPointer { + + public ScopedPointerVariable(String id, String scopeId, Type innerType, MemoryObject address) { + super(id, scopeId, innerType, address); + } + + @Override + public MemoryObject getAddress() { + return (MemoryObject) super.getAddress(); + } + + public void setInitialValue(int offset, Expression value) { + getAddress().setInitialValue(offset, value); + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/memory/VirtualMemoryObject.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/memory/VirtualMemoryObject.java index 1749ec9132..0f343d03cd 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/memory/VirtualMemoryObject.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/memory/VirtualMemoryObject.java @@ -2,6 +2,8 @@ import com.dat3m.dartagnan.expression.Type; +import java.util.Objects; + import static com.google.common.base.Preconditions.checkArgument; /** @@ -40,4 +42,35 @@ public VirtualMemoryObject getGenericAddress() { public VirtualMemoryObject getPhysicalAddress() { return physicalAddress; } + + @Override + public int hashCode() { + int parentHash = super.hashCode(); + return Objects.hash(parentHash, + this == physicalAddress ? parentHash : physicalAddress, + this == genericAddress ? parentHash : genericAddress); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof VirtualMemoryObject that)) return false; + if (!super.equals(o)) return false; + if (!equalsPhysical(that)) return false; + return equalsGeneric(that); + } + + private boolean equalsGeneric(VirtualMemoryObject that) { + if (this == this.genericAddress) { + return super.equals(that.genericAddress); + } + return this.genericAddress.equals(that.genericAddress); + } + + private boolean equalsPhysical(VirtualMemoryObject that) { + if (this == this.physicalAddress) { + return super.equals(that.physicalAddress); + } + return this.physicalAddress.equals(that.physicalAddress); + } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/CoreCodeVerification.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/CoreCodeVerification.java index 58ec10f552..bf5d1605fc 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/CoreCodeVerification.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/CoreCodeVerification.java @@ -37,7 +37,7 @@ public static CoreCodeVerification fromConfig(Configuration config) { Skip.class, RMWStore.class, RMWStoreExclusive.class, Alloc.class, Assume.class, Assert.class, ThreadCreate.class, ThreadArgument.class, ThreadStart.class, - FenceWithId.class, // For PTX and Vulkan + ControlBarrier.class, // For PTX and Vulkan BeginAtomic.class, EndAtomic.class // We add SVCOMP atomic blocks here as well, despite them not being part of the core package. // TODO: We might want to find a more systematic way to extend the core with these custom events. diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/RemoveUnusedMemory.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/RemoveUnusedMemory.java index 14ac942bc0..6feca6db62 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/RemoveUnusedMemory.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/RemoveUnusedMemory.java @@ -4,6 +4,7 @@ import com.dat3m.dartagnan.expression.processing.ExpressionInspector; import com.dat3m.dartagnan.program.Program; import com.dat3m.dartagnan.program.event.RegReader; +import com.dat3m.dartagnan.program.memory.Location; import com.dat3m.dartagnan.program.memory.Memory; import com.dat3m.dartagnan.program.memory.MemoryObject; import com.google.common.collect.Sets; @@ -22,14 +23,21 @@ public static RemoveUnusedMemory newInstance() { public void run(Program program) { final Memory memory = program.getMemory(); final MemoryObjectCollector collector = new MemoryObjectCollector(); + + // Threads program.getThreadEvents(RegReader.class).forEach(r -> r.transformExpressions(collector)); - // Also add MemoryObjects referenced by initial values (this does happen in Litmus code) - for (MemoryObject obj : memory.getObjects()) { - for (Integer field : obj.getInitializedFields()) { - obj.getInitialValue(field).accept(collector); - } + + // Initial values + memory.getObjects() + .forEach(o -> o.getInitializedFields() + .forEach(f -> collector.memoryObjects.addAll(o.getInitialValue(f).getMemoryObjects()))); + + // Assertions + if (program.getSpecification() != null) { + collector.memoryObjects.addAll(program.getSpecification().getMemoryObjects()); } - // FIXME: We should also traverse the program spec for references to memory objects + + // Remove unused objects Sets.difference(memory.getObjects(), collector.memoryObjects).forEach(memory::deleteMemoryObject); } @@ -42,5 +50,11 @@ public Expression visitMemoryObject(MemoryObject address) { memoryObjects.add(address); return address; } + + @Override + public Expression visitLocation(Location location) { + memoryObjects.add(location.getMemoryObject()); + return location; + } } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ThreadCreation.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ThreadCreation.java index ecc735b7e9..f26c939752 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ThreadCreation.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/ThreadCreation.java @@ -77,7 +77,7 @@ public static ThreadCreation fromConfig(Configuration config) throws InvalidConf @Override public void run(Program program) { - if (program.getFormat().equals(Program.SourceLanguage.LITMUS)) { + if (!program.getFormat().equals(Program.SourceLanguage.LLVM)) { return; } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/Compilation.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/Compilation.java index 81b44fb31e..4892f50c49 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/Compilation.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/Compilation.java @@ -81,7 +81,11 @@ public void run(Program program) { logger.warn("Skipped compilation: Program is already compiled to {}", program.getArch()); return; } - + // TODO: Refactor processors such that compiler is resolved + // based on the source language and target + if (program.getFormat() == Program.SourceLanguage.SPV) { + compiler = new VisitorSpirvVulkan(); + } program.getThreads().forEach(this::run); program.getFunctions().forEach(this::run); program.setArch(target); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorSpirvVulkan.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorSpirvVulkan.java new file mode 100644 index 0000000000..d2b8385cb3 --- /dev/null +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorSpirvVulkan.java @@ -0,0 +1,262 @@ +package com.dat3m.dartagnan.program.processing.compilation; + +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.event.EventFactory; +import com.dat3m.dartagnan.program.event.Tag; +import com.dat3m.dartagnan.program.event.arch.vulkan.VulkanCmpXchg; +import com.dat3m.dartagnan.program.event.arch.vulkan.VulkanRMW; +import com.dat3m.dartagnan.program.event.arch.vulkan.VulkanRMWExtremum; +import com.dat3m.dartagnan.program.event.arch.vulkan.VulkanRMWOp; +import com.dat3m.dartagnan.program.event.core.ControlBarrier; +import com.dat3m.dartagnan.program.event.core.GenericVisibleEvent; +import com.dat3m.dartagnan.program.event.core.Load; +import com.dat3m.dartagnan.program.event.core.Store; +import com.dat3m.dartagnan.program.event.lang.spirv.*; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import static com.dat3m.dartagnan.program.event.EventFactory.*; + +public class VisitorSpirvVulkan extends VisitorVulkan { + + @Override + public List visitLoad(Load e) { + Event load = EventFactory.newLoad(e.getResultRegister(), e.getAddress()); + load.removeTags(load.getTags()); + load.addTags(toVulkanTags(e.getTags())); + return eventSequence(load); + } + + @Override + public List visitStore(Store e) { + Event store = EventFactory.newStore(e.getAddress(), e.getMemValue()); + store.removeTags(store.getTags()); + store.addTags(toVulkanTags(e.getTags())); + return eventSequence(store); + } + + @Override + public List visitSpirvLoad(SpirvLoad e) { + e.addTags(Tag.Spirv.MEM_VISIBLE, Tag.Spirv.MEM_NON_PRIVATE); + String mo = moToVulkanTag(Tag.Spirv.getMoTag(e.getTags())); + Load load = newLoadWithMo(e.getResultRegister(), e.getAddress(), mo); + load.setFunction(e.getFunction()); + load.addTags(Tag.Vulkan.ATOM); + load.addTags(toVulkanTags(e.getTags())); + replaceAcqRelTag(load, Tag.Vulkan.ACQUIRE); + return eventSequence(load); + } + + @Override + public List visitSpirvStore(SpirvStore e) { + e.addTags(Tag.Spirv.MEM_AVAILABLE, Tag.Spirv.MEM_NON_PRIVATE); + String mo = moToVulkanTag(Tag.Spirv.getMoTag(e.getTags())); + Store store = newStoreWithMo(e.getAddress(), e.getMemValue(), mo); + store.setFunction(e.getFunction()); + store.addTags(Tag.Vulkan.ATOM); + store.addTags(toVulkanTags(e.getTags())); + replaceAcqRelTag(store, Tag.Vulkan.RELEASE); + return eventSequence(store); + } + + @Override + public List visitSpirvXchg(SpirvXchg e) { + e.addTags(Tag.Spirv.MEM_VISIBLE, Tag.Spirv.MEM_AVAILABLE, Tag.Spirv.MEM_NON_PRIVATE); + String mo = moToVulkanTag(Tag.Spirv.getMoTag(e.getTags())); + String scope = toVulkanTag(Tag.Spirv.getScopeTag(e.getTags())); + VulkanRMW rmw = EventFactory.Vulkan.newRMW(e.getAddress(), e.getResultRegister(), + e.getValue(), mo, scope); + rmw.addTags(toVulkanTags(e.getTags())); + rmw.setFunction(e.getFunction()); + return visitVulkanRMW(rmw); + } + + @Override + public List visitSpirvRMW(SpirvRmw e) { + e.addTags(Tag.Spirv.MEM_VISIBLE, Tag.Spirv.MEM_AVAILABLE, Tag.Spirv.MEM_NON_PRIVATE); + String mo = moToVulkanTag(Tag.Spirv.getMoTag(e.getTags())); + String scope = toVulkanTag(Tag.Spirv.getScopeTag(e.getTags())); + VulkanRMWOp rmwOp = EventFactory.Vulkan.newRMWOp(e.getAddress(), e.getResultRegister(), + e.getOperand(), e.getOperator(), mo, scope); + rmwOp.setFunction(e.getFunction()); + rmwOp.addTags(toVulkanTags(e.getTags())); + return visitVulkanRMWOp(rmwOp); + } + + @Override + public List visitSpirvCmpXchg(SpirvCmpXchg e) { + Set eqTags = new HashSet<>(e.getEqTags()); + Set neqTags = new HashSet<>(e.getTags()); + String spvMoEq = Tag.Spirv.getMoTag(eqTags); + String spvMoNeq = Tag.Spirv.getMoTag(neqTags); + eqTags.remove(spvMoEq); + neqTags.remove(spvMoNeq); + if (!eqTags.equals(neqTags) || + spvMoNeq.equals(Tag.Spirv.RELAXED) && Set.of(Tag.Spirv.ACQUIRE, Tag.Spirv.ACQ_REL).contains(spvMoEq) || + spvMoNeq.equals(Tag.Spirv.ACQUIRE) && spvMoEq.equals(Tag.Spirv.RELEASE)) { + throw new UnsupportedOperationException( + "Spir-V CmpXchg with unequal tag sets is not supported"); + } + String scope = toVulkanTag(Tag.Spirv.getScopeTag(e.getTags())); + eqTags.addAll(Set.of(Tag.Spirv.MEM_VISIBLE, Tag.Spirv.MEM_AVAILABLE, Tag.Spirv.MEM_NON_PRIVATE)); + VulkanCmpXchg cmpXchg = EventFactory.Vulkan.newVulkanCmpXchg(e.getAddress(), e.getResultRegister(), + e.getExpectedValue(), e.getStoreValue(), moToVulkanTag(spvMoEq), scope); + cmpXchg.setFunction(e.getFunction()); + cmpXchg.addTags(toVulkanTags(eqTags)); + + return visitVulkanCmpXchg(cmpXchg); + } + + @Override + public List visitSpirvRmwExtremum(SpirvRmwExtremum e) { + e.addTags(Tag.Spirv.MEM_VISIBLE, Tag.Spirv.MEM_AVAILABLE, Tag.Spirv.MEM_NON_PRIVATE); + String mo = moToVulkanTag(Tag.Spirv.getMoTag(e.getTags())); + String scope = toVulkanTag(Tag.Spirv.getScopeTag(e.getTags())); + VulkanRMWExtremum rmw = EventFactory.Vulkan.newRMWExtremum(e.getAddress(), e.getResultRegister(), + e.getOperator(), e.getValue(), mo, scope); + rmw.setFunction(e.getFunction()); + rmw.addTags(toVulkanTags(e.getTags())); + return visitVulkanRMWExtremum(rmw); + } + + @Override + public List visitGenericVisibleEvent(GenericVisibleEvent e) { + Event fence = new GenericVisibleEvent(e.getName(), Tag.FENCE); + fence.removeTags(fence.getTags()); + fence.addTags(toVulkanTags(e.getTags())); + replaceAcqRelTag(fence, Tag.Vulkan.ACQUIRE, Tag.Vulkan.RELEASE); + return eventSequence(fence); + } + + @Override + public List visitControlBarrier(ControlBarrier e) { + Event barrier = EventFactory.newControlBarrier(e.getName(), e.getId()); + barrier.removeTags(barrier.getTags()); + barrier.addTags(toVulkanTags(e.getTags())); + replaceAcqRelTag(barrier, Tag.Vulkan.ACQUIRE, Tag.Vulkan.RELEASE); + return eventSequence(barrier); + } + + private Set toVulkanTags(Set tags) { + Set vTags = new HashSet<>(); + tags.forEach(tag -> { + if (Tag.Spirv.isSpirvTag(tag)) { + String vTag = toVulkanTag(tag); + if (vTag != null) { + vTags.add(vTag); + } + } else { + vTags.add(tag); + } + }); + return adjustVulkanTags(tags, vTags); + } + + private Set adjustVulkanTags(Set tags, Set vTags) { + if (tags.contains(Tag.MEMORY) && toVulkanTag(Tag.Spirv.getStorageClassTag(tags)) != null) { + vTags.add(Tag.Vulkan.NON_PRIVATE); + if (vTags.contains(Tag.READ)) { + vTags.add(Tag.Vulkan.VISIBLE); + } + if (vTags.contains(Tag.WRITE)) { + vTags.add(Tag.Vulkan.AVAILABLE); + } + } + if (tags.contains(Tag.Spirv.MEM_AVAILABLE) && tags.contains(Tag.Spirv.DEVICE)) { + vTags.add(Tag.Vulkan.AVDEVICE); + } + if (tags.contains(Tag.Spirv.MEM_VISIBLE) && tags.contains(Tag.Spirv.DEVICE)) { + vTags.add(Tag.Vulkan.VISDEVICE); + } + if (tags.contains(Tag.Spirv.RELAXED)) { + vTags.remove(Tag.Vulkan.SEMSC0); + vTags.remove(Tag.Vulkan.SEMSC1); + vTags.remove(Tag.Vulkan.SEM_VISIBLE); + vTags.remove(Tag.Vulkan.SEM_AVAILABLE); + } + return vTags; + } + + private void replaceAcqRelTag(Event e, String... tags) { + if (e.getTags().contains(Tag.Vulkan.ACQ_REL)) { + e.addTags(tags); + e.removeTags(Tag.Vulkan.ACQ_REL); + } + } + + private String moToVulkanTag(String moSpv) { + if (Tag.Spirv.RELAXED.equals(moSpv)) { + return Tag.Vulkan.ATOM; + } + return toVulkanTag(moSpv); + } + + private String toVulkanTag(String tag) { + return switch (tag) { + // Barriers + case Tag.Spirv.CONTROL -> Tag.Vulkan.CBAR; + + // Memory order + case Tag.Spirv.RELAXED -> null; + case Tag.Spirv.ACQUIRE -> Tag.Vulkan.ACQUIRE; + case Tag.Spirv.RELEASE -> Tag.Vulkan.RELEASE; + case Tag.Spirv.ACQ_REL, + Tag.Spirv.SEQ_CST -> Tag.Vulkan.ACQ_REL; + + // Scope + case Tag.Spirv.SUBGROUP -> Tag.Vulkan.SUB_GROUP; + case Tag.Spirv.WORKGROUP -> Tag.Vulkan.WORK_GROUP; + case Tag.Spirv.QUEUE_FAMILY -> Tag.Vulkan.QUEUE_FAMILY; + // TODO: Refactoring of the cat model + // In the cat file AV/VISSHADER uses device domain, + // and device domain is mapped to AV/VISDEVICE + case Tag.Spirv.INVOCATION, + Tag.Spirv.SHADER_CALL, + Tag.Spirv.DEVICE, + Tag.Spirv.CROSS_DEVICE -> Tag.Vulkan.DEVICE; + + // Memory access (non-atomic) + case Tag.Spirv.MEM_VOLATILE, + Tag.Spirv.MEM_NON_TEMPORAL -> null; + case Tag.Spirv.MEM_NON_PRIVATE -> Tag.Vulkan.NON_PRIVATE; + case Tag.Spirv.MEM_AVAILABLE -> Tag.Vulkan.AVAILABLE; + case Tag.Spirv.MEM_VISIBLE -> Tag.Vulkan.VISIBLE; + + // Memory semantics + case Tag.Spirv.SEM_VOLATILE -> null; + case Tag.Spirv.SEM_AVAILABLE -> Tag.Vulkan.SEM_AVAILABLE; + case Tag.Spirv.SEM_VISIBLE -> Tag.Vulkan.SEM_VISIBLE; + + // Memory semantics (storage class) + case Tag.Spirv.SEM_UNIFORM, Tag.Spirv.SEM_OUTPUT -> Tag.Vulkan.SEMSC0; + case Tag.Spirv.SEM_WORKGROUP -> Tag.Vulkan.SEMSC1; + case Tag.Spirv.SEM_SUBGROUP, + Tag.Spirv.SEM_CROSS_WORKGROUP, + Tag.Spirv.SEM_ATOMIC_COUNTER, + Tag.Spirv.SEM_IMAGE -> throw new UnsupportedOperationException( + String.format("Spir-V memory semantics '%s' " + + "is not supported by Vulkan memory model", tag)); + + // Storage class + case Tag.Spirv.SC_UNIFORM_CONSTANT, + Tag.Spirv.SC_PUSH_CONSTANT -> null; // read-only + case Tag.Spirv.SC_INPUT, + Tag.Spirv.SC_PRIVATE, + Tag.Spirv.SC_FUNCTION -> null; // private + case Tag.Spirv.SC_UNIFORM, + Tag.Spirv.SC_OUTPUT, + Tag.Spirv.SC_STORAGE_BUFFER, + Tag.Spirv.SC_PHYS_STORAGE_BUFFER -> Tag.Vulkan.SC0; + case Tag.Spirv.SC_WORKGROUP -> Tag.Vulkan.SC1; + case Tag.Spirv.SC_CROSS_WORKGROUP, + Tag.Spirv.SC_GENERIC -> throw new UnsupportedOperationException( + String.format("Spir-V storage class '%s' " + + "is not supported by Vulkan memory model", tag)); + + default -> throw new IllegalArgumentException( + String.format("Unexpected non Spir-V tag '%s'", tag)); + }; + } +} diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorVulkan.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorVulkan.java index 158601ff35..1ee857bbb8 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorVulkan.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/compilation/VisitorVulkan.java @@ -4,11 +4,11 @@ import com.dat3m.dartagnan.program.Register; import com.dat3m.dartagnan.program.event.Event; import com.dat3m.dartagnan.program.event.Tag; +import com.dat3m.dartagnan.program.event.arch.vulkan.VulkanCmpXchg; import com.dat3m.dartagnan.program.event.arch.vulkan.VulkanRMW; +import com.dat3m.dartagnan.program.event.arch.vulkan.VulkanRMWExtremum; import com.dat3m.dartagnan.program.event.arch.vulkan.VulkanRMWOp; -import com.dat3m.dartagnan.program.event.core.Load; -import com.dat3m.dartagnan.program.event.core.RMWStore; -import com.dat3m.dartagnan.program.event.core.Store; +import com.dat3m.dartagnan.program.event.core.*; import java.util.List; @@ -51,6 +51,49 @@ public List visitVulkanRMWOp(VulkanRMWOp e) { ); } + @Override + public List visitVulkanRMWExtremum(VulkanRMWExtremum e) { + Register resultRegister = e.getResultRegister(); + String mo = e.getMo(); + Expression address = e.getAddress(); + Register dummy = e.getFunction().newRegister(resultRegister.getType()); + Load load = newRMWLoadWithMo(dummy, address, Tag.Vulkan.loadMO(mo)); + Expression cmpExpr = expressions.makeIntCmp(dummy, e.getOperator(), e.getValue()); + Expression ite = expressions.makeITE(cmpExpr, dummy, e.getValue()); + RMWStore store = newRMWStoreWithMo(load, address, ite, Tag.Vulkan.storeMO(mo)); + this.propagateTags(e, load); + this.propagateTags(e, store); + return eventSequence( + load, + store, + newLocal(resultRegister, dummy) + ); + } + + @Override + public List visitVulkanCmpXchg(VulkanCmpXchg e) { + Register resultRegister = e.getResultRegister(); + String mo = e.getMo(); + Expression address = e.getAddress(); + Expression expected = e.getExpectedValue(); + Expression value = e.getStoreValue(); + Register cmpResultRegister = e.getFunction().newRegister(types.getBooleanType()); + Label casEnd = newLabel("CAS_end"); + Load load = newRMWLoadWithMo(resultRegister, address, Tag.Vulkan.loadMO(mo)); + RMWStore store = newRMWStoreWithMo(load, address, value, Tag.Vulkan.storeMO(mo)); + Local local = newLocal(cmpResultRegister, expressions.makeEQ(resultRegister, expected)); + CondJump condJump = newJumpUnless(cmpResultRegister, casEnd); + this.propagateTags(e, load); + this.propagateTags(e, store); + return eventSequence( + load, + local, + condJump, + store, + casEnd + ); + } + private void propagateTags(Event source, Event target) { for (String tag : List.of(Tag.Vulkan.SUB_GROUP, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.QUEUE_FAMILY, Tag.Vulkan.DEVICE, Tag.Vulkan.NON_PRIVATE, Tag.Vulkan.ATOM, Tag.Vulkan.SC0, Tag.Vulkan.SC1, Tag.Vulkan.SEMSC0, Tag.Vulkan.SEMSC1)) { @@ -75,6 +118,9 @@ private void propagateTags(Event source, Event target) { target.removeTags(Tag.Vulkan.SEMSC1); } } + if (source.hasTag(Tag.Vulkan.VISDEVICE)) { + target.addTags(Tag.Vulkan.VISDEVICE); + } } else if (target instanceof Store) { // Atomic stores are always available if (source.hasTag(Tag.Vulkan.ATOM)) { @@ -83,7 +129,7 @@ private void propagateTags(Event source, Event target) { if (source.hasTag(Tag.Vulkan.SEM_AVAILABLE)) { target.addTags(Tag.Vulkan.SEM_AVAILABLE); } - // If a RMW is a acquire, we do not propagate semscX to the write + // If a RMW is an acquire, we do not propagate semscX to the write if (!(source.hasTag(Tag.Vulkan.RELEASE) || source.hasTag(Tag.Vulkan.ACQ_REL))) { if (target.hasTag(Tag.Vulkan.SEMSC0)) { target.removeTags(Tag.Vulkan.SEMSC0); @@ -92,6 +138,9 @@ private void propagateTags(Event source, Event target) { target.removeTags(Tag.Vulkan.SEMSC1); } } + if (source.hasTag(Tag.Vulkan.AVDEVICE)) { + target.addTags(Tag.Vulkan.AVDEVICE); + } } } } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/witness/graphviz/ExecutionGraphVisualizer.java b/dartagnan/src/main/java/com/dat3m/dartagnan/witness/graphviz/ExecutionGraphVisualizer.java index 372ca3e900..a41e035499 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/witness/graphviz/ExecutionGraphVisualizer.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/witness/graphviz/ExecutionGraphVisualizer.java @@ -232,6 +232,7 @@ private String eventToNode(EventData e) { callStack.isEmpty() ? callStack : callStack + " -> \\n", getSourceLocationString(e.getEvent()), tag) + .replace("%", "\\%") .replace("\"", "\\\""); // We need to escape quotes inside the string return "\"" + nodeString + "\""; } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/analysis/NativeRelationAnalysis.java b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/analysis/NativeRelationAnalysis.java index 1528e45fed..1333ececf3 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/analysis/NativeRelationAnalysis.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/analysis/NativeRelationAnalysis.java @@ -34,6 +34,7 @@ import org.sosy_lab.common.configuration.InvalidConfigurationException; import java.util.*; +import java.util.stream.Collectors; import java.util.stream.Stream; import static com.dat3m.dartagnan.configuration.Arch.RISCV; @@ -752,11 +753,15 @@ public Knowledge visitReadModifyWrites(ReadModifyWrites rmw) { @Override public Knowledge visitCoherence(Coherence co) { logger.trace("Computing knowledge about memory order"); + List allWrites = program.getThreadEvents(Store.class); List nonInitWrites = program.getThreadEvents(Store.class); nonInitWrites.removeIf(Init.class::isInstance); EventGraph may = new EventGraph(); for (Store w1 : program.getThreadEvents(Store.class)) { - for (Store w2 : nonInitWrites) { + // It is possible to have multiple initial writes + // to the same memory location via different virtual memory aliases + List writes = w1 instanceof Init ? allWrites : nonInitWrites; + for (Store w2 : writes) { if (w1.getGlobalId() != w2.getGlobalId() && !exec.areMutuallyExclusive(w1, w2) && alias.mayAlias(w1, w2)) { may.add(w1, w2); @@ -983,7 +988,7 @@ public Knowledge visitSameScope(SameScope sc) { } Thread thread1 = e1.getThread(); Thread thread2 = e2.getThread(); - if (specificScope != null) { // scope specified + if (specificScope != null) { if (thread1.getScopeHierarchy().canSyncAtScope(thread2.getScopeHierarchy(), specificScope)) { must.add(e1, e2); } @@ -1004,16 +1009,16 @@ public Knowledge visitSameScope(SameScope sc) { public Knowledge visitSyncBarrier(SyncBar syncBar) { EventGraph may = new EventGraph(); EventGraph must = new EventGraph(); - List fenceEvents = program.getThreadEvents(FenceWithId.class); - for (FenceWithId e1 : fenceEvents) { - for (FenceWithId e2 : fenceEvents) { + List barriers = program.getThreadEvents(ControlBarrier.class); + for (ControlBarrier e1 : barriers) { + for (ControlBarrier e2 : barriers) { // “A bar.sync or bar.red or bar.arrive operation synchronizes with a bar.sync // or bar.red operation executed on the same barrier.” if (exec.areMutuallyExclusive(e1, e2) || e2.hasTag(PTX.ARRIVE)) { continue; } may.add(e1, e2); - if (e1.getFenceID().equals(e2.getFenceID())) { + if (e1.getId().equals(e2.getId())) { must.add(e1, e2); } } @@ -1040,22 +1045,39 @@ public Knowledge visitSyncFence(SyncFence syncFence) { public Knowledge visitSameVirtualLocation(SameVirtualLocation vloc) { EventGraph must = new EventGraph(); EventGraph may = new EventGraph(); - List events = program.getThreadEvents(MemoryCoreEvent.class); - for (MemoryCoreEvent e1 : events) { - for (MemoryCoreEvent e2 : events) { - if (sameGenericAddress(e1, e2) && !exec.areMutuallyExclusive(e1, e2)) { - if (alias.mustAlias(e1, e2)) { - must.add(e1, e2); - } - if (alias.mayAlias(e1, e2)) { - may.add(e1, e2); - } + Map map = computeViltualAddressMap(); + map.forEach((e1, a1) -> map.forEach((e2, a2) -> { + if (a1.equals(a2) && !exec.areMutuallyExclusive(e1, e2)) { + if (alias.mustAlias(e1, e2)) { + must.add(e1, e2); + } + if (alias.mayAlias(e1, e2)) { + may.add(e1, e2); } } - } + })); return new Knowledge(may, must); } + private Map computeViltualAddressMap() { + Map map = new HashMap<>(); + program.getThreadEvents(MemoryCoreEvent.class).forEach(e -> { + Set s = e.getAddress().getMemoryObjects().stream() + .filter(VirtualMemoryObject.class::isInstance) + .map(o -> (VirtualMemoryObject)o) + .collect(Collectors.toSet()); + if (s.size() > 1) { + throw new UnsupportedOperationException( + "Expressions with multiple virtual addresses are not supported"); + } + if (!s.isEmpty()) { + VirtualMemoryObject a = s.stream().findFirst().orElseThrow().getGenericAddress(); + map.put(e, a); + } + }); + return map; + } + @Override public Knowledge visitSyncWith(SyncWith syncWith) { EventGraph must = new EventGraph(); @@ -1414,19 +1436,6 @@ public long countMustSet() { return knowledgeMap.values().stream().mapToLong(k -> k.getMustSet().size()).sum(); } - // GPU memory models make use of virtual addresses. - // This models same_alias_r from the PTX Alloy model - // Checking address1 and address2 hold the same generic address - private boolean sameGenericAddress(MemoryCoreEvent e1, MemoryCoreEvent e2) { - // TODO: Add support for pointers, i.e. if `x` and `y` virtually alias, - // then `x + offset` and `y + offset` should too - if (!(e1.getAddress() instanceof VirtualMemoryObject addr1) - || !(e2.getAddress() instanceof VirtualMemoryObject addr2)) { - return false; - } - return addr1.getGenericAddress() == addr2.getGenericAddress(); - } - protected static final class Delta { public static final Delta EMPTY = new Delta(EventGraph.empty(), EventGraph.empty()); diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/GrammarSpirvTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/GrammarSpirvTest.java new file mode 100644 index 0000000000..0a7236f1ca --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/GrammarSpirvTest.java @@ -0,0 +1,59 @@ +package com.dat3m.dartagnan.parsers; + +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockSpirvParser; +import org.antlr.v4.runtime.ParserRuleContext; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.DirectoryStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.LinkedList; +import java.util.List; + +import static com.dat3m.dartagnan.utils.ResourceHelper.getTestResourcePath; +import static org.junit.Assert.assertNull; + +@RunWith(Parameterized.class) +public class GrammarSpirvTest { + + private final String filename; + + public GrammarSpirvTest(String filename) { + this.filename = filename; + } + + @Parameterized.Parameters(name = "{index}: {0}") + public static Iterable data() throws IOException { + List data = new LinkedList<>(); + listFiles(Paths.get(getTestResourcePath("parsers/program/spirv")), data); + listFiles(Paths.get(getTestResourcePath("spirv")), data); + return data; + } + + private static void listFiles(Path path, List result) throws IOException { + try (DirectoryStream files = Files.newDirectoryStream(path)) { + for (Path file : files) { + if (Files.isDirectory(file)) { + listFiles(file, result); + } else { + result.add(new Object[]{file.toAbsolutePath().toString()}); + } + } + } + } + + @Test + public void testParsingFile() throws IOException { + Path path = Paths.get(filename); + String input = Files.readString(path, StandardCharsets.UTF_8); + SpirvParser parser = new MockSpirvParser(input); + ParserRuleContext parserEntryPoint = parser.spv(); + SpirvBaseVisitor visitor = new SpirvBaseVisitor<>(); + assertNull(parserEntryPoint.accept(visitor)); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/ParserSpirvTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/ParserSpirvTest.java index be0c823dc0..2fd4f4e69b 100644 --- a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/ParserSpirvTest.java +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/ParserSpirvTest.java @@ -1,54 +1,50 @@ package com.dat3m.dartagnan.parsers.program; +import com.dat3m.dartagnan.exception.ParsingException; import com.dat3m.dartagnan.program.Program; import org.antlr.v4.runtime.CharStream; import org.antlr.v4.runtime.CharStreams; import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import java.io.File; import java.io.FileInputStream; import java.io.IOException; -import java.nio.file.Path; import java.nio.file.Paths; -import java.util.stream.Stream; import static com.dat3m.dartagnan.utils.ResourceHelper.getTestResourcePath; -import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.*; -@RunWith(Parameterized.class) public class ParserSpirvTest { - private static final String PATH = "parsers/program/spirv/"; - - private final String filename; - - public ParserSpirvTest(String filename) { - this.filename = filename; + @Test + public void testParsingProgram() throws IOException { + String path = Paths.get(getTestResourcePath("parsers/program/spirv/valid/fibonacci.spv.dis")).toString(); + try (FileInputStream stream = new FileInputStream(path)) { + CharStream charStream = CharStreams.fromStream(stream); + ParserSpirv parser = new ParserSpirv(); + Program program = parser.parse(charStream); + assertNotNull(program); + } } - @Parameterized.Parameters(name = "{index}: {0}") - public static Iterable data() throws IOException { - String path = Paths.get(getTestResourcePath(PATH)).toString(); - File dir = new File(path); - File[] files = dir.listFiles(); - assertNotNull(files); - return Stream.of(files) - .filter(file -> !file.isDirectory()) - .map(f -> new Object[]{f.getName()}) - .toList(); + @Test + public void testParsingInvalidProgram() throws IOException { + doTestParsingInvalidProgram("malformed-selection-merge-label.spv.dis"); + doTestParsingInvalidProgram("malformed-selection-merge.spv.dis"); + doTestParsingInvalidProgram("malformed-loop-merge.spv.dis"); + doTestParsingInvalidProgram("malformed-loop-merge-true-label.spv.dis"); } - @Test - public void testParsingFile() throws IOException { - Program program; - Path path = Paths.get(getTestResourcePath(PATH + filename)); - try (FileInputStream stream = new FileInputStream(path.toString())) { + private void doTestParsingInvalidProgram(String file) throws IOException { + String path = Paths.get(getTestResourcePath("parsers/program/spirv/invalid/" + file)).toString(); + try (FileInputStream stream = new FileInputStream(path)) { CharStream charStream = CharStreams.fromStream(stream); ParserSpirv parser = new ParserSpirv(); - program = parser.parse(charStream); + try { + parser.parse(charStream); + fail("Should throw exception"); + } catch (ParsingException e) { + assertEquals("Unexpected operation 'OpLogicalNot'", e.getMessage()); + } } - assertNotNull(program); } } diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorSpirvTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorSpirvTest.java new file mode 100644 index 0000000000..edad394095 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorSpirvTest.java @@ -0,0 +1,75 @@ +package com.dat3m.dartagnan.parsers.program.visitors; + +import com.dat3m.dartagnan.parsers.SpirvParser; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockSpirvParser; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class VisitorSpirvTest { + + @Test + public void testParseOpName() { + doTestParseInstruction("OpStore %ptr %value", "OpStore"); + } + + @Test + public void testParseOpNameRet() { + doTestParseInstruction("%res = OpLoad %int %ptr", "OpLoad"); + } + + @Test + public void testParseOpNameOpSpecConstantOp() { + doTestParseInstruction("%res = Op SpecConstantOp %int IMul %value_1 %value_2", "OpIMul"); + } + + private void doTestParseInstruction(String input, String expected) { + // given + SpirvParser.OpContext ctx = new MockSpirvParser(input).op(); + + // when + String result = new VisitorSpirv().parseOpName(ctx); + + // then + assertEquals(expected, result); + } + + @Test + public void testIsSpecConstantOp() { + // given + String input = "OpStore %ptr %value"; + SpirvParser.OpContext ctx = new MockSpirvParser(input).op(); + + // when + boolean result = new VisitorSpirv().isSpecConstantOp(ctx); + + // then + assertFalse(result); + } + + @Test + public void testIsSpecConstantOpRet() { + // given + String input = "%res = OpLoad %int %ptr"; + SpirvParser.OpContext ctx = new MockSpirvParser(input).op(); + + // when + boolean result = new VisitorSpirv().isSpecConstantOp(ctx); + + // then + assertFalse(result); + } + + @Test + public void testIsSpecConstantOpOpSpecConstantOp() { + // given + String input = "%res = Op SpecConstantOp %int IMul %value_1 %value_2"; + SpirvParser.OpContext ctx = new MockSpirvParser(input).op(); + + // when + boolean result = new VisitorSpirv().isSpecConstantOp(ctx); + + // then + assertTrue(result); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsArithmeticTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsArithmeticTest.java new file mode 100644 index 0000000000..61c785fe0d --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsArithmeticTest.java @@ -0,0 +1,184 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.integers.IntBinaryExpr; +import com.dat3m.dartagnan.expression.integers.IntBinaryOp; +import com.dat3m.dartagnan.expression.integers.IntUnaryExpr; +import com.dat3m.dartagnan.expression.integers.IntUnaryOp; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockProgramBuilder; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockSpirvParser; +import com.dat3m.dartagnan.program.event.core.Local; +import org.junit.Test; + +import java.util.List; + +import static com.dat3m.dartagnan.expression.integers.IntBinaryOp.*; +import static com.dat3m.dartagnan.expression.integers.IntUnaryOp.MINUS; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class VisitorOpsArithmeticTest { + + @Test + public void testOpsIntegerUn() { + doTestOpsIntegerUn("OpSNegate", MINUS, 0); + doTestOpsIntegerUn("OpSNegate", MINUS, 1); + doTestOpsIntegerUn("OpSNegate", MINUS, -2); + } + + private void doTestOpsIntegerUn(String name, IntUnaryOp op, int value) { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockIntType("%int", 64); + builder.mockConstant("%value", "%int", value); + String input = String.format("%%reg = %s %%int %%value", name); + + // when + Local local = visit(builder, input); + + // then + assertEquals(builder.getExpression("%reg"), local.getResultRegister()); + IntUnaryExpr expr = (IntUnaryExpr) local.getExpr(); + assertEquals(builder.getExpression("%value"), expr.getOperand()); + assertEquals(op, expr.getKind()); + } + + @Test + public void testOpsIntegerBin() { + doTestOpsIntegerBin("OpIAdd", ADD, 1, 2); + doTestOpsIntegerBin("OpISub", SUB, 2, 1); + doTestOpsIntegerBin("OpIMul", MUL, 2, 3); + doTestOpsIntegerBin("OpUDiv", UDIV, 4, 2); + doTestOpsIntegerBin("OpSDiv", DIV, 4, -2); + } + + private void doTestOpsIntegerBin(String name, IntBinaryOp op, int v1, int v2) { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockIntType("%int", 64); + builder.mockConstant("%v1", "%int", v1); + builder.mockConstant("%v2", "%int", v2); + String input = String.format("%%reg = %s %%int %%v1 %%v2", name); + + // when + Local local = visit(builder, input); + + // then + assertEquals(builder.getExpression("%reg"), local.getResultRegister()); + IntBinaryExpr expr = (IntBinaryExpr) local.getExpr(); + assertEquals(builder.getExpression("%v1"), expr.getLeft()); + assertEquals(builder.getExpression("%v2"), expr.getRight()); + assertEquals(op, expr.getKind()); + } + + @Test + public void testOnUnMismatchingResultType() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockIntType("%int32", 32); + builder.mockIntType("%int64", 64); + builder.mockConstant("%value", "%int32", -1); + String input = "%reg = OpSNegate %int64 %value"; + + try { + // when + visit(builder, input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Illegal definition for '%reg', " + + "types do not match: '%value' is 'bv32' and '%int64' is 'bv64'", + e.getMessage()); + } + } + + @Test + public void testOnBinMismatchingResultType() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockIntType("%int32", 32); + builder.mockIntType("%int64", 64); + builder.mockConstant("%v1", "%int32", 1); + builder.mockConstant("%v2", "%int32", 2); + String input = "%reg = OpIAdd %int64 %v1 %v2"; + + try { + // when + visit(builder, input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Illegal definition for '%reg', " + + "types do not match: '%v1' is 'bv32', '%v2' is 'bv32' " + + "and '%int64' is 'bv64'", e.getMessage()); + } + } + + @Test + public void testMismatchingOperandTypes() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockIntType("%int32", 32); + builder.mockIntType("%int64", 64); + builder.mockConstant("%v1", "%int32", 1); + builder.mockConstant("%v2", "%int64", 2); + String input = "%reg = OpIAdd %int32 %v1 %v2"; + + try { + // when + visit(builder, input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Illegal definition for '%reg', " + + "types do not match: '%v1' is 'bv32', '%v2' is 'bv64' " + + "and '%int32' is 'bv32'", e.getMessage()); + } + } + + @Test + public void testUnsupportedResultType() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockIntType("%int", 64); + builder.mockVectorType("%vector", "%int", 4); + builder.mockConstant("%v1", "%vector", List.of(1, 2, 3, 4)); + builder.mockConstant("%v2", "%vector", List.of(5, 6, 7, 8)); + String input = "%reg = OpIAdd %vector %v1 %v2"; + + try { + // when + visit(builder, input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Unsupported result type for '%reg', " + + "vector types are not supported", e.getMessage()); + } + } + + @Test + public void testIllegalResultType() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockBoolType("%bool"); + builder.mockIntType("%int", 64); + builder.mockConstant("%v1", "%int", 1); + builder.mockConstant("%v2", "%int", 2); + String input = "%reg = OpIAdd %bool %v1 %v2"; + + try { + // when + visit(builder, input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Illegal result type for '%reg'", e.getMessage()); + } + } + + private Local visit(MockProgramBuilder builder, String input) { + builder.mockFunctionStart(true); + return (Local) new MockSpirvParser(input).op().accept(new VisitorOpsArithmetic(builder)); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsAtomicTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsAtomicTest.java new file mode 100644 index 0000000000..0eae28a4f0 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsAtomicTest.java @@ -0,0 +1,217 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.expression.integers.IntBinaryOp; +import com.dat3m.dartagnan.expression.integers.IntCmpOp; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockProgramBuilder; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockSpirvParser; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.event.lang.spirv.*; +import org.junit.Test; + +import java.util.Set; + +import static com.dat3m.dartagnan.program.event.Tag.*; +import static com.dat3m.dartagnan.program.event.Tag.Spirv.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class VisitorOpsAtomicTest { + + @Test + public void testLoad() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockIntType("%int", 64); + builder.mockPtrType("%int_ptr", "%int", "Uniform"); + builder.mockVariable("%ptr", "%int_ptr"); + builder.mockConstant("%scope", "%int", 1); + builder.mockConstant("%tags", "%int", 66); + String input = "%result = OpAtomicLoad %int %ptr %scope %tags"; + + // when + SpirvLoad event = (SpirvLoad) visit(builder, input); + + // then + assertEquals("%result", event.getResultRegister().getName()); + assertEquals(builder.getType("%int"), event.getResultRegister().getType()); + assertEquals(builder.getExpression("%ptr"), event.getAddress()); + assertEquals(ACQUIRE, event.getMo()); + assertEquals(Set.of(ACQUIRE, SEM_UNIFORM, SC_UNIFORM, DEVICE, READ, MEMORY, VISIBLE), event.getTags()); + } + + @Test + public void testStore() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockIntType("%int", 64); + builder.mockPtrType("%int_ptr", "%int", "Uniform"); + builder.mockVariable("%ptr", "%int_ptr"); + builder.mockConstant("%scope", "%int", 1); + builder.mockConstant("%tags", "%int", 68); + builder.mockConstant("%value", "%int", 123); + String input = "OpAtomicStore %ptr %scope %tags %value"; + + // when + SpirvStore event = (SpirvStore) visit(builder, input); + + // then + assertEquals(builder.getExpression("%ptr"), event.getAddress()); + assertEquals(builder.getExpression("%value"), event.getMemValue()); + assertEquals(RELEASE, event.getMo()); + assertEquals(Set.of(RELEASE, SEM_UNIFORM, SC_UNIFORM, DEVICE, WRITE, MEMORY, VISIBLE), event.getTags()); + } + + @Test + public void testXchg() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockIntType("%int", 64); + builder.mockPtrType("%int_ptr", "%int", "Uniform"); + builder.mockVariable("%ptr", "%int_ptr"); + builder.mockConstant("%value", "%int", 123); + builder.mockConstant("%scope", "%int", 1); + builder.mockConstant("%tags", "%int", 72); + String input = "%orig = OpAtomicExchange %int %ptr %scope %tags %value"; + + // when + SpirvXchg event = (SpirvXchg) visit(builder, input); + + // then + assertEquals("%orig", event.getResultRegister().getName()); + assertEquals(builder.getType("%int"), event.getResultRegister().getType()); + assertEquals(builder.getExpression("%ptr"), event.getAddress()); + assertEquals(builder.getExpression("%value"), event.getValue()); + assertEquals(ACQ_REL, event.getMo()); + assertEquals(Set.of(ACQ_REL, SEM_UNIFORM, SC_UNIFORM, DEVICE, READ, WRITE, RMW, MEMORY, VISIBLE), event.getTags()); + } + + @Test + public void testCmpXchg() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockIntType("%int", 64); + builder.mockPtrType("%int_ptr", "%int", "Uniform"); + builder.mockVariable("%ptr", "%int_ptr"); + builder.mockConstant("%value", "%int", 123); + builder.mockConstant("%cmp", "%int", 456); + builder.mockConstant("%scope", "%int", 1); + builder.mockConstant("%eq", "%int", 72); + builder.mockConstant("%neq", "%int", 66); + String input = "%result = OpAtomicCompareExchange %int %ptr %scope %eq %neq %value %cmp"; + + // when + SpirvCmpXchg event = (SpirvCmpXchg) visit(builder, input); + + // then + assertEquals("%result", event.getResultRegister().getName()); + assertEquals(builder.getType("%int"), event.getResultRegister().getType()); + assertEquals(builder.getExpression("%ptr"), event.getAddress()); + assertEquals(builder.getExpression("%value"), event.getStoreValue()); + assertEquals(builder.getExpression("%cmp"), event.getExpectedValue()); + assertEquals(ACQUIRE, event.getMo()); + assertEquals(Set.of(ACQUIRE, SEM_UNIFORM, SC_UNIFORM, DEVICE, READ, WRITE, RMW, MEMORY, VISIBLE), event.getTags()); + assertEquals(Set.of(ACQ_REL, SEM_UNIFORM, SC_UNIFORM, DEVICE, READ, WRITE, RMW, MEMORY, VISIBLE), event.getEqTags()); + } + + @Test + public void testRmw() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockIntType("%int", 64); + builder.mockPtrType("%int_ptr", "%int", "Uniform"); + builder.mockVariable("%ptr", "%int_ptr"); + builder.mockConstant("%value", "%int", 123); + builder.mockConstant("%scope", "%int", 1); + builder.mockConstant("%tags", "%int", 64); + String input = "%orig = OpAtomicIAdd %int %ptr %scope %tags %value"; + + // when + SpirvRmw event = (SpirvRmw) visit(builder, input); + + // then + assertEquals("%orig", event.getResultRegister().getName()); + assertEquals(builder.getType("%int"), event.getResultRegister().getType()); + assertEquals(builder.getExpression("%ptr"), event.getAddress()); + assertEquals(builder.getExpression("%value"), event.getOperand()); + assertEquals(IntBinaryOp.ADD, event.getOperator()); + assertEquals(RELAXED, event.getMo()); + assertEquals(Set.of(RELAXED, SEM_UNIFORM, SC_UNIFORM, DEVICE, READ, WRITE, RMW, MEMORY, VISIBLE), event.getTags()); + } + + @Test + public void testOpAtomicSMax() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockIntType("%int", 64); + builder.mockPtrType("%int_ptr", "%int", "Uniform"); + builder.mockVariable("%ptr", "%int_ptr"); + builder.mockConstant("%scope", "%int", 1); + builder.mockConstant("%semantic", "%int", 66); + builder.mockConstant("%value", "%int", 123); + String input = "%result = OpAtomicSMax %int %ptr %scope %semantic %value"; + + // when + SpirvRmwExtremum event = (SpirvRmwExtremum) visit(builder, input); + + // then + assertEquals("%result", event.getResultRegister().getName()); + assertEquals(builder.getType("%int"), event.getResultRegister().getType()); + assertEquals(builder.getExpression("%ptr"), event.getAddress()); + assertEquals(IntCmpOp.GT, event.getOperator()); + } + + @Test + public void testIllegalMemoryOrder() { + doTestIllegalMemoryOrder(68, 0, + "%result = OpAtomicLoad %int %ptr %scope %eq", + String.format("SpirvLoad cannot have memory order '%s'", RELEASE)); + doTestIllegalMemoryOrder(72, 0, + "%result = OpAtomicLoad %int %ptr %scope %eq", + String.format("SpirvLoad cannot have memory order '%s'", ACQ_REL)); + doTestIllegalMemoryOrder(66, 0, + "OpAtomicStore %ptr %scope %eq %value", + String.format("SpirvStore cannot have memory order '%s'", ACQUIRE)); + doTestIllegalMemoryOrder(72, 0, + "OpAtomicStore %ptr %scope %eq %value", + String.format("SpirvStore cannot have memory order '%s'", ACQ_REL)); + doTestIllegalMemoryOrder(72, 68, + "%result = OpAtomicCompareExchange %int %ptr %scope %eq %neq %value %cmp", + String.format("SpirvCmpXchg cannot have unequal memory order '%s'", RELEASE)); + doTestIllegalMemoryOrder(72, 72, + "%result = OpAtomicCompareExchange %int %ptr %scope %eq %neq %value %cmp", + String.format("SpirvCmpXchg cannot have unequal memory order '%s'", ACQ_REL)); + doTestIllegalMemoryOrder(64, 66, + "%result = OpAtomicCompareExchange %int %ptr %scope %eq %neq %value %cmp", + String.format("Unequal semantics '%s' is stronger than equal semantics '%s'", ACQUIRE, RELAXED)); + doTestIllegalMemoryOrder(72, 80, + "%result = OpAtomicCompareExchange %int %ptr %scope %eq %neq %value %cmp", + String.format("Unequal semantics '%s' is stronger than equal semantics '%s'", SEQ_CST, ACQ_REL)); + } + + private void doTestIllegalMemoryOrder(int eq, int neq, String input, String error) { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockIntType("%int", 64); + builder.mockPtrType("%int_ptr", "%int", "Uniform"); + builder.mockVariable("%ptr", "%int_ptr"); + builder.mockConstant("%value", "%int", 123); + builder.mockConstant("%cmp", "%int", 456); + builder.mockConstant("%scope", "%int", 1); + builder.mockConstant("%eq", "%int", eq); + builder.mockConstant("%neq", "%int", neq); + + try { + // when + visit(builder, input); + fail("Should throw exception"); + } catch (IllegalArgumentException e) { + // then + assertEquals(error, e.getMessage()); + } + } + + private Event visit(MockProgramBuilder builder, String input) { + builder.mockFunctionStart(true); + return new MockSpirvParser(input).op().accept(new VisitorOpsAtomic(builder)); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsBarrierTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsBarrierTest.java new file mode 100644 index 0000000000..ea2dcbe593 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsBarrierTest.java @@ -0,0 +1,91 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockProgramBuilder; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockSpirvParser; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.event.Tag; +import com.dat3m.dartagnan.program.event.core.ControlBarrier; +import com.dat3m.dartagnan.program.event.core.GenericVisibleEvent; +import org.junit.Test; + +import java.util.Set; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class VisitorOpsBarrierTest { + + private final MockProgramBuilder builder = new MockProgramBuilder(); + + @Test + public void testControlBarrier() { + // given + String input = "OpControlBarrier %uint_2 %uint_2 %uint_264"; + builder.mockIntType("%uint", 64); + builder.mockConstant("%uint_2", "%uint", 2); + builder.mockConstant("%uint_264", "%uint", 264); + + // when + ControlBarrier event = (ControlBarrier) visit(input); + + // then + assertEquals(Set.of(Tag.VISIBLE, Tag.FENCE, Tag.Spirv.CONTROL, Tag.Spirv.ACQ_REL, + Tag.Spirv.WORKGROUP, Tag.Spirv.SEM_WORKGROUP), event.getTags()); + } + + @Test + public void testControlBarrierNoneSemantics() { + // given + String input = "OpControlBarrier %uint_2 %uint_2 %uint_0"; + builder.mockIntType("%uint", 64); + builder.mockConstant("%uint_0", "%uint", 0); + builder.mockConstant("%uint_2", "%uint", 2); + + // when + ControlBarrier event = (ControlBarrier) visit(input); + + // then + assertEquals(Set.of(Tag.VISIBLE, Tag.Spirv.CONTROL, Tag.Spirv.WORKGROUP), event.getTags()); + } + + @Test + public void testMemoryBarrier() { + // given + String input = "OpMemoryBarrier %uint_2 %uint_264"; + builder.mockIntType("%uint", 64); + builder.mockConstant("%uint_2", "%uint", 2); + builder.mockConstant("%uint_264", "%uint", 264); + + // when + GenericVisibleEvent event = (GenericVisibleEvent) visit(input); + + // then + assertEquals(Set.of(Tag.VISIBLE, Tag.FENCE, Tag.Spirv.ACQ_REL, + Tag.Spirv.WORKGROUP, Tag.Spirv.SEM_WORKGROUP), event.getTags()); + } + + @Test + public void testMemoryBarrierNoneSemantics() { + // given + String input = "OpMemoryBarrier %uint_2 %uint_0"; + builder.mockIntType("%uint", 64); + builder.mockConstant("%uint_0", "%uint", 0); + builder.mockConstant("%uint_2", "%uint", 2); + + try { + // when + visit(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Illegal OpMemoryBarrier with semantics None", + e.getMessage()); + } + } + + private Event visit(String text) { + builder.mockFunctionStart(true); + return new MockSpirvParser(text).spv().spvInstructions().accept(new VisitorOpsBarrier(builder)); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsBitsTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsBitsTest.java new file mode 100644 index 0000000000..6c8114d7a0 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsBitsTest.java @@ -0,0 +1,153 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.integers.IntBinaryExpr; +import com.dat3m.dartagnan.expression.integers.IntBinaryOp; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockProgramBuilder; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockSpirvParser; +import com.dat3m.dartagnan.program.event.core.Local; +import org.junit.Test; + +import java.util.List; + +import static com.dat3m.dartagnan.expression.integers.IntBinaryOp.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class VisitorOpsBitsTest { + + @Test + public void testOpsBitwiseInteger() { + doTestOpsBitwiseInteger("OpBitwiseAnd",1, 0); + doTestOpsBitwiseInteger("OpBitwiseOr",1, 65); + doTestOpsBitwiseInteger("OpBitwiseXor",-2, 6); + } + + private void doTestOpsBitwiseInteger(String name, int op1, int op2) { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockIntType("%int", 64); + builder.mockConstant("%value1", "%int", op1); + builder.mockConstant("%value2", "%int", op2); + String input = String.format("%%res = %s %%int %%value1 %%value2", name); + + // when + Local local = visit(builder, input); + + // then + assertEquals(builder.getExpression("%res"), local.getResultRegister()); + IntBinaryExpr expr = (IntBinaryExpr) local.getExpr(); + assertEquals(builder.getExpression("%value1"), expr.getLeft()); + assertEquals(builder.getExpression("%value2"), expr.getRight()); + IntBinaryOp kind = switch (name) { + case "OpBitwiseAnd" -> AND; + case "OpBitwiseOr" -> OR; + case "OpBitwiseXor" -> XOR; + default -> throw new ParsingException("Unsupported operation " + name); + }; + assertEquals(kind, expr.getKind()); + } + + @Test + public void testOpsBitwiseAndVector() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockIntType("%int", 64); + builder.mockVectorType("%vector", "%int", 3); + builder.mockConstant("%value1", "%vector", List.of(1, 2, 3)); + builder.mockConstant("%value2", "%vector", List.of(5, 6, 7)); + String input = "%reg = OpBitwiseAnd %vector %value1 %value2"; + + try { + // when + visit(builder, input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Unsupported result type for '%reg', " + + "vector types are not supported", + e.getMessage()); + } + } + + @Test + public void testOpsShift() { + doTestOpsShift("OpShiftLeftLogical",1, 0); + doTestOpsShift("OpShiftRightLogical",1, 65); + doTestOpsShift("OpShiftRightArithmetic",-2, 6); + } + + private void doTestOpsShift(String name, int op1, int op2) { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockIntType("%int", 64); + builder.mockConstant("%value1", "%int", op1); + builder.mockConstant("%value2", "%int", op2); + String input = String.format("%%res = %s %%int %%value1 %%value2", name); + + // when + Local local = visit(builder, input); + + // then + assertEquals(builder.getExpression("%res"), local.getResultRegister()); + IntBinaryExpr expr = (IntBinaryExpr) local.getExpr(); + assertEquals(builder.getExpression("%value1"), expr.getLeft()); + assertEquals(builder.getExpression("%value2"), expr.getRight()); + IntBinaryOp kind = switch (name) { + case "OpShiftLeftLogical" -> LSHIFT; + case "OpShiftRightLogical" -> RSHIFT; + case "OpShiftRightArithmetic" -> ARSHIFT; + default -> throw new ParsingException("Unsupported operation " + name); + }; + assertEquals(kind, expr.getKind()); + } + + @Test + public void testOpsShiftInvalidResultType() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockIntType("%int", 64); + builder.mockVectorType("%vector", "%int", 3); + builder.mockConstant("%value1", "%int", 1); + builder.mockConstant("%value2", "%int", 2); + String input = "%reg = OpShiftLeftLogical %vector %value1 %value2"; + + try { + // when + visit(builder, input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Unsupported result type for '%reg', " + + "vector types are not supported", + e.getMessage()); + } + } + + @Test + public void testOpsShiftInvalidOperandType() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockIntType("%int", 64); + builder.mockVectorType("%vector", "%int", 3); + builder.mockConstant("%value1", "%vector", List.of(1, 2, 3)); + builder.mockConstant("%value2", "%int", 2); + String input = "%reg = OpShiftLeftLogical %int %value1 %value2"; + + try { + // when + visit(builder, input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Illegal definition for '%reg', " + + "operand '%value1' must be an integer", + e.getMessage()); + } + } + + private Local visit(MockProgramBuilder builder, String input) { + builder.mockFunctionStart(true); + return (Local) new MockSpirvParser(input).op().accept(new VisitorOpsBits(builder)); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsConstantTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsConstantTest.java new file mode 100644 index 0000000000..522818c997 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsConstantTest.java @@ -0,0 +1,836 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.type.AggregateType; +import com.dat3m.dartagnan.expression.type.BooleanType; +import com.dat3m.dartagnan.expression.type.IntegerType; +import com.dat3m.dartagnan.expression.type.TypeFactory; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations.SpecId; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockProgramBuilder; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockSpirvParser; +import org.junit.Test; + +import java.util.List; +import java.util.Map; + +import static com.dat3m.dartagnan.parsers.program.visitors.spirv.decorations.DecorationType.SPEC_ID; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class VisitorOpsConstantTest { + + private static final ExpressionFactory expressions = ExpressionFactory.getInstance(); + private static final IntegerType archType = TypeFactory.getInstance().getArchType(); + private final MockProgramBuilder builder = new MockProgramBuilder(); + private final SpecId specId = (SpecId) builder.getDecorationsBuilder().getDecoration(SPEC_ID); + + @Test + public void testOpConstantBool() { + doTestOpConstantBool(""" + %b1 = OpConstantTrue %bool + %b2 = OpConstantTrue %bool + %b3 = OpConstantFalse %bool + %b4 = OpConstantFalse %bool + """); + } + + @Test + public void testOpSpecConstantBool() { + doTestOpConstantBool(""" + %b1 = OpSpecConstantTrue %bool + %b2 = OpSpecConstantTrue %bool + %b3 = OpSpecConstantFalse %bool + %b4 = OpSpecConstantFalse %bool + """); + } + + private void doTestOpConstantBool(String input) { + // given + builder.mockBoolType("%bool"); + + // when + Map data = parseConstants(input); + + // then + assertEquals(4, data.size()); + assertEquals(expressions.makeTrue(), data.get("%b1")); + assertEquals(expressions.makeTrue(), data.get("%b2")); + assertEquals(expressions.makeFalse(), data.get("%b3")); + assertEquals(expressions.makeFalse(), data.get("%b4")); + } + + @Test + public void testOpConstant() { + doTestOpConstant(""" + %i1 = OpConstant %int16 5 + %i2 = OpConstant %int16 5 + %i3 = OpConstant %int16 10 + %i4 = OpConstant %int32 10 + %i5 = OpConstant %int32 20 + """); + } + + @Test + public void testOpSpecConstant() { + doTestOpConstant(""" + %i1 = OpSpecConstant %int16 5 + %i2 = OpSpecConstant %int16 5 + %i3 = OpSpecConstant %int16 10 + %i4 = OpSpecConstant %int32 10 + %i5 = OpSpecConstant %int32 20 + """); + } + + private void doTestOpConstant(String input) { + // given + IntegerType iType16 = builder.mockIntType("%int16", 16); + IntegerType iType32 = builder.mockIntType("%int32", 32); + + // when + Map data = parseConstants(input); + + // then + assertEquals(5, data.size()); + assertEquals(expressions.makeValue(5, iType16), data.get("%i1")); + assertEquals(expressions.makeValue(5, iType16), data.get("%i2")); + assertEquals(expressions.makeValue(10, iType16), data.get("%i3")); + assertEquals(expressions.makeValue(10, iType32), data.get("%i4")); + assertEquals(expressions.makeValue(20, iType32), data.get("%i5")); + } + + @Test + public void testOpConstantCompositeBoolean() { + doTestOpConstantBoolean(""" + %b1 = OpConstantTrue %bool + %b2 = OpConstantFalse %bool + %b3 = OpConstantTrue %bool + %b3v = OpConstantComposite %bool3v %b1 %b2 %b3 + """); + } + + @Test + public void testOpConstantSpecCompositeBoolean() { + doTestOpConstantBoolean(""" + %b1 = OpSpecConstantTrue %bool + %b2 = OpSpecConstantFalse %bool + %b3 = OpSpecConstantTrue %bool + %b3v = OpSpecConstantComposite %bool3v %b1 %b2 %b3 + """); + } + + private void doTestOpConstantBoolean(String input) { + // given + BooleanType bType = builder.mockBoolType("%bool"); + builder.mockVectorType("%bool3v", "%bool", 3); + + // when + Map data = parseConstants(input); + + // then + assertEquals(4, data.size()); + + Expression bTrue = expressions.makeTrue(); + Expression bFalse = expressions.makeFalse(); + Expression b3v = expressions.makeArray(bType, List.of(bTrue, bFalse, bTrue), true); + + assertEquals(bTrue, data.get("%b1")); + assertEquals(bFalse, data.get("%b2")); + assertEquals(bTrue, data.get("%b3")); + assertEquals(b3v, data.get("%b3v")); + } + + @Test + public void testOpConstantCompositeInteger() { + doTestOpConstantInteger(""" + %i1 = OpConstant %int 1 + %i2 = OpConstant %int 0 + %i3 = OpConstant %int 17 + %i4 = OpConstant %int -123 + %i4v = OpConstantComposite %int4v %i1 %i2 %i3 %i4 + """); + } + + @Test + public void testOpConstantSpecCompositeInteger() { + doTestOpConstantInteger(""" + %i1 = OpSpecConstant %int 1 + %i2 = OpSpecConstant %int 0 + %i3 = OpSpecConstant %int 17 + %i4 = OpSpecConstant %int -123 + %i4v = OpSpecConstantComposite %int4v %i1 %i2 %i3 %i4 + """); + } + + private void doTestOpConstantInteger(String input) { + // given + IntegerType iType = builder.mockIntType("%int", 64); + builder.mockVectorType("%int4v", "%int", 4); + + // when + Map data = parseConstants(input); + + // then + assertEquals(5, data.size()); + + Expression i1 = expressions.makeValue(1, iType); + Expression i2 = expressions.makeValue(0, iType); + Expression i3 = expressions.makeValue(17, iType); + Expression i4 = expressions.makeValue(-123, iType); + Expression i4v = expressions.makeArray(iType, List.of(i1, i2, i3, i4), true); + + assertEquals(i1, data.get("%i1")); + assertEquals(i2, data.get("%i2")); + assertEquals(i3, data.get("%i3")); + assertEquals(i4, data.get("%i4")); + assertEquals(i4v, data.get("%i4v")); + } + + @Test + public void testOpConstantCompositeStruct() { + doTestOpConstantStruct(""" + %b = OpConstantTrue %bool + %i = OpConstant %int 7 + %s = OpConstantComposite %struct %b %i + """); + } + + @Test + public void testOpConstantSpecCompositeStruct() { + doTestOpConstantStruct(""" + %b = OpSpecConstantTrue %bool + %i = OpSpecConstant %int 7 + %s = OpSpecConstantComposite %struct %b %i + """); + } + + private void doTestOpConstantStruct(String input) { + // given + builder.mockBoolType("%bool"); + IntegerType iType = builder.mockIntType("%int", 64); + builder.mockAggregateType("%struct", "%bool", "%int"); + + // when + Map data = parseConstants(input); + + // then + assertEquals(3, data.size()); + + Expression b = expressions.makeTrue(); + Expression i = expressions.makeValue(7, iType); + Expression s = expressions.makeConstruct(List.of(b, i)); + + assertEquals(b, data.get("%b")); + assertEquals(i, data.get("%i")); + assertEquals(s, data.get("%s")); + } + + @Test + public void testOpConstantNull() { + // given + String input = """ + %n1 = OpConstantNull %int16 + %n2 = OpConstantNull %int16 + %n3 = OpConstantNull %int32 + %n4 = OpConstantNull %bool + """; + + builder.mockBoolType("%bool"); + IntegerType iType16 = builder.mockIntType("%int16", 16); + IntegerType iType32 = builder.mockIntType("%int32", 32); + + // when + Map data = parseConstants(input); + + // then + assertEquals(4, data.size()); + assertEquals(expressions.makeValue(0, iType16), data.get("%n1")); + assertEquals(expressions.makeValue(0, iType16), data.get("%n2")); + assertEquals(expressions.makeValue(0, iType32), data.get("%n3")); + assertEquals(expressions.makeFalse(), data.get("%n4")); + } + + @Test + public void testPrimitiveTypes() { + // given + String input = """ + %b1 = OpConstantTrue %bool + %b2 = OpConstantFalse %bool + %b3 = OpConstantNull %bool + %i1 = OpConstant %int 2 + %i2 = OpConstant %int 7 + %i3 = OpConstantNull %int + """; + + builder.mockBoolType("%bool"); + IntegerType iType = builder.mockIntType("%int", 64); + + // when + Map data = parseConstants(input); + + // then + assertEquals(6, data.size()); + assertEquals(expressions.makeTrue(), data.get("%b1")); + assertEquals(expressions.makeFalse(), data.get("%b2")); + assertEquals(expressions.makeFalse(), data.get("%b3")); + assertEquals(expressions.makeValue(2, iType), data.get("%i1")); + assertEquals(expressions.makeValue(7, iType), data.get("%i2")); + assertEquals(expressions.makeValue(0, iType), data.get("%i3")); + } + + @Test + public void testNestedCompositeTypes() { + // given + String input = """ + %b0 = OpConstantFalse %bool + %i0 = OpConstant %int 0 + %s0 = OpConstantComposite %inner %b0 %i0 + %b1 = OpConstantTrue %bool + %i1 = OpConstant %int 1 + %s1 = OpConstantComposite %inner %b1 %i1 + %b2 = OpConstantTrue %bool + %i2 = OpConstant %int 2 + %s2 = OpConstantComposite %inner %b2 %i2 + %a0 = OpConstantComposite %v2inner %s1 %s2 + %s = OpConstantComposite %outer %s0 %a0 + """; + + builder.mockBoolType("%bool"); + IntegerType iType = builder.mockIntType("%int", 64); + AggregateType aType = builder.mockAggregateType("%inner", "%bool", "%int"); + builder.mockVectorType("%v2inner", "%inner", 2); + builder.mockAggregateType("%outer", "%inner", "%v2inner"); + + // when + Map data = parseConstants(input); + + // then + assertEquals(11, data.size()); + + Expression b0 = expressions.makeFalse(); + Expression b1 = expressions.makeTrue(); + Expression b2 = expressions.makeTrue(); + + Expression i0 = expressions.makeValue(0, iType); + Expression i1 = expressions.makeValue(1, iType); + Expression i2 = expressions.makeValue(2, iType); + + Expression s0 = expressions.makeConstruct(List.of(b0, i0)); + Expression s1 = expressions.makeConstruct(List.of(b1, i1)); + Expression s2 = expressions.makeConstruct(List.of(b2, i2)); + + Expression a0 = expressions.makeArray(aType, List.of(s1, s2), true); + Expression s = expressions.makeConstruct(List.of(s0, a0)); + + assertEquals(b0, data.get("%b0")); + assertEquals(b1, data.get("%b1")); + assertEquals(b2, data.get("%b2")); + + assertEquals(i0, data.get("%i0")); + assertEquals(i1, data.get("%i1")); + assertEquals(i2, data.get("%i2")); + + assertEquals(s0, data.get("%s0")); + assertEquals(s1, data.get("%s1")); + assertEquals(s2, data.get("%s2")); + + assertEquals(a0, data.get("%a0")); + assertEquals(s, data.get("%s")); + } + + @Test + public void testOpConstantUnsupported() { + // given + String input = "%const = OpConstant %bool 12345"; + builder.mockBoolType("%bool"); + + try { + // when + parseConstants(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Illegal constant type 'bool'", e.getMessage()); + } + } + + @Test + public void testRedefiningConstantValue() { + // given + String input = """ + %const = OpConstant %int 1 + %const = OpConstant %int 2 + """; + + builder.mockIntType("%int", 64); + + try { + // when + parseConstants(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Duplicated definition '%const'", e.getMessage()); + } + } + + @Test + public void testReferenceToBaseConstantInSpec() { + // given + String input = """ + %b1 = OpSpecConstantTrue %bool + %b2 = OpSpecConstantFalse %bool + %b3 = OpConstantTrue %bool + %b3v = OpSpecConstantComposite %bool3v %b1 %b2 %b3 + """; + + builder.mockBoolType("%bool"); + builder.mockVectorType("%bool3v", "%bool", 3); + + try { + // when + parseConstants(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Reference to base constant '%b3' " + + "from spec composite constant '%b3v'", e.getMessage()); + } + } + + @Test + public void testReferenceToSpecConstantInBase() { + // given + String input = """ + %b1 = OpConstantTrue %bool + %b2 = OpConstantFalse %bool + %b3 = OpSpecConstantTrue %bool + %b3v = OpConstantComposite %bool3v %b1 %b2 %b3 + """; + + builder.mockBoolType("%bool"); + builder.mockVectorType("%bool3v", "%bool", 3); + + try { + // when + parseConstants(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Reference to spec constant '%b3' " + + "from base composite constant '%b3v'", e.getMessage()); + } + } + + @Test + public void testIllegalCompositeType() { + // given + String input = """ + %b1 = OpConstantTrue %bool + %b2 = OpConstantFalse %bool + %b3 = OpConstantTrue %bool + %b3v = OpConstantComposite %bool %b1 %b2 %b3 + """; + + builder.mockBoolType("%bool"); + + try { + // when + parseConstants(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Illegal type 'bool' for composite constant '%b3v'", + e.getMessage()); + } + } + + @Test + public void testMismatchingArrayElementType() { + // given + String input = """ + %i1 = OpConstant %int 1 + %i2 = OpConstant %int 2 + %b1 = OpConstantTrue %bool + %i3v = OpConstantComposite %int3v %i1 %i2 %b1 + """; + + builder.mockBoolType("%bool"); + builder.mockIntType("%int", 64); + builder.mockVectorType("%int3v", "%int", 3); + + try { + // when + parseConstants(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Mismatching type of a composite constant '%i3v' element '%b1', " + + "expected 'bv64' but received 'bool'", e.getMessage()); + } + } + + @Test + public void testMismatchingStructElementType() { + // given + String input = """ + %i1 = OpConstant %int 1 + %i2 = OpConstant %int 2 + %s = OpConstantComposite %struct %i1 %i2 + """; + + builder.mockBoolType("%bool"); + builder.mockIntType("%int", 64); + builder.mockAggregateType("%struct", "%int", "%bool"); + + try { + // when + parseConstants(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Mismatching type of a composite constant '%s' element '%i2', " + + "expected 'bool' but received 'bv64'", e.getMessage()); + } + } + + @Test + public void testMismatchingArrayElementsSize() { + // given + String input = """ + %i1 = OpConstant %int 1 + %i2 = OpConstant %int 2 + %i3v = OpConstantComposite %int3v %i1 %i2 + """; + + builder.mockIntType("%int", 64); + builder.mockVectorType("%int3v", "%int", 3); + + try { + // when + parseConstants(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Mismatching number of elements in the composite constant '%i3v', " + + "expected 3 elements but received 2 elements", e.getMessage()); + } + } + + @Test + public void testMismatchingStructElementsSize() { + // given + String input = """ + %i = OpConstant %int 1 + %s = OpConstantComposite %struct %i + """; + + builder.mockBoolType("%bool"); + builder.mockIntType("%int", 64); + builder.mockAggregateType("%struct", "%int", "%bool"); + + try { + // when + parseConstants(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Mismatching number of elements in the composite constant '%s', " + + "expected 2 elements but received 1 elements", e.getMessage()); + } + } + + @Test + public void testSpecConstantFalseOverride() { + // given + String input = """ + %f1 = OpSpecConstantFalse %bool + %f2 = OpSpecConstantFalse %bool + %f3 = OpSpecConstantFalse %bool + %f4 = OpSpecConstantFalse %bool + %b4v = OpSpecConstantComposite %bool4v %f1 %f2 %f3 %f4 + """; + + BooleanType bType = builder.mockBoolType("%bool"); + builder.mockVectorType("%bool4v", "%bool", 4); + specId.addDecoration("%f1", "1"); + specId.addDecoration("%f3", "123"); + specId.addDecoration("%f4", "0"); + + // when + Map data = parseConstants(input); + + // then + Expression f1 = expressions.makeTrue(); + Expression f2 = expressions.makeFalse(); + Expression f3 = expressions.makeTrue(); + Expression f4 = expressions.makeFalse(); + + assertEquals(f1, data.get("%f1")); + assertEquals(f2, data.get("%f2")); + assertEquals(f3, data.get("%f3")); + assertEquals(f4, data.get("%f4")); + + assertEquals(expressions.makeArray(bType, List.of(f1, f2, f3, f4), true), + data.get("%b4v")); + } + + @Test + public void testSpecConstantTrueOverride() { + // given + String input = """ + %t1 = OpSpecConstantTrue %bool + %t2 = OpSpecConstantTrue %bool + %t3 = OpSpecConstantTrue %bool + %t4 = OpSpecConstantTrue %bool + %b4v = OpSpecConstantComposite %bool4v %t1 %t2 %t3 %t4 + """; + + BooleanType bType = builder.mockBoolType("%bool"); + builder.mockVectorType("%bool4v", "%bool", 4); + specId.addDecoration("%t1", "0"); + specId.addDecoration("%t3", "123"); + specId.addDecoration("%t4", "1"); + + // when + Map data = parseConstants(input); + + // then + Expression t1 = expressions.makeFalse(); + Expression t2 = expressions.makeTrue(); + Expression t3 = expressions.makeTrue(); + Expression t4 = expressions.makeTrue(); + + assertEquals(t1, data.get("%t1")); + assertEquals(t2, data.get("%t2")); + assertEquals(t3, data.get("%t3")); + assertEquals(t4, data.get("%t4")); + + assertEquals(expressions.makeArray(bType, List.of(t1, t2, t3, t4), true), + data.get("%b4v")); + } + + @Test + public void testSpecConstantOverride() { + // given + String input = """ + %i1 = OpSpecConstant %int 1 + %i2 = OpSpecConstant %int 2 + %i3 = OpSpecConstant %int 3 + %i3v = OpSpecConstantComposite %int3v %i1 %i2 %i3 + """; + + IntegerType iType = builder.mockIntType("%int", 64); + builder.mockVectorType("%int3v", "%int", 3); + specId.addDecoration("%i1", "11"); + specId.addDecoration("%i3", "3"); + + // when + Map data = parseConstants(input); + + // then + Expression i1 = expressions.makeValue(11, iType); + Expression i2 = expressions.makeValue(2, iType); + Expression i3 = expressions.makeValue(3, iType); + + assertEquals(i1, data.get("%i1")); + assertEquals(i2, data.get("%i2")); + assertEquals(i3, data.get("%i3")); + + assertEquals(expressions.makeArray(iType, List.of(i1, i2, i3), true), data.get("%i3v")); + } + + @Test + public void testOverrideNotSpecConstant() { + // given + String input = """ + %f = OpConstantFalse %bool + %t = OpConstantTrue %bool + %i = OpConstant %int 1 + %s = OpConstantComposite %struct %f %t %i + """; + + builder.mockBoolType("%bool"); + IntegerType iType = builder.mockIntType("%int", 64); + builder.mockAggregateType("%struct", "%bool", "%bool", "%int"); + specId.addDecoration("%f", "1"); + specId.addDecoration("%t", "0"); + specId.addDecoration("%i", "2"); + + // when + Map data = parseConstants(input); + + // then + Expression f = expressions.makeFalse(); + Expression t = expressions.makeTrue(); + Expression i = expressions.makeValue(1, iType); + + assertEquals(f, data.get("%f")); + assertEquals(t, data.get("%t")); + assertEquals(i, data.get("%i")); + + assertEquals(expressions.makeConstruct(List.of(f, t, i)), data.get("%s")); + } + + @Test + public void testSpecConstantFalseInput() { + // given + String input = """ + %f1 = OpSpecConstantFalse %bool + %f2 = OpSpecConstantFalse %bool + %f3 = OpSpecConstantFalse %bool + %f4 = OpSpecConstantFalse %bool + %f5 = OpSpecConstantFalse %bool + %b5v = OpSpecConstantComposite %bool5v %f1 %f2 %f3 %f4 %f5 + """; + + Expression zero = expressions.makeValue(0, archType); + Expression one = expressions.makeValue(1, archType); + builder.addInput("%f2", zero); + builder.addInput("%f3", one); + builder.addInput("%f4", zero); + builder.addInput("%f5", one); + + BooleanType bType = builder.mockBoolType("%bool"); + builder.mockVectorType("%bool5v", "%bool", 5); + specId.addDecoration("%f4", "1"); + specId.addDecoration("%f5", "0"); + + // when + Map data = parseConstants(input); + + // then + Expression f1 = expressions.makeFalse(); + Expression f2 = expressions.makeFalse(); + Expression f3 = expressions.makeTrue(); + Expression f4 = expressions.makeFalse(); + Expression f5 = expressions.makeTrue(); + + assertEquals(f1, data.get("%f1")); + assertEquals(f2, data.get("%f2")); + assertEquals(f3, data.get("%f3")); + assertEquals(f4, data.get("%f4")); + + assertEquals(expressions.makeArray(bType, List.of(f1, f2, f3, f4, f5), true), + data.get("%b5v")); + } + + @Test + public void testSpecConstantTrueInput() { + // given + String input = """ + %t1 = OpSpecConstantTrue %bool + %t2 = OpSpecConstantTrue %bool + %t3 = OpSpecConstantTrue %bool + %t4 = OpSpecConstantTrue %bool + %t5 = OpSpecConstantTrue %bool + %b5v = OpSpecConstantComposite %bool5v %t1 %t2 %t3 %t4 %t5 + """; + + Expression zero = expressions.makeValue(0, archType); + Expression one = expressions.makeValue(1, archType); + builder.addInput("%t2", one); + builder.addInput("%t3", zero); + builder.addInput("%t4", one); + builder.addInput("%t5", zero); + + BooleanType bType = builder.mockBoolType("%bool"); + builder.mockVectorType("%bool5v", "%bool", 5); + specId.addDecoration("%t4", "0"); + specId.addDecoration("%t5", "1"); + + // when + Map data = parseConstants(input); + + // then + Expression t1 = expressions.makeTrue(); + Expression t2 = expressions.makeTrue(); + Expression t3 = expressions.makeFalse(); + Expression t4 = expressions.makeTrue(); + Expression t5 = expressions.makeFalse(); + + assertEquals(t1, data.get("%t1")); + assertEquals(t2, data.get("%t2")); + assertEquals(t3, data.get("%t3")); + assertEquals(t4, data.get("%t4")); + assertEquals(t5, data.get("%t5")); + + assertEquals(expressions.makeArray(bType, List.of(t1, t2, t3, t4, t5), true), + data.get("%b5v")); + } + + @Test + public void testSpecConstantInput() { + // given + String input = """ + %i1 = OpSpecConstant %int 1 + %i2 = OpSpecConstant %int 2 + %i3 = OpSpecConstant %int 3 + %i3v = OpSpecConstantComposite %int3v %i1 %i2 %i3 + """; + + Expression eleven = expressions.makeValue(11, archType); + Expression three = expressions.makeValue(3, archType); + builder.addInput("%i1", eleven); + builder.addInput("%i3", three); + + IntegerType iType = builder.mockIntType("%int", 64); + builder.mockVectorType("%int3v", "%int", 3); + + // when + Map data = parseConstants(input); + + // then + Expression i1 = expressions.makeValue(11, iType); + Expression i2 = expressions.makeValue(2, iType); + Expression i3 = expressions.makeValue(3, iType); + + assertEquals(i1, data.get("%i1")); + assertEquals(i2, data.get("%i2")); + assertEquals(i3, data.get("%i3")); + + assertEquals(expressions.makeArray(iType, List.of(i1, i2, i3), true), data.get("%i3v")); + } + + @Test + public void testInputNotSpecConstant() { + // given + String input = """ + %f = OpConstantFalse %bool + %t = OpConstantTrue %bool + %i = OpConstant %int 1 + %s = OpConstantComposite %struct %f %t %i + """; + + Expression zero = expressions.makeValue(0, archType); + Expression one = expressions.makeValue(1, archType); + Expression two = expressions.makeValue(2, archType); + builder.addInput("%f", one); + builder.addInput("%t", zero); + builder.addInput("%i", two); + + builder.mockBoolType("%bool"); + IntegerType iType = builder.mockIntType("%int", 64); + builder.mockAggregateType("%struct", "%bool", "%bool", "%int"); + + // when + Map data = parseConstants(input); + + // then + Expression f = expressions.makeFalse(); + Expression t = expressions.makeTrue(); + Expression i = expressions.makeValue(1, iType); + + assertEquals(f, data.get("%f")); + assertEquals(t, data.get("%t")); + assertEquals(i, data.get("%i")); + + assertEquals(expressions.makeConstruct(List.of(f, t, i)), data.get("%s")); + } + + private Map parseConstants(String input) { + new MockSpirvParser(input).spv().accept(new VisitorOpsConstant(builder)); + return builder.getExpressions(); + } +} \ No newline at end of file diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsControlFlowTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsControlFlowTest.java new file mode 100644 index 0000000000..39f9212d2e --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsControlFlowTest.java @@ -0,0 +1,695 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.booleans.BoolLiteral; +import com.dat3m.dartagnan.expression.type.FunctionType; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockControlFlowBuilder; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockProgramBuilder; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockSpirvParser; +import com.dat3m.dartagnan.program.Function; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.event.core.CondJump; +import com.dat3m.dartagnan.program.event.core.IfAsJump; +import com.dat3m.dartagnan.program.event.core.Label; +import com.dat3m.dartagnan.program.event.core.Skip; +import com.dat3m.dartagnan.program.event.functions.Return; +import org.junit.Test; + +import java.util.List; +import java.util.Map; + +import static org.junit.Assert.*; + +public class VisitorOpsControlFlowTest { + + private final MockProgramBuilder builder = new MockProgramBuilder(); + private final MockControlFlowBuilder cfBuilder = (MockControlFlowBuilder) builder.getControlFlowBuilder(); + + @Test + public void testOpPhi() { + // given + String input = "%phi = OpPhi %int %value1 %label1 %value2 %label2"; + builder.mockIntType("%int", 64); + builder.mockFunctionStart(false); + + // when + visit(input); + + // then + Register register = builder.getCurrentFunction().getRegister("%phi"); + assertEquals(builder.getType("%int"), register.getType()); + + Map phi1 = cfBuilder.getPhiDefinitions("%label1"); + assertEquals(1, phi1.size()); + assertEquals("%value1", phi1.get(register)); + + Map phi2 = cfBuilder.getPhiDefinitions("%label2"); + assertEquals(1, phi2.size()); + assertEquals("%value2", phi2.get(register)); + } + + @Test + public void testOpLabel() { + // given + String input = """ + %label1 = OpLabel + %label2 = OpLabel + """; + + builder.mockFunctionStart(false); + + // when + visit(input); + + // then + assertEquals(List.of("%label2", "%label1"), cfBuilder.getBlockStack()); + + // when + cfBuilder.endBlock(new Skip()); + + // then + assertEquals(List.of("%label1"), cfBuilder.getBlockStack()); + + // when + cfBuilder.endBlock(new Skip()); + + // then + assertEquals(List.of(), cfBuilder.getBlockStack()); + } + + @Test + public void testOpBranch() { + // given + String input = """ + %label = OpLabel + OpBranch %label + """; + + builder.mockFunctionStart(false); + + // when + visit(input); + + // then + Function function = builder.getCurrentFunction(); + CondJump condJump = (CondJump) function.getEvents().get(1); + assertTrue(((BoolLiteral) (condJump.getGuard())).getValue()); + assertEquals("%label", condJump.getLabel().getName()); + assertTrue(cfBuilder.getBlockStack().isEmpty()); + } + + @Test + public void testOpBranchNested() { + // given + String input = """ + %label1 = OpLabel + %label2 = OpLabel + OpBranch %label3 + %label3 = OpLabel + OpBranch %label2 + """; + + builder.mockFunctionStart(false); + + // when + visit(input); + + // then + Function function = builder.getCurrentFunction(); + + CondJump condJump1 = (CondJump) function.getEvents().get(2); + assertTrue(((BoolLiteral) (condJump1.getGuard())).getValue()); + assertEquals("%label3", condJump1.getLabel().getName()); + + CondJump condJump2 = (CondJump) function.getEvents().get(4); + assertTrue(((BoolLiteral) (condJump2.getGuard())).getValue()); + assertEquals("%label2", condJump2.getLabel().getName()); + + assertEquals(List.of("%label1"), cfBuilder.getBlockStack()); + } + + @Test + public void testStructuredBranch() { + // given + String input = """ + %label0 = OpLabel + OpSelectionMerge %label2 None + OpBranchConditional %value %label1 %label2 + %label1 = OpLabel + OpBranch %label2 + %label2 = OpLabel + OpReturn + """; + + builder.mockBoolType("%bool"); + builder.mockUndefinedValue("%value", "%bool"); + builder.mockFunctionStart(false); + + // when + visit(input); + + // then + List events = builder.getCurrentFunction().getEvents(); + + Label label0 = (Label) events.get(0); + IfAsJump ifJump = (IfAsJump) events.get(1); + Label label1 = (Label) events.get(2); + CondJump jump = (CondJump) events.get(3); + Label label2 = (Label) events.get(4); + Return ret = (Return) events.get(5); + + assertEquals("%label0", label0.getName()); + assertEquals("%label2", ifJump.getLabel().getName()); + assertEquals("%label2_end", ifJump.getEndIf().getName()); + assertEquals("%label1", label1.getName()); + assertEquals("%label2", jump.getLabel().getName()); + assertEquals("%label2", label2.getName()); + + assertTrue(jump.isGoto()); + assertEquals(Map.of("%label2", "%label2_end"), cfBuilder.getMergeLabelIds()); + assertEquals(Map.of("%label0", ifJump, "%label1", jump, "%label2", ret), + cfBuilder.getLastBlockEvents()); + } + + @Test + public void testStructuredBranchNestedTrue() { + // given + String input = """ + %label0 = OpLabel + OpSelectionMerge %label2 None + OpBranchConditional %value %label1 %label2 + %label1 = OpLabel + OpSelectionMerge %label2_inner None + OpBranchConditional %value %label1_inner %label2_inner + %label1_inner = OpLabel + OpBranch %label2_inner + %label2_inner = OpLabel + OpBranch %label2 + %label2 = OpLabel + OpReturn + """; + + builder.mockFunctionStart(false); + builder.mockBoolType("%bool"); + builder.mockUndefinedValue("%value", "%bool"); + + // when + visit(input); + + // then + List events = builder.getCurrentFunction().getEvents(); + + Label label0 = (Label) events.get(0); + IfAsJump ifJump = (IfAsJump) events.get(1); + Label label1 = (Label) events.get(2); + IfAsJump ifJumpInner = (IfAsJump) events.get(3); + Label label1Inner = (Label) events.get(4); + CondJump jumpInner = (CondJump) events.get(5); + Label label2Inner = (Label) events.get(6); + CondJump jump = (CondJump) events.get(7); + Label label2 = (Label) events.get(8); + Return ret = (Return) events.get(9); + + assertEquals("%label0", label0.getName()); + assertEquals("%label2", ifJump.getLabel().getName()); + assertEquals("%label2_end", ifJump.getEndIf().getName()); + assertEquals("%label1", label1.getName()); + assertEquals("%label2_inner", ifJumpInner.getLabel().getName()); + assertEquals("%label2_inner_end", ifJumpInner.getEndIf().getName()); + assertEquals("%label1_inner", label1Inner.getName()); + assertEquals("%label2_inner", jumpInner.getLabel().getName()); + assertEquals("%label2_inner", label2Inner.getName()); + assertEquals("%label2", jump.getLabel().getName()); + assertEquals("%label2", jump.getLabel().getName()); + assertEquals("%label2", label2.getName()); + + assertTrue(jump.isGoto()); + assertTrue(jumpInner.isGoto()); + + assertEquals(Map.of( + "%label0", ifJump, + "%label1", ifJumpInner, + "%label1_inner", jumpInner, + "%label2_inner", jump, + "%label2", ret + ), cfBuilder.getLastBlockEvents()); + } + + @Test + public void testStructuredBranchNestedFalse() { + // given + String input = """ + %label0 = OpLabel + OpSelectionMerge %label2 None + OpBranchConditional %value %label1 %label3 + %label1 = OpLabel + OpBranch %label2 + %label2 = OpLabel + OpSelectionMerge %label2_inner None + OpBranchConditional %value %label1_inner %label2_inner + %label1_inner = OpLabel + OpBranch %label2_inner + %label2_inner = OpLabel + OpBranch %label3 + %label3 = OpLabel + OpReturn + """; + + builder.mockFunctionStart(false); + builder.mockBoolType("%bool"); + builder.mockUndefinedValue("%value", "%bool"); + + // when + visit(input); + + // then + List events = builder.getCurrentFunction().getEvents(); + + Label label0 = (Label) events.get(0); + IfAsJump ifJump = (IfAsJump) events.get(1); + Label label1 = (Label) events.get(2); + CondJump jump1 = (CondJump) events.get(3); + Label label2 = (Label) events.get(4); + IfAsJump ifJumpInner = (IfAsJump) events.get(5); + Label label1Inner = (Label) events.get(6); + CondJump jumpInner = (CondJump) events.get(7); + Label label2Inner = (Label) events.get(8); + CondJump jump2 = (CondJump) events.get(9); + Label label3 = (Label) events.get(10); + Return ret = (Return) events.get(11); + + assertEquals("%label0", label0.getName()); + assertEquals("%label3", ifJump.getLabel().getName()); + assertEquals("%label3_end", ifJump.getEndIf().getName()); + assertEquals("%label2", jump1.getLabel().getName()); + assertEquals("%label1", label1.getName()); + assertEquals("%label2", label2.getName()); + assertEquals("%label2_inner", ifJumpInner.getLabel().getName()); + assertEquals("%label2_inner_end", ifJumpInner.getEndIf().getName()); + assertEquals("%label1_inner", label1Inner.getName()); + assertEquals("%label2_inner", jumpInner.getLabel().getName()); + assertEquals("%label2_inner", label2Inner.getName()); + assertEquals("%label3", jump2.getLabel().getName()); + assertEquals("%label3", label3.getName()); + + assertTrue(jump1.isGoto()); + assertTrue(jump2.isGoto()); + assertTrue(jumpInner.isGoto()); + + assertEquals(Map.of( + "%label0", ifJump, + "%label1", jump1, + "%label2", ifJumpInner, + "%label1_inner", jumpInner, + "%label2_inner", jump2, + "%label3", ret + ), cfBuilder.getLastBlockEvents()); + } + + @Test + public void testStructuredBranchNestedSameLabel() { + // given + String input = """ + %label0 = OpLabel + OpSelectionMerge %label2 None + OpBranchConditional %value %label1 %label2 + %label1 = OpLabel + OpSelectionMerge %label2 None + OpBranchConditional %value %label1_inner %label2 + %label1_inner = OpLabel + OpBranch %label2 + %label2 = OpLabel + OpReturn + """; + + builder.mockFunctionStart(false); + builder.mockBoolType("%bool"); + builder.mockUndefinedValue("%value", "%bool"); + + try { + // when + visit(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Attempt to redefine label '%label2_end'", e.getMessage()); + } + } + + @Test + public void testLoopWithForwardLabels() { + // given + String input = """ + %label0 = OpLabel + OpLoopMerge %label1 %label2 None + OpBranchConditional %value %label1 %label2 + %label1 = OpLabel + OpBranch %label2 + %label2 = OpLabel + OpReturn + """; + + builder.mockFunctionStart(false); + builder.mockBoolType("%bool"); + builder.mockUndefinedValue("%value", "%bool"); + + // when + visit(input); + + // then + List events = builder.getCurrentFunction().getEvents(); + + Label label0 = (Label) events.get(0); + CondJump jump1 = (CondJump) events.get(1); + CondJump jump2 = (CondJump) events.get(2); + Label label1 = (Label) events.get(3); + CondJump jump3 = (CondJump) events.get(4); + Label label2 = (Label) events.get(5); + Return ret = (Return) events.get(6); + + assertEquals("%label0", label0.getName()); + assertEquals("%label1", jump1.getLabel().getName()); + assertEquals("%label2", jump2.getLabel().getName()); + assertEquals("%label1", label1.getName()); + assertEquals("%label2", jump2.getLabel().getName()); + assertEquals("%label2", label2.getName()); + + assertFalse(jump1.isGoto()); + assertTrue(jump2.isGoto()); + assertTrue(jump3.isGoto()); + + assertTrue(cfBuilder.getMergeLabelIds().isEmpty()); + + assertEquals(Map.of("%label0", jump1, "%label1", jump3, "%label2", ret), + cfBuilder.getLastBlockEvents()); + } + + @Test + public void testLoopWithBackwardLabel() { + // given + String input = """ + %label0 = OpLabel + OpLoopMerge %label1 %label0 None + OpBranchConditional %value %label1 %label0 + %label1 = OpLabel + OpReturn + """; + + builder.mockFunctionStart(false); + builder.mockBoolType("%bool"); + builder.mockUndefinedValue("%value", "%bool"); + + // when + visit(input); + + // then + List events = builder.getCurrentFunction().getEvents(); + + Label label0 = (Label) events.get(0); + CondJump jump1 = (CondJump) events.get(1); + CondJump jump2 = (CondJump) events.get(2); + Label label1 = (Label) events.get(3); + Return ret = (Return) events.get(4); + + assertEquals("%label0", label0.getName()); + assertEquals("%label1", jump1.getLabel().getName()); + assertEquals("%label0", jump2.getLabel().getName()); + assertEquals("%label1", label1.getName()); + + assertFalse(jump1.isGoto()); + assertTrue(jump2.isGoto()); + + assertTrue(cfBuilder.getMergeLabelIds().isEmpty()); + + assertEquals(Map.of("%label0", jump1, "%label1", ret), + cfBuilder.getLastBlockEvents()); + } + + @Test + public void testStructuredBranchBackwardTrue() { + doTestIllegalStructuredBranch(""" + %label0 = OpLabel + OpSelectionMerge %label1 None + OpBranchConditional %value1 %label0 %label1 + %label1 = OpLabel + OpReturn + """, + "Illegal backward jump to '%label0' " + + "from a structured branch"); + } + + @Test + public void testStructuredBranchBackwardFalse() { + doTestIllegalStructuredBranch(""" + %label0 = OpLabel + OpSelectionMerge %label0 None + OpBranchConditional %value1 %label1 %label0 + %label1 = OpLabel + OpReturn + """, + "Illegal backward jump to '%label0' " + + "from a structured branch"); + } + + @Test + public void testStructuredBranchLabelsIllegalOrder() { + doTestIllegalStructuredBranch(""" + %label0 = OpLabel + OpSelectionMerge %label1 None + OpBranchConditional %value1 %label2 %label1 + %label1 = OpLabel + OpBranch %label2 + %label2 = OpLabel + OpReturn + """, + "Illegal label, expected '%label2' but received '%label1'"); + } + + @Test + public void testLoopMergeWithTwoBackwardLabels() { + doTestIllegalStructuredBranch(""" + %label2 = OpLabel + OpBranch %label0 + %label0 = OpLabel + OpLoopMerge %label2 %label0 None + OpBranchConditional %value1 %label2 %label0 + %label1 = OpLabel + OpReturn + """, + "Unsupported conditional branch " + + "with two backward jumps to '%label2' and '%label0'"); + } + + @Test + public void testOpLoopIllegalTrueLabel() { + doTestIllegalStructuredBranch(""" + %label0 = OpLabel + OpLoopMerge %label1 %label0 None + OpBranchConditional %value1 %label0 %label1 + %label1 = OpLabel + OpReturn + """, + "Illegal label, expected '%label0' but received '%label1'"); + } + + private void doTestIllegalStructuredBranch(String input, String error) { + // given + builder.mockFunctionStart(false); + builder.mockBoolType("%bool"); + builder.mockUndefinedValue("%value1", "%bool"); + + try { + // when + visit(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals(error, e.getMessage()); + } + } + + @Test + public void testOpBranchConditionalUnstructured() { + // given + String input = """ + %label0 = OpLabel + OpBranchConditional %value1 %label1 %label2 + %label1 = OpLabel + OpBranchConditional %value2 %label2 %label1 + %label2 = OpLabel + OpReturn + """; + + builder.mockFunctionStart(false); + builder.mockBoolType("%bool"); + builder.mockUndefinedValue("%value1", "%bool"); + builder.mockUndefinedValue("%value2", "%bool"); + + // when + visit(input); + + // then + List events = builder.getCurrentFunction().getEvents(); + + Label label0 = (Label) events.get(0); + CondJump jump1 = (CondJump) events.get(1); + CondJump jump2 = (CondJump) events.get(2); + Label label1 = (Label) events.get(3); + CondJump jump3 = (CondJump) events.get(4); + CondJump jump4 = (CondJump) events.get(5); + Label label2 = (Label) events.get(6); + Return ret = (Return) events.get(7); + + assertEquals("%label0", label0.getName()); + assertEquals("%label1", jump1.getLabel().getName()); + assertEquals("%label2", jump2.getLabel().getName()); + assertEquals("%label1", label1.getName()); + assertEquals("%label2", jump3.getLabel().getName()); + assertEquals("%label1", jump4.getLabel().getName()); + assertEquals("%label2", label2.getName()); + + assertFalse(jump1.isGoto()); + assertTrue(jump2.isGoto()); + assertFalse(jump3.isGoto()); + assertTrue(jump4.isGoto()); + + assertTrue(cfBuilder.getBlockStack().isEmpty()); + assertEquals(Map.of("%label0", jump1, "%label1", jump3, "%label2", ret), + cfBuilder.getLastBlockEvents()); + } + + @Test + public void testOpBranchConditionalSameLabels() { + // given + String input = """ + %label0 = OpLabel + OpBranchConditional %value %label1 %label1 + """; + + builder.mockFunctionStart(false); + builder.mockBoolType("%bool"); + builder.mockUndefinedValue("%value", "%bool"); + + try { + // when + visit(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Labels of conditional branch cannot be the same", e.getMessage()); + } + } + + @Test + public void testOpLabelRedefining() { + // given + String input = """ + %label = OpLabel + OpBranch %label + %label = OpLabel + """; + + builder.mockFunctionStart(false); + + try { + // when + visit(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Attempt to redefine label '%label'", e.getMessage()); + } + } + + @Test + public void testReturn() { + // given + builder.mockVoidType("%void"); + FunctionType fType = builder.mockFunctionType("%void_func", "%void"); + Function function = new Function("%func", fType, List.of(), 0, null); + builder.startCurrentFunction(function); + builder.addEvent(mockStartLabel()); + + // when + visit("OpReturn"); + + // then + Return event = (Return) function.getEvents().get(1); + assertNotNull(event); + assertTrue(event.getValue().isEmpty()); + assertTrue(cfBuilder.getBlockStack().isEmpty()); + } + + @Test + public void testReturnValue() { + // given + builder.mockIntType("%int", 64); + builder.mockConstant("%value", "%int", 5); + FunctionType fType = builder.mockFunctionType("%int_func", "%int"); + Function function = new Function("%func", fType, List.of(), 0, null); + builder.startCurrentFunction(function); + builder.addEvent(mockStartLabel()); + + // when + visit("OpReturnValue %value"); + + // then + Return event = (Return) function.getEvents().get(1); + assertEquals(builder.getExpression("%value"), event.getValue().orElseThrow()); + assertTrue(cfBuilder.getBlockStack().isEmpty()); + } + + @Test + public void testReturnForValueFunction() { + // given + builder.mockVoidType("%void"); + builder.mockIntType("%int", 64); + builder.mockConstant("%value", "%int", 5); + FunctionType fType = builder.mockFunctionType("%int_func", "%int"); + Function function = new Function("%func", fType, List.of(), 0, null); + builder.startCurrentFunction(function); + builder.addEvent(mockStartLabel()); + + try { + // when + visit("OpReturn"); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Illegal non-value return for a non-void function '%func'", + e.getMessage()); + } + } + + @Test + public void testReturnValueForVoidFunction() { + // given + builder.mockVoidType("%void"); + builder.mockIntType("%int", 64); + builder.mockConstant("%value", "%int", 5); + FunctionType fType = builder.mockFunctionType("%void_func", "%void"); + Function function = new Function("%func", fType, List.of(), 0, null); + builder.startCurrentFunction(function); + builder.addEvent(mockStartLabel()); + + try { + // when + visit("OpReturnValue %value"); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Illegal value return for a void function '%func'", e.getMessage()); + } + } + + private Label mockStartLabel() { + Label label = cfBuilder.getOrCreateLabel("%mock_label"); + cfBuilder.startBlock("%mock_label"); + return label; + } + + private void visit(String text) { + new MockSpirvParser(text).spv().accept(new VisitorOpsControlFlow(builder)); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsExtensionTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsExtensionTest.java new file mode 100644 index 0000000000..6c84e3e0cc --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsExtensionTest.java @@ -0,0 +1,99 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.integers.IntLiteral; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockProgramBuilder; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockSpirvParser; +import com.dat3m.dartagnan.program.memory.ScopedPointerVariable; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class VisitorOpsExtensionTest { + + private final MockProgramBuilder builder = new MockProgramBuilder(); + + @Test + public void testSupportedInstruction() { + // given + String input = """ + %1 = OpExtInstImport "NonSemantic.ClspvReflection.5" + %2 = OpExtInst %void %1 PushConstantNumWorkgroups %uint_0 %uint_12 + """; + + builder.mockIntType("%uint", 32); + builder.mockVectorType("%v3uint", "%uint", 3); + builder.mockAggregateType("%1x_v3uint", "%v3uint"); + builder.mockPtrType("%ptr_1x_v3uint", "%1x_v3uint", "PushConstant"); + builder.mockConstant("%uint_0", "%uint", 0); + builder.mockConstant("%uint_12", "%uint", 12); + + ScopedPointerVariable pointer = builder.mockVariable("%var", "%ptr_1x_v3uint"); + + // when + visit(input); + + // then + assertEquals(1, ((IntLiteral) pointer.getAddress().getInitialValue(0)).getValueAsInt()); + assertEquals(1, ((IntLiteral) pointer.getAddress().getInitialValue(4)).getValueAsInt()); + assertEquals(1, ((IntLiteral) pointer.getAddress().getInitialValue(8)).getValueAsInt()); + } + + @Test + public void testUnsupportedExtension() { + // given + String input = """ + %1 = OpExtInstImport "unsupported" + """; + try { + // when + visit(input); + fail("Should throw exception"); + + } catch (ParsingException e) { + // then + assertEquals("Unsupported Spir-V extension 'unsupported'", e.getMessage()); + } + } + + @Test + public void testUndefinedExtensionId() { + // given + String input = """ + %2 = OpExtInst %void %1 ArgumentInfo %3 + """; + try { + // when + visit(input); + fail("Should throw exception"); + + } catch (ParsingException e) { + // then + assertEquals("Unexpected extension id '%1'", e.getMessage()); + } + } + + @Test + public void tesUnsupportedInstruction() { + // given + String input = """ + %1 = OpExtInstImport "NonSemantic.ClspvReflection.5" + %2 = OpExtInst %void %1 PrintfInfo %3 %4 + """; + try { + // when + visit(input); + fail("Should throw exception"); + + } catch (ParsingException e) { + // then + assertEquals("External instruction 'PrintfInfo' " + + "is not implemented for 'NonSemantic.ClspvReflection.5'", e.getMessage()); + } + } + + private void visit(String input) { + new MockSpirvParser(input).spv().accept(new VisitorOpsExtension(builder)); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsFunctionTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsFunctionTest.java new file mode 100644 index 0000000000..43735699df --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsFunctionTest.java @@ -0,0 +1,490 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.Type; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockProgramBuilder; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockSpirvParser; +import com.dat3m.dartagnan.program.Function; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.event.core.Skip; +import com.dat3m.dartagnan.program.event.functions.ValueFunctionCall; +import com.dat3m.dartagnan.program.event.functions.VoidFunctionCall; +import org.junit.Before; +import org.junit.Test; + +import java.util.List; + +import static org.junit.Assert.*; + +public class VisitorOpsFunctionTest { + + private final MockProgramBuilder builder = new MockProgramBuilder(); + private final VisitorOpsFunction visitor = new VisitorOpsFunction(builder); + + @Before + public void before() { + builder.mockVoidType("%void"); + builder.mockBoolType("%bool"); + builder.mockIntType("%int", 64); + builder.mockVectorType("%arr", "%int", 4); + builder.mockPtrType("%bool_ptr", "%bool", "Uniform"); + builder.mockPtrType("%int_ptr", "%int", "Uniform"); + builder.mockPtrType("%arr_ptr", "%arr", "Uniform"); + } + + @Test + public void testFunctionWithoutParameters() { + // given + String input = "%func = OpFunction %void None %void_func"; + Type type = builder.mockFunctionType("%void_func", "%void"); + + // when + visit(input); + + // then + Function function = builder.getCurrentFunction(); + assertEquals("%func", function.getName()); + assertEquals(type, function.getFunctionType()); + assertTrue(function.getParameterRegisters().isEmpty()); + assertEquals(function, builder.getExpression("%func")); + } + + @Test + public void testFunctionWithParameters() { + // given + String input = """ + %func = OpFunction %int None %int_func + %param_bool = OpFunctionParameter %bool_ptr + %param_int = OpFunctionParameter %int_ptr + %param_arr = OpFunctionParameter %arr_ptr + """; + + Type type = builder.mockFunctionType("%int_func", "%int", "%bool_ptr", "%int_ptr", "%arr_ptr"); + + // when + visit(input); + + // then + Function function = builder.getCurrentFunction(); + assertNotNull(function); + assertEquals("%func", function.getName()); + assertEquals(type, function.getFunctionType()); + + List registers = function.getParameterRegisters(); + assertEquals(3, registers.size()); + assertEquals("%param_bool", registers.get(0).getName()); + assertEquals(builder.getType("%bool_ptr"), registers.get(0).getType()); + assertEquals("%param_int", registers.get(1).getName()); + assertEquals(builder.getType("%int_ptr"), registers.get(1).getType()); + assertEquals("%param_arr", registers.get(2).getName()); + assertEquals(builder.getType("%arr_ptr"), registers.get(2).getType()); + + assertEquals(function, builder.getExpression("%func")); + assertEquals(registers.get(0), builder.getExpression("%param_bool")); + assertEquals(registers.get(1), builder.getExpression("%param_int")); + assertEquals(registers.get(2), builder.getExpression("%param_arr")); + } + + @Test(expected = ParsingException.class) + public void testFunctionWithMismatchingType() { + // given + String input = "%func = OpFunction %void None %void_func"; + builder.mockVoidType("%void_func"); + + // when + visit(input); + } + + @Test(expected = ParsingException.class) + public void testFunctionWithMismatchingReturnType() { + // given + String input = "%func = OpFunction %mismatching None %void_func"; + builder.mockIntType("%mismatching", 64); + builder.mockFunctionType("%void_func", "%void"); + + // when + visit(input); + } + + @Test + public void testFunctionWithMismatchingParameterTypes() { + doTestFunctionParameters(""" + %func = OpFunction %int None %int_func + %param_bool = OpFunctionParameter %bool_ptr + %param_int = OpFunctionParameter %int_ptr + %mismatching = OpFunctionParameter %int_ptr + """, + "Mismatching argument type in function '%func' " + + "for argument '%mismatching'"); + } + + @Test + public void testFunctionWithMissingParameters() { + doTestFunctionParameters(""" + %func = OpFunction %int None %int_func + %param_bool = OpFunctionParameter %bool_ptr + %param_int = OpFunctionParameter %int_ptr + OpFunctionEnd + """, + "Illegal attempt to exit a function definition"); + } + + @Test + public void testFunctionWithExtraParameters() { + doTestFunctionParameters(""" + %func = OpFunction %int None %int_func + %param_bool = OpFunctionParameter %bool_ptr + %param_int = OpFunctionParameter %int_ptr + %param_arr = OpFunctionParameter %arr_ptr + %extra = OpFunctionParameter %arr_ptr + """, + "Attempt to declare function parameter '%extra' " + + "outside of a function definition"); + } + + @Test + public void testFunctionWithIncorrectParameterOrder() { + // given + doTestFunctionParameters(""" + %func = OpFunction %int None %int_func + %param_bool = OpFunctionParameter %bool_ptr + %param_arr = OpFunctionParameter %arr_ptr + %param_int = OpFunctionParameter %int_ptr + """, + "Mismatching argument type in function '%func' " + + "for argument '%param_arr'"); + } + + @Test + public void testFunctionWithDuplicatedParameterNames() { + // given + doTestFunctionParameters(""" + %func = OpFunction %int None %int_func + %unique = OpFunctionParameter %bool_ptr + %duplicated = OpFunctionParameter %int_ptr + %duplicated = OpFunctionParameter %arr_ptr + """, + "Duplicated parameter id '%duplicated' in function '%func'"); + } + + private void doTestFunctionParameters(String input, String error) { + // given + builder.mockFunctionType("%int_func", "%int", "%bool_ptr", "%int_ptr", "%arr_ptr"); + + try { + // when + visit(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals(error, e.getMessage()); + } + } + + @Test + public void testFunctionEnd() { + // given + String input = """ + %func = OpFunction %void None %void_func + OpFunctionEnd + """; + builder.mockFunctionType("%void_func", "%void"); + Event event = new Skip(); + visit(input); + + try { + // when + builder.addEvent(event); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Attempt to add an event outside a function definition", + e.getMessage()); + } + } + + @Test(expected = ParsingException.class) + public void testFunctionEndIllegal() { + // given + String input = "OpFunctionEnd"; + + // when + visit(input); + } + + @Test + public void testFunctionCall() { + // given + String input = """ + %func = OpFunction %bool None %bool_func + %param1 = OpFunctionParameter %int_ptr + %param2 = OpFunctionParameter %arr_ptr + OpFunctionEnd + %main = OpFunction %void None %main_func + %ret = OpFunctionCall %bool %func %arg1 %arg2 + """; + + builder.mockFunctionType("%main_func", "%void"); + builder.mockFunctionType("%bool_func", "%bool", "%int_ptr", "%arr_ptr"); + + Expression arg1 = builder.mockVariable("%arg1", "%int_ptr"); + Expression arg2 = builder.mockVariable("%arg2", "%arr_ptr"); + + // when + visit(input); + + // then + Function func = (Function) builder.getExpression("%func"); + Function main = (Function) builder.getExpression("%main"); + + ValueFunctionCall call = (ValueFunctionCall) main.getEvents().get(0); + assertEquals(main, call.getFunction()); + assertEquals(func, call.getCalledFunction()); + assertEquals(main.getRegister("%ret"), call.getResultRegister()); + + assertEquals(2, call.getArguments().size()); + assertEquals(arg1, call.getArguments().get(0)); + assertEquals(arg2, call.getArguments().get(1)); + + assertTrue(visitor.forwardFunctions.isEmpty()); + assertTrue(visitor.forwardCalls.isEmpty()); + } + + @Test + public void testRecursiveFunctionCall() { + // given + String input = """ + %func = OpFunction %bool None %bool_func + %param1 = OpFunctionParameter %int_ptr + %param2 = OpFunctionParameter %arr_ptr + %ret = OpFunctionCall %bool %func %arg1 %arg2 + """; + + builder.mockFunctionType("%bool_func", "%bool", "%int_ptr", "%arr_ptr"); + + Expression arg1 = builder.mockVariable("%arg1", "%int_ptr"); + Expression arg2 = builder.mockVariable("%arg2", "%arr_ptr"); + + // when + visit(input); + + // then + Function func = (Function) builder.getExpression("%func"); + ValueFunctionCall call = (ValueFunctionCall) func.getEvents().get(0); + assertEquals(func, call.getFunction()); + assertEquals(func, call.getCalledFunction()); + assertEquals(func.getRegister("%ret"), call.getResultRegister()); + + assertEquals(2, call.getArguments().size()); + assertEquals(arg1, call.getArguments().get(0)); + assertEquals(arg2, call.getArguments().get(1)); + + assertTrue(visitor.forwardFunctions.isEmpty()); + assertTrue(visitor.forwardCalls.isEmpty()); + } + + @Test + public void testForwardFunctionCall() { + // given + String input = """ + %main = OpFunction %void None %main_func + %ret = OpFunctionCall %bool %func %arg1 %arg2 + OpFunctionEnd + %func = OpFunction %bool None %bool_func + %param1 = OpFunctionParameter %int_ptr + %param2 = OpFunctionParameter %arr_ptr + """; + + builder.mockFunctionType("%main_func", "%void"); + builder.mockFunctionType("%bool_func", "%bool", "%int_ptr", "%arr_ptr"); + + Expression arg1 = builder.mockVariable("%arg1", "%int_ptr"); + Expression arg2 = builder.mockVariable("%arg2", "%arr_ptr"); + + // when + visit(input); + + // then + Function main = (Function) builder.getExpression("%main"); + Function func = (Function) builder.getExpression("%func"); + + ValueFunctionCall call = (ValueFunctionCall) main.getEvents().get(0); + assertEquals(main, call.getFunction()); + assertEquals(func, call.getCalledFunction()); + assertEquals(main.getRegister("%ret"), call.getResultRegister()); + + assertEquals(2, func.getParameterRegisters().size()); + assertEquals("%param1", func.getParameterRegisters().get(0).getName()); + assertEquals("%param2", func.getParameterRegisters().get(1).getName()); + + assertEquals(2, call.getArguments().size()); + assertEquals(arg1, call.getArguments().get(0)); + assertEquals(arg2, call.getArguments().get(1)); + + assertTrue(visitor.forwardFunctions.isEmpty()); + assertTrue(visitor.forwardCalls.isEmpty()); + } + + @Test + public void testFunctionCallMismatchingArguments() { + doTestFunctionCallMismatchingParameters(""" + %func = OpFunction %bool None %bool_func + %param1 = OpFunctionParameter %int_ptr + %param2 = OpFunctionParameter %arr_ptr + OpFunctionEnd + %main = OpFunction %void None %main_func + %ret = OpFunctionCall %bool %func %arg1 %arg2 + """); + } + + @Test + public void testRecursiveFunctionCallMismatchingArguments() { + doTestFunctionCallMismatchingParameters(""" + %func = OpFunction %bool None %bool_func + %param1 = OpFunctionParameter %int_ptr + %param2 = OpFunctionParameter %arr_ptr + %ret = OpFunctionCall %bool %func %arg1 %arg2 + """); + } + + @Test + public void testForwardFunctionCallMismatchingParameters() { + doTestFunctionCallMismatchingParameters(""" + %main = OpFunction %void None %main_func + %ret = OpFunctionCall %bool %func %arg1 %arg2 + OpFunctionEnd + %func = OpFunction %bool None %bool_func + %param1 = OpFunctionParameter %int_ptr + %param2 = OpFunctionParameter %arr_ptr + """); + } + + @Test + public void testFunctionCallMismatchingReturnType() { + doTestFunctionCallMismatchingParameters(""" + %func = OpFunction %bool None %bool_func + %param1 = OpFunctionParameter %int_ptr + %param2 = OpFunctionParameter %arr_ptr + OpFunctionEnd + %main = OpFunction %void None %main_func + %ret = OpFunctionCall %void %func %arg1 %arg2 + """); + } + + private void doTestFunctionCallMismatchingParameters(String input) { + // given + builder.mockFunctionType("%main_func", "%void"); + builder.mockFunctionType("%bool_func", "%bool", "%int_ptr", "%arr_ptr"); + builder.mockVariable("%arg1", "%int_ptr"); + builder.mockVariable("%arg2", "%int_ptr"); + + try { + // when + visit(input); + fail("Should throw exception"); + } catch (ParsingException e) { + assertEquals("Illegal call of function '%func', " + + "function type doesn't match the function definition", + e.getMessage()); + } + } + + @Test(expected = ParsingException.class) + public void testForwardFunctionCallUndefinedFunction() { + // given + String input = """ + %main = OpFunction %void None %main_func + %ret = OpFunctionCall %bool %func %arg1 %arg2 + OpFunctionEnd + """; + + builder.mockFunctionType("%main_func", "%void"); + builder.mockFunctionType("%bool_func", "%bool", "%int_ptr", "%arr_ptr"); + builder.mockVariable("%arg1", "%int_ptr"); + builder.mockVariable("%arg2", "%arr_ptr"); + + // when + visit(input); + builder.build(); + } + + @Test + public void testCreatingMultipleFunctions() { + // given + String input = """ + %f1 = OpFunction %void None %void_func + %c11 = OpFunctionCall %void %f1 + %c12 = OpFunctionCall %bool %f2 %a2 + %c13 = OpFunctionCall %int %f3 %a3 + OpFunctionEnd + %f2 = OpFunction %bool None %bool_func + %p2 = OpFunctionParameter %bool_ptr + %c21 = OpFunctionCall %void %f1 + %c22 = OpFunctionCall %bool %f2 %a2 + %c23 = OpFunctionCall %int %f3 %a3 + OpFunctionEnd + %f3 = OpFunction %int None %int_func + %p3 = OpFunctionParameter %int_ptr + OpFunctionEnd + %main = OpFunction %void None %void_func + OpFunctionEnd + """; + + builder.mockFunctionType("%void_func", "%void"); + builder.mockFunctionType("%bool_func", "%bool", "%bool_ptr"); + builder.mockFunctionType("%int_func", "%int", "%int_ptr"); + + Expression a2 = builder.mockVariable("%a2", "%bool_ptr"); + Expression a3 = builder.mockVariable("%a3", "%int_ptr"); + + // when + visit(input); + + // then + Function f1 = (Function) builder.getExpression("%f1"); + Function f2 = (Function) builder.getExpression("%f2"); + Function f3 = (Function) builder.getExpression("%f3"); + + VoidFunctionCall c11 = (VoidFunctionCall) f1.getEvents().get(0); + ValueFunctionCall c12 = (ValueFunctionCall) f1.getEvents().get(1); + ValueFunctionCall c13 = (ValueFunctionCall) f1.getEvents().get(2); + VoidFunctionCall c21 = (VoidFunctionCall) f2.getEvents().get(0); + ValueFunctionCall c22 = (ValueFunctionCall) f2.getEvents().get(1); + ValueFunctionCall c23 = (ValueFunctionCall) f2.getEvents().get(2); + + assertEquals(f1, c11.getFunction()); + assertEquals(f1, c11.getCalledFunction()); + assertEquals(f1, c12.getFunction()); + assertEquals(f2, c12.getCalledFunction()); + assertEquals(f1, c13.getFunction()); + assertEquals(f3, c13.getCalledFunction()); + assertEquals(f2, c21.getFunction()); + assertEquals(f1, c21.getCalledFunction()); + assertEquals(f2, c22.getFunction()); + assertEquals(f2, c22.getCalledFunction()); + assertEquals(f2, c23.getFunction()); + assertEquals(f3, c23.getCalledFunction()); + + assertEquals(f1.getRegister("%c12"), c12.getResultRegister()); + assertEquals(f1.getRegister("%c13"), c13.getResultRegister()); + assertEquals(f2.getRegister("%c22"), c22.getResultRegister()); + assertEquals(f2.getRegister("%c23"), c23.getResultRegister()); + + assertEquals(a2, c12.getArguments().get(0)); + assertEquals(a3, c13.getArguments().get(0)); + assertEquals(a2, c22.getArguments().get(0)); + assertEquals(a3, c23.getArguments().get(0)); + + assertNotNull(builder.getExpression("%main")); + assertTrue(visitor.forwardFunctions.isEmpty()); + assertTrue(visitor.forwardCalls.isEmpty()); + } + + private void visit(String text) { + builder.getControlFlowBuilder().getOrCreateLabel("%mock_label"); + builder.getControlFlowBuilder().startBlock("%mock_label"); + new MockSpirvParser(text).spv().accept(visitor); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsLogicalTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsLogicalTest.java new file mode 100644 index 0000000000..ca7d03ff74 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsLogicalTest.java @@ -0,0 +1,282 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.booleans.BoolBinaryExpr; +import com.dat3m.dartagnan.expression.booleans.BoolBinaryOp; +import com.dat3m.dartagnan.expression.booleans.BoolUnaryExpr; +import com.dat3m.dartagnan.expression.integers.IntCmpExpr; +import com.dat3m.dartagnan.expression.integers.IntCmpOp; +import com.dat3m.dartagnan.expression.misc.ITEExpr; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockProgramBuilder; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockSpirvParser; +import com.dat3m.dartagnan.program.event.core.Local; +import org.junit.Test; + +import java.util.List; + +import static com.dat3m.dartagnan.expression.booleans.BoolBinaryOp.AND; +import static com.dat3m.dartagnan.expression.booleans.BoolBinaryOp.OR; +import static com.dat3m.dartagnan.expression.booleans.BoolUnaryOp.NOT; +import static com.dat3m.dartagnan.expression.integers.IntCmpOp.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class VisitorOpsLogicalTest { + + @Test + public void testOpsLogicalUn() { + doTestOpsLogicalUn(false); + doTestOpsLogicalUn(true); + } + + private void doTestOpsLogicalUn(boolean value) { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockBoolType("%bool"); + builder.mockConstant("%value", "%bool", value); + String input = "%reg = OpLogicalNot %bool %value"; + + // when + Local local = visit(builder, input); + BoolUnaryExpr expr = (BoolUnaryExpr) local.getExpr(); + + // then + assertEquals(builder.getExpression("%reg"), local.getResultRegister()); + assertEquals(builder.getExpression("%value"), expr.getOperand()); + assertEquals(NOT, expr.getKind()); + } + + @Test + public void testOpSelect() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockBoolType("%bool"); + builder.mockIntType("%int", 64); + builder.mockConstant("%cond", "%bool", true); + builder.mockConstant("%v1", "%int", 123); + builder.mockConstant("%v2", "%int", 456); + String input = "%reg = OpSelect %int %cond %v1 %v2"; + + // when + Local local = visit(builder, input); + ITEExpr expr = (ITEExpr) local.getExpr(); + + // then + assertEquals(builder.getExpression("%reg"), local.getResultRegister()); + assertEquals(builder.getExpression("%cond"), expr.getCondition()); + assertEquals(builder.getExpression("%v1"), expr.getTrueCase()); + assertEquals(builder.getExpression("%v2"), expr.getFalseCase()); + } + + @Test + public void testOpSelectMismatchingOperandType() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockBoolType("%bool"); + builder.mockIntType("%int", 64); + builder.mockConstant("%cond", "%bool", true); + builder.mockConstant("%v1", "%bool", false); + builder.mockConstant("%v2", "%int", 456); + String input = "%reg = OpSelect %int %cond %v1 %v2"; + + try { + // when + visit(builder, input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Illegal definition for '%reg', " + + "expected two operands type 'bv64 but received 'bool' and 'bv64'", e.getMessage()); + } + } + + @Test + public void testOpsLogicalBin() { + doTestOpsLogicalBin("OpLogicalAnd", AND, true, true); + doTestOpsLogicalBin("OpLogicalAnd", AND, false, true); + doTestOpsLogicalBin("OpLogicalOr", OR, true, false); + doTestOpsLogicalBin("OpLogicalOr", OR, true, true); + } + + private void doTestOpsLogicalBin(String name, BoolBinaryOp op, boolean v1, boolean v2) { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockBoolType("%bool"); + builder.mockConstant("%v1", "%bool", v1); + builder.mockConstant("%v2", "%bool", v2); + String input = String.format("%%reg = %s %%bool %%v1 %%v2", name); + + // when + Local local = visit(builder, input); + BoolBinaryExpr expr = (BoolBinaryExpr) local.getExpr(); + + // then + assertEquals(builder.getExpression("%reg"), local.getResultRegister()); + assertEquals(builder.getExpression("%v1"), expr.getLeft()); + assertEquals(builder.getExpression("%v2"), expr.getRight()); + assertEquals(op, expr.getKind()); + } + + @Test + public void testOpsIntegerBin() { + doTestOpsIntegerBin("OpIEqual", EQ, 1, 2); + doTestOpsIntegerBin("OpINotEqual", NEQ, 2, 1); + doTestOpsIntegerBin("OpUGreaterThan", UGT, 0, 1); + doTestOpsIntegerBin("OpSGreaterThan", GT, 0, -1); + doTestOpsIntegerBin("OpUGreaterThanEqual", UGTE, 1, 1); + doTestOpsIntegerBin("OpSGreaterThanEqual", GTE, 1, -1); + doTestOpsIntegerBin("OpULessThan", ULT, 0, 1); + doTestOpsIntegerBin("OpSLessThan", LT, 0, -1); + doTestOpsIntegerBin("OpULessThanEqual", ULTE, 1, 1); + doTestOpsIntegerBin("OpSLessThanEqual", LTE, 1, -1); + } + + private void doTestOpsIntegerBin(String name, IntCmpOp op, int v1, int v2) { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockBoolType("%bool"); + builder.mockIntType("%int", 64); + builder.mockConstant("%v1", "%int", v1); + builder.mockConstant("%v2", "%int", v2); + String input = String.format("%%reg = %s %%bool %%v1 %%v2", name); + + // when + Local local = visit(builder, input); + IntCmpExpr expr = (IntCmpExpr) local.getExpr(); + + // then + assertEquals(builder.getExpression("%reg"), local.getResultRegister()); + assertEquals(builder.getExpression("%v1"), expr.getLeft()); + assertEquals(builder.getExpression("%v2"), expr.getRight()); + assertEquals(op, expr.getKind()); + } + + @Test + public void testOpsLogicalUnIllegalOperandType() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockBoolType("%bool"); + builder.mockIntType("%int", 64); + builder.mockConstant("%value", "%int", 123); + String input = "%reg = OpLogicalNot %bool %value"; + + try { + // when + visit(builder, input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Illegal definition for '%reg', " + + "operand '%value' must be a boolean", e.getMessage()); + } + } + + @Test + public void testOpsLogicalBinIllegalOperandType() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockBoolType("%bool"); + builder.mockIntType("%int", 64); + builder.mockConstant("%v1", "%int", 123); + builder.mockConstant("%v2", "%bool", true); + String input = "%reg = OpLogicalAnd %bool %v1 %v2"; + + try { + // when + visit(builder, input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Illegal definition for '%reg', " + + "operand '%v1' must be a boolean", e.getMessage()); + } + } + + @Test + public void testOpsIntegerBinIllegalOperandType() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockBoolType("%bool"); + builder.mockIntType("%int", 64); + builder.mockConstant("%v1", "%int", 123); + builder.mockConstant("%v2", "%bool", true); + String input = "%reg = OpIEqual %bool %v1 %v2"; + + try { + // when + visit(builder, input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Illegal definition for '%reg', " + + "operand '%v2' must be an integer", e.getMessage()); + } + } + + @Test + public void testOpsIntegerBinMismatchingOperandTypes() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockBoolType("%bool"); + builder.mockIntType("%int32", 32); + builder.mockIntType("%int64", 64); + builder.mockConstant("%v1", "%int32", 123); + builder.mockConstant("%v2", "%int64", 456); + String input = "%reg = OpIEqual %bool %v1 %v2"; + + try { + // when + visit(builder, input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Illegal definition for '%reg', " + + "operands have different types: " + + "'%v1' is 'bv32' and '%v2' is 'bv64'", e.getMessage()); + } + } + + @Test + public void testUnsupportedResultType() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockBoolType("%bool"); + builder.mockVectorType("%vector", "%bool", 4); + builder.mockConstant("%value", "%vector", List.of(true, false, true, false)); + String input = "%reg = OpLogicalNot %vector %value"; + + try { + // when + visit(builder, input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Unsupported result type for '%reg', " + + "vector types are not supported", e.getMessage()); + } + } + + @Test + public void testIllegalResultType() { + // given + MockProgramBuilder builder = new MockProgramBuilder(); + builder.mockBoolType("%bool"); + builder.mockIntType("%int", 64); + builder.mockConstant("%value", "%bool", true); + String input = "%reg = OpLogicalNot %int %value"; + + try { + // when + visit(builder, input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Illegal result type for '%reg'", e.getMessage()); + } + } + + private Local visit(MockProgramBuilder builder, String input) { + builder.mockFunctionStart(true); + return (Local) new MockSpirvParser(input).op().accept(new VisitorOpsLogical(builder)); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsMemoryTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsMemoryTest.java new file mode 100644 index 0000000000..9bcb83e5c4 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsMemoryTest.java @@ -0,0 +1,920 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.Type; +import com.dat3m.dartagnan.expression.integers.IntBinaryExpr; +import com.dat3m.dartagnan.expression.misc.ConstructExpr; +import com.dat3m.dartagnan.expression.type.ArrayType; +import com.dat3m.dartagnan.expression.type.IntegerType; +import com.dat3m.dartagnan.expression.type.TypeFactory; +import com.dat3m.dartagnan.parsers.SpirvParser; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockProgramBuilder; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockSpirvParser; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.memory.ScopedPointer; +import com.dat3m.dartagnan.program.memory.ScopedPointerVariable; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.Tag; +import com.dat3m.dartagnan.program.event.core.Load; +import com.dat3m.dartagnan.program.event.core.Store; +import org.junit.Test; + +import java.util.List; +import java.util.Set; +import java.util.stream.Stream; + +import static org.junit.Assert.*; + +public class VisitorOpsMemoryTest { + + private static final TypeFactory types = TypeFactory.getInstance(); + private static final ExpressionFactory expressions = ExpressionFactory.getInstance(); + private MockProgramBuilder builder = new MockProgramBuilder(); + + @Test + public void testLoad() { + // given + String input = "%result = OpLoad %int %ptr"; + IntegerType iType = builder.mockIntType("%int", 32); + builder.mockPtrType("%int_ptr", "%int", "Uniform"); + ScopedPointerVariable pointer = builder.mockVariable("%ptr", "%int_ptr"); + + // when + parse(input); + + // then + Load load = (Load) getLastEvent(); + assertNotNull(load); + assertEquals(pointer, load.getAddress()); + assertEquals(iType, load.getAccessType()); + assertEquals(Set.of(Tag.VISIBLE, Tag.MEMORY, Tag.READ, Tag.Spirv.SC_UNIFORM, + Tag.Spirv.MEM_NON_PRIVATE, Tag.Spirv.DEVICE), load.getTags()); + + Register register = load.getResultRegister(); + assertEquals("%result", register.getName()); + assertEquals(register, builder.getExpression("%result")); + } + + @Test + public void testLoadWithTags() { + // given + String input = "%result = OpLoad %int %ptr MakePointerVisible %scope"; + IntegerType iType = builder.mockIntType("%int", 32); + builder.mockPtrType("%int_ptr", "%int", "Workgroup"); + ScopedPointerVariable pointer = builder.mockVariable("%ptr", "%int_ptr"); + builder.mockConstant("%scope", "%int", 2); + + // when + parse(input); + + // then + Load load = (Load) getLastEvent(); + assertNotNull(load); + assertEquals(pointer, load.getAddress()); + assertEquals(iType, load.getAccessType()); + assertEquals(Set.of(Tag.VISIBLE, Tag.MEMORY, Tag.READ, Tag.Spirv.WORKGROUP, + Tag.Spirv.MEM_VISIBLE, Tag.Spirv.MEM_NON_PRIVATE, + Tag.Spirv.SC_WORKGROUP), load.getTags()); + + Register register = load.getResultRegister(); + assertEquals("%result", register.getName()); + assertEquals(register, builder.getExpression("%result")); + } + + @Test + public void testLoadWithIllegalTags() { + // given + String input = "%result = OpLoad %int %ptr MakePointerAvailable %scope"; + builder.mockIntType("%int", 32); + builder.mockPtrType("%int_ptr", "%int", "Uniform"); + builder.mockVariable("%ptr", "%int_ptr"); + builder.mockConstant("%scope", "%int", 3); + + try { + // when + parse(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals(String.format("OpLoad cannot contain tag '%s'", + Tag.Spirv.MEM_AVAILABLE), e.getMessage()); + } + } + + @Test + public void testStore() { + // given + String input = "OpStore %ptr %value"; + IntegerType iType = builder.mockIntType("%int", 32); + builder.mockPtrType("%int_ptr", "%int", "Uniform"); + ScopedPointerVariable pointer = builder.mockVariable("%ptr", "%int_ptr"); + Expression value = builder.mockConstant("%value", "%int", 123); + + // when + parse(input); + + // then + Store store = (Store) getLastEvent(); + assertNotNull(store); + assertEquals(pointer, store.getAddress()); + assertEquals(iType, store.getAccessType()); + assertEquals(value, store.getMemValue()); + assertEquals(Set.of(Tag.VISIBLE, Tag.MEMORY, Tag.WRITE, Tag.Spirv.SC_UNIFORM, + Tag.Spirv.MEM_NON_PRIVATE, Tag.Spirv.DEVICE), store.getTags()); + } + + @Test + public void testStoreWithTags() { + // given + String input = "OpStore %ptr %value MakePointerAvailable %scope"; + IntegerType iType = builder.mockIntType("%int", 32); + builder.mockPtrType("%int_ptr", "%int", "Workgroup"); + ScopedPointerVariable pointer = builder.mockVariable("%ptr", "%int_ptr"); + Expression value = builder.mockConstant("%value", "%int", 123); + builder.mockConstant("%scope", "%int", 2); + + // when + parse(input); + + // then + Store store = (Store) getLastEvent(); + assertNotNull(store); + assertEquals(pointer, store.getAddress()); + assertEquals(iType, store.getAccessType()); + assertEquals(value, store.getMemValue()); + assertEquals(Set.of(Tag.VISIBLE, Tag.MEMORY, Tag.WRITE, Tag.Spirv.WORKGROUP, + Tag.Spirv.MEM_AVAILABLE, Tag.Spirv.MEM_NON_PRIVATE, + Tag.Spirv.SC_WORKGROUP), store.getTags()); + } + + @Test + public void testStoreWithIllegalTags() { + // given + String input = "OpStore %ptr %value MakePointerVisible %scope"; + builder.mockIntType("%int", 32); + builder.mockPtrType("%int_ptr", "%int", "Uniform"); + builder.mockVariable("%ptr", "%int_ptr"); + builder.mockConstant("%value", "%int", 123); + builder.mockConstant("%scope", "%int", 2); + + try { + // when + parse(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals(String.format("OpStore cannot contain tag '%s'", + Tag.Spirv.MEM_VISIBLE), e.getMessage()); + } + } + + @Test + public void testVariable() { + // given + String input = """ + %v1 = OpVariable %b_ptr Uniform + %v2 = OpVariable %i_ptr Uniform + %v3 = OpVariable %v3int_ptr Uniform + %v4 = OpVariable %struct_ptr Uniform + """; + + Type[] types = { + builder.mockBoolType("%bool"), + builder.mockIntType("%int", 32), + builder.mockVectorType("%v3int", "%int", 3), + builder.mockAggregateType("%struct", "%bool", "%int", "%v3int") + }; + + builder.mockPtrType("%b_ptr", "%bool", "Uniform"); + builder.mockPtrType("%i_ptr", "%int", "Uniform"); + builder.mockPtrType("%v3int_ptr", "%v3int", "Uniform"); + builder.mockPtrType("%struct_ptr", "%struct", "Uniform"); + + // when + parse(input); + + // then + String[] variables = {"%v1", "%v2", "%v3", "%v4"}; + for (int i = 0; i < 4; i++) { + ScopedPointerVariable pointer = (ScopedPointerVariable) builder.getExpression(variables[i]); + assertNotNull(pointer); + assertEquals(VisitorOpsMemoryTest.types.getMemorySizeInBytes(types[i]), pointer.getAddress().size()); + } + } + + @Test + public void testInitializedVariableConstant() { + String input = """ + %v1 = OpVariable %b_ptr Uniform %b_const + %v2 = OpVariable %i_ptr Uniform %i_const + %v3 = OpVariable %v3int_ptr Uniform %v3int_const + %v4 = OpVariable %struct_ptr Uniform %struct_const + """; + + builder.mockBoolType("%bool"); + builder.mockIntType("%int", 32); + builder.mockVectorType("%v3int", "%int", 3); + builder.mockAggregateType("%struct", "%bool", "%int", "%v3int"); + + builder.mockConstant("%b_const", "%bool", true); + builder.mockConstant("%i_const", "%int", 7890); + builder.mockConstant("%v3int_const", "%v3int", List.of(1, 2, 3)); + builder.mockConstant("%struct_const", "%struct", List.of("%b_const", "%i_const", "%v3int_const")); + + doTestInitializedVariable(input); + } + + @Test + public void testInitializedVariableInput() { + String input = """ + %v1 = OpVariable %b_ptr Uniform + %v2 = OpVariable %i_ptr Uniform + %v3 = OpVariable %v3int_ptr Uniform + %v4 = OpVariable %struct_ptr Uniform + """; + + IntegerType archType = types.getArchType(); + Expression i1 = expressions.makeValue(1, archType); + Expression i2 = expressions.makeValue(7890, archType); + List iValues = Stream.of(1, 2, 3).map(i -> (Expression) expressions.makeValue(i, archType)).toList(); + Expression i3 = expressions.makeArray(archType, iValues, true); + Expression i4 = expressions.makeConstruct(List.of(i1, i2, i3)); + + builder = new MockProgramBuilder(); + builder.addInput("%v1", i1); + builder.addInput("%v2", i2); + builder.addInput("%v3", i3); + builder.addInput("%v4", i4); + + builder.mockBoolType("%bool"); + builder.mockIntType("%int", 32); + builder.mockVectorType("%v3int", "%int", 3); + builder.mockAggregateType("%struct", "%bool", "%int", "%v3int"); + + doTestInitializedVariable(input); + } + + private void doTestInitializedVariable(String input) { + // given + builder.mockPtrType("%b_ptr", "%bool", "Uniform"); + builder.mockPtrType("%i_ptr", "%int", "Uniform"); + builder.mockPtrType("%v3int_ptr", "%v3int", "Uniform"); + builder.mockPtrType("%struct_ptr", "%struct", "Uniform"); + + // when + parse(input); + + // then + IntegerType iType = (IntegerType) builder.getType("%int"); + Expression o1 = expressions.makeTrue(); + Expression o2 = expressions.makeValue(7890, iType); + List oValues = Stream.of(1, 2, 3).map(i -> (Expression) expressions.makeValue(i, iType)).toList(); + Expression o3 = expressions.makeArray(iType, oValues, true); + Expression o4 = expressions.makeConstruct(List.of(o1, o2, o3)); + + ScopedPointerVariable v1 = (ScopedPointerVariable) builder.getExpression("%v1"); + assertNotNull(v1); + assertEquals(types.getMemorySizeInBytes(builder.getType("%bool")), v1.getAddress().size()); + assertEquals(o1, v1.getAddress().getInitialValue(0)); + + ScopedPointerVariable v2 = (ScopedPointerVariable) builder.getExpression("%v2"); + assertNotNull(v2); + assertEquals(types.getMemorySizeInBytes(builder.getType("%int")), v2.getAddress().size()); + assertEquals(o2, v2.getAddress().getInitialValue(0)); + + ScopedPointerVariable v3 = (ScopedPointerVariable) builder.getExpression("%v3"); + assertNotNull(v3); + assertEquals(types.getMemorySizeInBytes(builder.getType("%v3int")), v3.getAddress().size()); + List arrElements = o3.getOperands(); + assertEquals(arrElements.get(0), v3.getAddress().getInitialValue(0)); + assertEquals(arrElements.get(1), v3.getAddress().getInitialValue(4)); + assertEquals(arrElements.get(2), v3.getAddress().getInitialValue(8)); + + ScopedPointerVariable v4 = (ScopedPointerVariable) builder.getExpression("%v4"); + assertNotNull(v4); + assertEquals(types.getMemorySizeInBytes(builder.getType("%struct")), v4.getAddress().size()); + List structElements = o4.getOperands(); + assertEquals(structElements.get(0), v4.getAddress().getInitialValue(0)); + assertEquals(structElements.get(1), v4.getAddress().getInitialValue(4)); + assertEquals(arrElements.get(0), v4.getAddress().getInitialValue(8)); + assertEquals(arrElements.get(1), v4.getAddress().getInitialValue(12)); + assertEquals(arrElements.get(2), v4.getAddress().getInitialValue(16)); + } + + @Test + public void testRuntimeArray() { + // given + String input = """ + %v1 = OpVariable %v1_ptr Uniform + %v2 = OpVariable %v2_ptr Uniform + %v3 = OpVariable %v3_ptr Uniform + """; + + IntegerType archType = types.getArchType(); + Type aType = types.getArrayType(archType, 2); + + Expression i1 = expressions.makeValue(1, archType); + Expression i2 = expressions.makeValue(2, archType); + Expression i3 = expressions.makeValue(3, archType); + Expression i4 = expressions.makeValue(4, archType); + Expression i5 = expressions.makeValue(5, archType); + Expression i6 = expressions.makeValue(6, archType); + + Expression a1 = expressions.makeArray(archType, List.of(i1, i2), true); + Expression a2 = expressions.makeArray(archType, List.of(i3, i4), true); + Expression a3 = expressions.makeArray(archType, List.of(i5, i6), true); + + Expression a3a = expressions.makeArray(aType, List.of(a1, a2, a3), true); + Expression s = expressions.makeConstruct(List.of(i1, a1)); + + builder = new MockProgramBuilder(); + builder.addInput("%v1", a1); + builder.addInput("%v2", a3a); + builder.addInput("%v3", s); + + IntegerType iType = builder.mockIntType("%int", 32); + builder.mockVectorType("%ra", "%int", -1); + builder.mockVectorType("%v3ra", "%ra", 3); + builder.mockAggregateType("%s1i1ra", "%int", "%ra"); + + builder.mockPtrType("%v1_ptr", "%ra", "Uniform"); + builder.mockPtrType("%v2_ptr", "%v3ra", "Uniform"); + builder.mockPtrType("%v3_ptr", "%s1i1ra", "Uniform"); + + // when + parse(input); + + // then + Expression o1 = expressions.makeValue(1, iType); + Expression o2 = expressions.makeValue(2, iType); + Expression o3 = expressions.makeValue(3, iType); + Expression o4 = expressions.makeValue(4, iType); + Expression o5 = expressions.makeValue(5, iType); + Expression o6 = expressions.makeValue(6, iType); + + Type ot1 = types.getArrayType(iType, 2); + Type ot2 = types.getArrayType(ot1, 3); + Type ot3 = types.getAggregateType(List.of(iType, ot1)); + + ScopedPointerVariable v1 = (ScopedPointerVariable) builder.getExpression("%v1"); + assertEquals(types.getMemorySizeInBytes(ot1), v1.getAddress().size()); + assertEquals(o1, v1.getAddress().getInitialValue(0)); + assertEquals(o2, v1.getAddress().getInitialValue(4)); + + ScopedPointerVariable v2 = (ScopedPointerVariable) builder.getExpression("%v2"); + assertEquals(types.getMemorySizeInBytes(ot2), v2.getAddress().size()); + assertEquals(o1, v2.getAddress().getInitialValue(0)); + assertEquals(o2, v2.getAddress().getInitialValue(4)); + assertEquals(o3, v2.getAddress().getInitialValue(8)); + assertEquals(o4, v2.getAddress().getInitialValue(12)); + assertEquals(o5, v2.getAddress().getInitialValue(16)); + assertEquals(o6, v2.getAddress().getInitialValue(20)); + + ScopedPointerVariable v3 = (ScopedPointerVariable) builder.getExpression("%v3"); + assertEquals(types.getMemorySizeInBytes(ot3), v3.getAddress().size()); + assertEquals(o1, v3.getAddress().getInitialValue(0)); + assertEquals(o1, v3.getAddress().getInitialValue(4)); + assertEquals(o2, v3.getAddress().getInitialValue(8)); + } + + @Test + public void testRuntimeArrayFromConstant() { + // given + String input = "%v = OpVariable %ra_ptr Uniform %value"; + + builder.mockIntType("%int", 32); + builder.mockVectorType("%ra", "%int", -1); + builder.mockVectorType("%i2a", "%int", 2); + builder.mockPtrType("%ra_ptr", "%ra", "Uniform"); + + ConstructExpr arr = (ConstructExpr) builder.mockConstant("%value", "%i2a", List.of(1, 2)); + + // when + parse(input); + + // then + ScopedPointerVariable v = (ScopedPointerVariable) builder.getExpression("%v"); + assertNotNull(v); + assertEquals(types.getMemorySizeInBytes(arr.getType()), v.getAddress().size()); + assertEquals(arr.getOperands().get(0), v.getAddress().getInitialValue(0)); + assertEquals(arr.getOperands().get(1), v.getAddress().getInitialValue(4)); + } + + @Test + public void testReusingRuntimeArrayType() { + // given + String input = """ + %v1 = OpVariable %v1_ptr Uniform + %v2 = OpVariable %v2_ptr Uniform + """; + + IntegerType archType = types.getArchType(); + Expression i1 = expressions.makeValue(1, archType); + Expression i2 = expressions.makeValue(2, archType); + Expression i3 = expressions.makeValue(3, archType); + + Expression a1 = expressions.makeArray(archType, List.of(i1, i2), true); + Expression a2 = expressions.makeArray(archType, List.of(i1, i2, i3), true); + + builder = new MockProgramBuilder(); + builder.addInput("%v1", a1); + builder.addInput("%v2", a2); + + builder.mockIntType("%int", 64); + builder.mockVectorType("%ra", "%int", -1); + builder.mockPtrType("%v1_ptr", "%ra", "Uniform"); + builder.mockPtrType("%v2_ptr", "%ra", "Uniform"); + + // when + parse(input); + + // then + ScopedPointerVariable v1 = (ScopedPointerVariable) builder.getExpression("%v1"); + assertNotNull(v1); + assertEquals(types.getMemorySizeInBytes(a1.getType()), v1.getAddress().size()); + assertEquals(i1, v1.getAddress().getInitialValue(0)); + assertEquals(i2, v1.getAddress().getInitialValue(8)); + + ScopedPointerVariable v2 = (ScopedPointerVariable) builder.getExpression("%v2"); + assertNotNull(v2); + assertEquals(types.getMemorySizeInBytes(a2.getType()), v2.getAddress().size()); + assertEquals(i1, v2.getAddress().getInitialValue(0)); + assertEquals(i2, v2.getAddress().getInitialValue(8)); + assertEquals(i3, v2.getAddress().getInitialValue(16)); + } + + @Test + public void testUninitializedRuntimeVariable() { + // given + String input = "%v = OpVariable %arr_ptr Uniform"; + + builder.mockIntType("%int", 32); + builder.mockVectorType("%arr", "%int", -1); + builder.mockPtrType("%arr_ptr", "%arr", "Uniform"); + + try { + // when + parse(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Missing initial value for runtime variable '%v'", + e.getMessage()); + } + } + + @Test + public void testVariableNotPointerType() { + // given + String input = "%v = OpVariable %int Uniform"; + builder.mockIntType("%int", 32); + + try { + // when + parse(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Type '%int' is not a pointer type", e.getMessage()); + } + } + + @Test + public void testVariableMismatchingStorageClass() { + // given + String input = "%v = OpVariable %int_ptr Workgroup"; + builder.mockIntType("%int", 64); + builder.mockPtrType("%int_ptr", "%int", "Uniform"); + + try { + // when + parse(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Storage class of variable '%v' " + + "does not match the pointer storage class", e.getMessage()); + } + } + + @Test + public void testVariableIllegalStorageClass() { + // given + String input = "%v = OpVariable %int_ptr Generic"; + builder.mockIntType("%int", 64); + builder.mockPtrType("%int_ptr", "%int", "Generic"); + + try { + // when + parse(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Variable '%v' has illegal storage class 'Generic'", e.getMessage()); + } + } + + @Test + public void testMismatchingValueTypeConstant() { + // given + String input = "%v = OpVariable %i_ptr Uniform %const"; + + builder.mockBoolType("%bool"); + builder.mockIntType("%int", 32); + builder.mockPtrType("%i_ptr", "%int", "Uniform"); + builder.mockConstant("%const", "%bool", true); + + try { + // when + parse(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Mismatching value type for variable '%v', " + + "expected 'bv32' but received 'bool'", e.getMessage()); + } + } + + @Test + public void testMismatchingValueTypeInput() { + // given + String input = "%v = OpVariable %i_ptr Uniform"; + + IntegerType archType = types.getArchType(); + Expression i1 = expressions.makeValue(1, archType); + Expression i2 = expressions.makeValue(2, archType); + Expression a = expressions.makeArray(archType, List.of(i1, i2), true); + + builder = new MockProgramBuilder(); + builder.addInput("%v", a); + + builder.mockIntType("%int", 32); + builder.mockVectorType("%v2i", "%int", 2); + builder.mockPtrType("%i_ptr", "%int", "Uniform"); + + try { + // when + parse(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Mismatching value type for variable '%v', " + + "expected 'bv32' but received '[2 x bv64]'", e.getMessage()); + } + } + + @Test + public void testMismatchingValueTypeInNestedArray() { + // given + String input = "%v = OpVariable %arr2int_ptr Uniform %const"; + + Type bType = builder.mockBoolType("%bool"); + Type a1Type = builder.mockVectorType("%arr1bool", "%bool", 2); + builder.mockVectorType("%arr2bool", "%arr1bool", 2); + + builder.mockIntType("%int", 32); + builder.mockVectorType("%arr1int", "%int", 2); + builder.mockVectorType("%arr2int", "%arr1int", 2); + + builder.mockPtrType("%arr2int_ptr", "%arr2int", "Uniform"); + + Expression bool = expressions.makeTrue(); + Expression arr1 = expressions.makeArray(bType, List.of(bool, bool), true); + Expression arr2 = expressions.makeArray(a1Type, List.of(arr1, arr1), true); + + builder.addExpression("%const", arr2); + + try { + // when + parse(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Mismatching value type for variable '%v', " + + "expected '[2 x [2 x bv32]]' but received '[2 x [2 x bool]]'", e.getMessage()); + } + } + + @Test + public void testMismatchingValueTypeInNestedStruct() { + // given + String input = "%v = OpVariable %struct2_ptr Uniform %const"; + + builder.mockBoolType("%bool"); + builder.mockIntType("%int16", 16); + IntegerType i32Type = builder.mockIntType("%int32", 32); + + builder.mockAggregateType("%struct1", "%bool", "%int16"); + builder.mockAggregateType("%struct2", "%bool", "%struct1"); + + builder.mockPtrType("%struct2_ptr", "%struct2", "Uniform"); + + Expression bool = expressions.makeTrue(); + Expression int32 = expressions.makeValue(1, i32Type); + Expression struct1 = expressions.makeConstruct(List.of(bool, int32)); + Expression struct2 = expressions.makeConstruct(List.of(bool, struct1)); + + builder.addExpression("%const", struct2); + + try { + // when + parse(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Mismatching value type for variable '%v', " + + "expected '{ bool, { bool, bv16 } }' but received '{ bool, { bool, bv32 } }'", e.getMessage()); + } + } + + @Test + public void testInputForInitializedVariable() { + // given + String input = "%v = OpVariable %i_ptr Uniform %i_const"; + + IntegerType archType = types.getArchType(); + Expression v = expressions.makeValue(2, archType); + + builder = new MockProgramBuilder(); + builder.addInput("%v", v); + builder.mockIntType("%int", 32); + builder.mockPtrType("%i_ptr", "%int", "Uniform"); + builder.mockConstant("%i_const", "%int", 1); + + try { + // when + parse(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("The original value of variable '%v' " + + "cannot be overwritten by an external input", e.getMessage()); + } + } + + @Test + public void testAccessChainArray() { + // given + String input = """ + %variable = OpVariable %v2v2v2i_ptr Uniform %const + %element = OpAccessChain %i_ptr %variable %1 %0 %1 + """; + + IntegerType iType = builder.mockIntType("%int", 32); + ArrayType v2iType = builder.mockVectorType("%v2i", "%int", 2); + ArrayType v2v2iType = builder.mockVectorType("%v2v2i", "%v2i", 2); + builder.mockVectorType("%v2v2v2i", "%v2v2i", 2); + builder.mockPtrType("%i_ptr", "%int", "Uniform"); + builder.mockPtrType("%v2v2v2i_ptr", "%v2v2v2i", "Uniform"); + + Expression i32 = expressions.makeValue(1, iType); + Expression arr1 = expressions.makeArray(iType, List.of(i32, i32), true); + Expression arr2 = expressions.makeArray(v2iType, List.of(arr1, arr1), true); + Expression arr3 = expressions.makeArray(v2v2iType, List.of(arr2, arr2), true); + + builder.addExpression("%const", arr3); + + Expression i0 = builder.addExpression("%0", expressions.makeValue(0, iType)); + Expression i1 = builder.addExpression("%1", expressions.makeValue(1, iType)); + + // when + parse(input); + + // then + IntBinaryExpr e1 = (IntBinaryExpr) ((ScopedPointer)builder.getExpression("%element")).getAddress(); + assertEquals(types.getArchType(), e1.getType()); + assertEquals(makeOffset(i1, 4), e1.getRight()); + + IntBinaryExpr e2 = (IntBinaryExpr) e1.getLeft(); + assertEquals(makeOffset(i0, 8), e2.getRight()); + + IntBinaryExpr e3 = (IntBinaryExpr) e2.getLeft(); + assertEquals(makeOffset(i1, 16), e3.getRight()); + assertEquals(builder.getExpression("%variable"), e3.getLeft()); + } + + @Test + public void testAccessChainStruct() { + // given + String input = """ + %variable = OpVariable %agg2_ptr Uniform %const + %element = OpAccessChain %i32_ptr %variable %4 %2 + """; + + builder.mockBoolType("%bool"); + IntegerType i16Type = builder.mockIntType("%int16", 16); + IntegerType i32Type = builder.mockIntType("%int32", 32); + IntegerType i64Type = builder.mockIntType("%int64", 64); + + builder.mockAggregateType("%agg1", "%bool", "%int16", "%int32", "%int64"); + builder.mockAggregateType("%agg2", "%bool", "%int16", "%int32", "%int64", "%agg1"); + builder.mockPtrType("%i32_ptr", "%int32", "Uniform"); + builder.mockPtrType("%agg2_ptr", "%agg2", "Uniform"); + + Expression b = expressions.makeFalse(); + Expression i16 = expressions.makeValue(1, i16Type); + Expression i32 = expressions.makeValue(11, i32Type); + Expression i64 = expressions.makeValue(111, i64Type); + Expression agg1 = expressions.makeConstruct(List.of(b, i16, i32, i64)); + Expression agg2 = expressions.makeConstruct(List.of(b, i16, i32, i64, agg1)); + + builder.addExpression("%const", agg2); + + builder.addExpression("%2", expressions.makeValue(2, i32Type)); + builder.addExpression("%4", expressions.makeValue(4, i32Type)); + + // when + parse(input); + + // then + IntBinaryExpr e1 = (IntBinaryExpr) ((ScopedPointer)builder.getExpression("%element")).getAddress(); + assertEquals(types.getArchType(), e1.getType()); + assertEquals(expressions.makeValue(3, i64Type), e1.getRight()); + IntBinaryExpr e2 = (IntBinaryExpr) e1.getLeft(); + assertEquals(expressions.makeValue(15, i64Type), e2.getRight()); + assertEquals(builder.getExpression("%variable"), e2.getLeft()); + } + + @Test + public void testAccessChainArrayRegister() { + // given + String input = """ + %variable = OpVariable %v2i_ptr Uniform %const + %element = OpAccessChain %i_ptr %variable %register + """; + + IntegerType i32Type = builder.mockIntType("%int", 32); + builder.mockVectorType("%v2i", "%int", 2); + builder.mockPtrType("%v2i_ptr", "%v2i", "Uniform"); + builder.mockPtrType("%i_ptr", "%int", "Uniform"); + + Expression i1 = expressions.makeValue(1, i32Type); + Expression i2 = expressions.makeValue(2, i32Type); + Expression arr = expressions.makeArray(i32Type, List.of(i1, i2), true); + + builder.addExpression("%const", arr); + + // when + builder.mockFunctionStart(true); + Register register = (Register) builder.addExpression("%register", builder.addRegister("%register", "%int")); + new MockSpirvParser(input).spv().accept(new VisitorOpsMemory(builder)); + + // then + IntBinaryExpr e = (IntBinaryExpr) ((ScopedPointer)builder.getExpression("%element")).getAddress(); + assertEquals(types.getArchType(), e.getType()); + assertEquals(builder.getExpression("%variable"), e.getLeft()); + assertEquals(makeOffset(register, 4), e.getRight()); + } + + @Test + public void testAccessChainStructureRegister() { + // given + String input = """ + %variable = OpVariable %agg_ptr Uniform %const + %element = OpAccessChain %i16_ptr %variable %register + """; + + IntegerType i16Type = builder.mockIntType("%int16", 16); + IntegerType i32Type = builder.mockIntType("%int32", 32); + builder.mockAggregateType("%agg", "%int16", "%int32"); + + builder.mockPtrType("%i16_ptr", "%int16", "Uniform"); + builder.mockPtrType("%agg_ptr", "%agg", "Uniform"); + + Expression i1 = expressions.makeValue(1, i16Type); + Expression i2 = expressions.makeValue(2, i32Type); + Expression arr = expressions.makeConstruct(List.of(i1, i2)); + + builder.addExpression("%const", arr); + builder.mockFunctionStart(true); + builder.addExpression("%register", builder.addRegister("%register", "%int32")); + VisitorOpsMemory visitor = new VisitorOpsMemory(builder); + SpirvParser.SpvContext ctx = new MockSpirvParser(input).spv(); + + try { + // when + ctx.accept(visitor); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Index of a struct member is non-constant for variable '%variable[-1]'", + e.getMessage()); + } + } + + @Test + public void testAccessChainWrongDepth() { + // given + String input = """ + %variable = OpVariable %v2i_ptr Uniform %const + %element = OpAccessChain %i_ptr %variable %0 %0 + """; + + IntegerType iType = builder.mockIntType("%int", 32); + builder.mockVectorType("%v2i", "%int", 2); + builder.mockPtrType("%i_ptr", "%int", "Uniform"); + builder.mockPtrType("%v2i_ptr", "%v2i", "Uniform"); + + Expression i1 = expressions.makeValue(1, iType); + Expression i2 = expressions.makeValue(2, iType); + Expression arr = expressions.makeArray(iType, List.of(i1, i2), true); + + builder.addExpression("%const", arr); + builder.addExpression("%0", expressions.makeValue(0, iType)); + + try { + // when + parse(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Index is too deep for variable '%variable[0][0]'", e.getMessage()); + } + } + + @Test + public void testAccessChainMismatchingTypeArray() { + // given + String input = """ + %variable = OpVariable %v2i_ptr Uniform %const + %element = OpAccessChain %i16_ptr %variable %0 + """; + + IntegerType i32Type = builder.mockIntType("%int32", 32); + builder.mockVectorType("%v2i", "%int32", 2); + builder.mockPtrType("%v2i_ptr", "%v2i", "Uniform"); + builder.mockIntType("%int16", 16); + builder.mockPtrType("%i16_ptr", "%int16", "Uniform"); + + Expression i1 = expressions.makeValue(1, i32Type); + Expression i2 = expressions.makeValue(2, i32Type); + Expression arr = expressions.makeArray(i32Type, List.of(i1, i2), true); + + builder.addExpression("%const", arr); + builder.addExpression("%0", expressions.makeValue(0, i32Type)); + + try { + // when + parse(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Invalid result type in access chain '%element', " + + "expected 'bv16' but received 'bv32'", e.getMessage()); + } + } + + @Test + public void testAccessChainMismatchingTypeStructure() { + // given + String input = """ + %variable = OpVariable %agg_ptr Uniform %const + %element = OpAccessChain %i16_ptr %variable %1 + """; + + IntegerType i16Type = builder.mockIntType("%int16", 16); + IntegerType i32Type = builder.mockIntType("%int32", 32); + builder.mockAggregateType("%agg", "%int16", "%int32"); + + builder.mockPtrType("%i16_ptr", "%int16", "Uniform"); + builder.mockPtrType("%agg_ptr", "%agg", "Uniform"); + + Expression i1 = expressions.makeValue(1, i16Type); + Expression i2 = expressions.makeValue(2, i32Type); + Expression arr = expressions.makeConstruct(List.of(i1, i2)); + + builder.addExpression("%const", arr); + builder.addExpression("%1", expressions.makeValue(1, i32Type)); + + try { + // when + parse(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Invalid result type in access chain '%element', " + + "expected 'bv16' but received 'bv32'", e.getMessage()); + } + } + + private Expression makeOffset(Expression stepExpr, int stepSize) { + IntegerType archType = types.getArchType(); + Expression stepCastExpr = expressions.makeCast(stepExpr, archType); + return expressions.makeMul(expressions.makeValue(stepSize, archType), stepCastExpr); + } + + private Event getLastEvent() { + List events = builder.getCurrentFunction().getEvents(); + if (!events.isEmpty()) { + return events.get(events.size() - 1); + } + return null; + } + + private void parse(String input) { + builder.mockFunctionStart(true); + new MockSpirvParser(input).spv().accept(new VisitorOpsMemory(builder)); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsSettingTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsSettingTest.java new file mode 100644 index 0000000000..46e6b7ae6a --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsSettingTest.java @@ -0,0 +1,125 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.type.FunctionType; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockProgramBuilder; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockSpirvParser; +import com.dat3m.dartagnan.program.Function; +import com.dat3m.dartagnan.program.Program; +import org.junit.Test; + +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class VisitorOpsSettingTest { + + private final MockProgramBuilder builder = new MockProgramBuilder(); + + @Test + public void testEntryPoint() { + // given + String input = "OpEntryPoint GLCompute %main \"main\" %gl_GlobalInvocationID"; + builder.mockVoidType("%void"); + FunctionType type = builder.mockFunctionType("%func", "%void"); + Function function = new Function("%main", type, List.of(), 0, null); + builder.startCurrentFunction(function); + builder.endCurrentFunction(); + + // when + visit(input); + Program program = builder.build(); + + // then + assertEquals(type, function.getFunctionType()); + assertEquals(1, program.getFunctions().size()); + assertEquals(function, program.getFunctions().get(0)); + } + + @Test + public void testUndefinedEntryPoint() { + // given + String input = "OpEntryPoint GLCompute %expected \"main\" %gl_GlobalInvocationID"; + builder.mockVoidType("%void"); + FunctionType type = builder.mockFunctionType("%func", "%void"); + Function function = new Function("%defined", type, List.of(), 0, null); + builder.startCurrentFunction(function); + builder.endCurrentFunction(); + visit(input); + + try { + // when + builder.build(); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Cannot build the program, missing function definition '%expected'", + e.getMessage()); + } + } + + @Test + public void testUnclosedEntryPoint() { + // given + String input = "OpEntryPoint GLCompute %main \"main\" %gl_GlobalInvocationID"; + builder.mockVoidType("%void"); + FunctionType type = builder.mockFunctionType("%func", "%void"); + Function function = new Function("%main", type, List.of(), 0, null); + builder.startCurrentFunction(function); + visit(input); + + try { + // when + builder.build(); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Unclosed definition for function '%main'", + e.getMessage()); + } + } + + @Test + public void testMissingEntryPoint() { + // given + builder.mockVoidType("%void"); + FunctionType type = builder.mockFunctionType("%func", "%void"); + Function function = new Function("%main", type, List.of(), 0, null); + builder.startCurrentFunction(function); + builder.endCurrentFunction(); + + try { + // when + builder.build(); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Cannot build the program, entryPointId is missing", + e.getMessage()); + } + } + + @Test + public void testMultipleEntryPoints() { + // given + String input = """ + OpEntryPoint GLCompute %ep1 "ep1" + OpEntryPoint GLCompute %ep2 "ep2" + """; + + try { + // when + visit(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Multiple entry points are not supported", + e.getMessage()); + } + } + + private void visit(String text) { + new MockSpirvParser(text).spv().accept(new VisitorOpsSetting(builder)); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsTypeTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsTypeTest.java new file mode 100644 index 0000000000..982f3b5b10 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/VisitorOpsTypeTest.java @@ -0,0 +1,319 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Type; +import com.dat3m.dartagnan.expression.integers.IntLiteral; +import com.dat3m.dartagnan.expression.type.IntegerType; +import com.dat3m.dartagnan.expression.type.TypeFactory; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockProgramBuilder; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockSpirvParser; +import com.dat3m.dartagnan.expression.type.ScopedPointerType; +import com.dat3m.dartagnan.program.event.Tag; +import org.junit.Test; + +import java.math.BigInteger; +import java.util.List; +import java.util.Map; + +import static org.junit.Assert.assertEquals; + +public class VisitorOpsTypeTest { + + private static final TypeFactory types = TypeFactory.getInstance(); + private final MockProgramBuilder builder = new MockProgramBuilder(); + + @Test + public void testSupportedTypes() { + // given + String input = """ + %void = OpTypeVoid + %bool = OpTypeBool + %int = OpTypeInt 16 1 + %vector = OpTypeVector %int 10 + %array = OpTypeArray %int %val_20 + %ptr = OpTypePointer Input %int + %func = OpTypeFunction %void %ptr %int + %struct = OpTypeStruct %int %ptr %array + """; + + addIntConstant("%val_20", 20); + + // when + Map data = parseTypes(input); + + // then + assertEquals(8, data.size()); + + Type typeVoid = types.getVoidType(); + Type typeBoolean = types.getBooleanType(); + Type typeInteger = types.getIntegerType(16); + Type typeVector = types.getArrayType(typeInteger, 10); + Type typeArray = types.getArrayType(typeInteger, 20); + Type typePointer = types.getScopedPointerType(Tag.Spirv.SC_INPUT, typeInteger); + Type typeFunction = types.getFunctionType(typeVoid, List.of(typePointer, typeInteger)); + Type typeStruct = types.getAggregateType(List.of(typeInteger, typePointer, typeArray)); + + assertEquals(typeVoid, data.get("%void")); + assertEquals(typeBoolean, data.get("%bool")); + assertEquals(typeInteger, data.get("%int")); + assertEquals(typeVector, data.get("%vector")); + assertEquals(typeArray, data.get("%array")); + assertEquals(typePointer, data.get("%ptr")); + assertEquals(typeFunction, data.get("%func")); + assertEquals(typeStruct, data.get("%struct")); + } + + @Test(expected = ParsingException.class) + public void testUnsupportedType() { + // given + String input = "%float = OpTypeFloat 32"; + + // when + parseTypes(input); + } + + @Test(expected = ParsingException.class) + public void testRedefiningType() { + // given + String input = """ + %type = OpTypeVoid + %type = OpTypeInt 16 1 + """; + + // when + parseTypes(input); + } + + @Test + public void testIntegerType() { + // given + String input = """ + %uint_8 = OpTypeInt 8 0 + %uint_16 = OpTypeInt 16 0 + %uint_32 = OpTypeInt 32 0 + %int_8 = OpTypeInt 8 1 + %int_16 = OpTypeInt 16 1 + %int_32 = OpTypeInt 32 1 + """; + + // when + Map data = parseTypes(input); + + // then + assertEquals(6, data.size()); + + assertEquals(types.getIntegerType(8), data.get("%uint_8")); + assertEquals(types.getIntegerType(16), data.get("%uint_16")); + assertEquals(types.getIntegerType(32), data.get("%uint_32")); + assertEquals(types.getIntegerType(8), data.get("%int_8")); + assertEquals(types.getIntegerType(16), data.get("%int_16")); + assertEquals(types.getIntegerType(32), data.get("%int_32")); + } + + @Test + public void testVectorType() { + // given + String input = """ + %bool = OpTypeBool + %int = OpTypeInt 32 1 + %vector_bool_5 = OpTypeVector %bool 5 + %vector_bool_10 = OpTypeVector %bool 10 + %vector_int_15 = OpTypeVector %int 15 + %vector_int_20 = OpTypeVector %int 20 + """; + + // when + Map data = parseTypes(input); + + // then + assertEquals(6, data.size()); + + Type typeBoolean = types.getBooleanType(); + Type typeInteger = types.getIntegerType(32); + + assertEquals(types.getArrayType(typeBoolean, 5), data.get("%vector_bool_5")); + assertEquals(types.getArrayType(typeBoolean, 10), data.get("%vector_bool_10")); + assertEquals(types.getArrayType(typeInteger, 15), data.get("%vector_int_15")); + assertEquals(types.getArrayType(typeInteger, 20), data.get("%vector_int_20")); + } + + @Test + public void testArrayType() { + // given + String input = """ + %bool = OpTypeBool + %int = OpTypeInt 32 1 + %array_bool_5 = OpTypeArray %bool %val_5 + %array_bool_10 = OpTypeArray %bool %val_10 + %array_int_15 = OpTypeArray %int %val_15 + %array_int_20 = OpTypeArray %int %val_20 + """; + + addIntConstant("%val_5", 5); + addIntConstant("%val_10", 10); + addIntConstant("%val_15", 15); + addIntConstant("%val_20", 20); + + // when + Map data = parseTypes(input); + + // then + assertEquals(6, data.size()); + + Type typeBoolean = types.getBooleanType(); + Type typeInteger = types.getIntegerType(32); + + assertEquals(types.getArrayType(typeBoolean, 5), data.get("%array_bool_5")); + assertEquals(types.getArrayType(typeBoolean, 10), data.get("%array_bool_10")); + assertEquals(types.getArrayType(typeInteger, 15), data.get("%array_int_15")); + assertEquals(types.getArrayType(typeInteger, 20), data.get("%array_int_20")); + } + + @Test + public void testPointerType() { + // given + String input = """ + %bool = OpTypeBool + %int = OpTypeInt 32 1 + %ptr_input_bool = OpTypePointer Input %bool + %ptr_input_int = OpTypePointer Input %int + %ptr_workgroup_int = OpTypePointer Workgroup %int + """; + + // when + Map data = parseTypes(input); + + // then + assertEquals(5, data.size()); + + ScopedPointerType boolPtr = (ScopedPointerType)data.get("%ptr_input_bool"); + assertEquals(Tag.Spirv.SC_INPUT, boolPtr.getScopeId()); + assertEquals(builder.getType("%bool"), boolPtr.getPointedType()); + + ScopedPointerType inputIntPtr = (ScopedPointerType)data.get("%ptr_input_int"); + assertEquals(Tag.Spirv.SC_INPUT, inputIntPtr.getScopeId()); + assertEquals(builder.getType("%int"), inputIntPtr.getPointedType()); + + ScopedPointerType workgroupIntPtr = (ScopedPointerType)data.get("%ptr_workgroup_int"); + assertEquals(Tag.Spirv.SC_WORKGROUP, workgroupIntPtr.getScopeId()); + assertEquals(builder.getType("%int"), workgroupIntPtr.getPointedType()); + } + + @Test(expected = ParsingException.class) + public void testPointerTypeUndefinedReference() { + // given + String input = "%ptr = OpTypePointer Input %undefined"; + + // when + parseTypes(input); + } + + @Test + public void testFunctionType() { + // given + String input = """ + %void = OpTypeVoid + %bool = OpTypeBool + %int = OpTypeInt 16 1 + %array = OpTypeArray %int %val_5 + %ptr = OpTypePointer Input %int + %f1 = OpTypeFunction %void + %f2 = OpTypeFunction %bool %int %array + %f3 = OpTypeFunction %ptr %ptr + """; + + addIntConstant("%val_5", 5); + + // when + Map data = parseTypes(input); + + // then + assertEquals(8, data.size()); + + Type typeVoid = types.getVoidType(); + Type typeBoolean = types.getBooleanType(); + Type typeInteger = types.getIntegerType(16); + Type typeArray = types.getArrayType(typeInteger, 5); + Type typePointer = types.getScopedPointerType(Tag.Spirv.SC_INPUT, typeInteger); + + assertEquals(data.get("%f1"), types.getFunctionType(typeVoid, List.of())); + assertEquals(data.get("%f2"), types.getFunctionType(typeBoolean, List.of(typeInteger, typeArray))); + assertEquals(data.get("%f3"), types.getFunctionType(typePointer, List.of(typePointer))); + } + + @Test(expected = ParsingException.class) + public void testFunctionTypeUndefinedReturnReference() { + // given + String input = "%func = OpTypeFunction %undefined"; + + // when + parseTypes(input); + } + + @Test(expected = ParsingException.class) + public void testFunctionTypeUndefinedArgumentReference() { + // given + String input = """ + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void %bool %undefined + """; + + // when + parseTypes(input); + } + + @Test + public void testStructType() { + // given + String input = """ + %bool = OpTypeBool + %int = OpTypeInt 32 0 + %array = OpTypeArray %int %val_10 + %s1 = OpTypeStruct %int %array + %ptr = OpTypePointer Input %s1 + %s2 = OpTypeStruct %bool %ptr + """; + + addIntConstant("%val_10", 10); + + // when + Map data = parseTypes(input); + + // then + assertEquals(6, data.size()); + + Type typeBoolean = types.getBooleanType(); + Type typeInteger = types.getIntegerType(32); + Type typeArray = types.getArrayType(typeInteger, 10); + Type typeStructFirst = types.getAggregateType(List.of(typeInteger, typeArray)); + Type typePointer = types.getScopedPointerType(Tag.Spirv.SC_INPUT, typeStructFirst); + Type typeStructSecond = types.getAggregateType(List.of(typeBoolean, typePointer)); + + assertEquals(data.get("%s1"), typeStructFirst); + assertEquals(data.get("%s2"), typeStructSecond); + } + + @Test(expected = ParsingException.class) + public void testStructTypeUndefinedReference() { + // given + String input = """ + %int = OpTypeInt 32 0 + %s1 = OpTypeStruct %int %ptr + """; + + // when + parseTypes(input); + } + + private Map parseTypes(String input) { + new MockSpirvParser(input).spv().accept(new VisitorOpsType(builder)); + return builder.getTypes(); + } + + private void addIntConstant(String id, int value) { + IntegerType type = types.getArchType(); + IntLiteral iValue = new IntLiteral(type, new BigInteger(Integer.toString(value))); + builder.addExpression(id, iValue); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/builders/ProgramBuilderTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/builders/ProgramBuilderTest.java new file mode 100644 index 0000000000..b31f54b427 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/builders/ProgramBuilderTest.java @@ -0,0 +1,83 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv.builders; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.type.FunctionType; +import com.dat3m.dartagnan.expression.type.TypeFactory; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.utils.ThreadGrid; +import com.dat3m.dartagnan.program.Function; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.event.core.Skip; +import org.junit.Test; + +import java.util.List; + +import static com.dat3m.dartagnan.program.event.EventFactory.newVoidFunctionCall; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class ProgramBuilderTest { + + private static final TypeFactory types = TypeFactory.getInstance(); + + private final ProgramBuilder builder = new ProgramBuilder(new ThreadGrid(1, 1, 1, 1)); + private final ControlFlowBuilder cfBuilder = builder.getControlFlowBuilder(); + + @Test + public void testAddEventOutsideFunction() { + testAddChildError("Attempt to add an event outside a function definition"); + } + + @Test + public void testAddEventBeforeBlock() { + FunctionType type = types.getFunctionType(types.getVoidType(), List.of()); + builder.startCurrentFunction(new Function("test", type, List.of(), 0, null)); + testAddChildError("Attempt to add an event outside a control flow block"); + } + + @Test + public void testAddEventAfterBlock() { + FunctionType type = types.getFunctionType(types.getVoidType(), List.of()); + builder.startCurrentFunction(new Function("test_func", type, List.of(), 0, null)); + cfBuilder.getOrCreateLabel("test_label"); + cfBuilder.startBlock("test_label"); + cfBuilder.endBlock(new Skip()); + testAddChildError("Attempt to add an event outside a control flow block"); + } + + private void testAddChildError(String error) { + // given + Event event = new Skip(); + try { + // when + builder.addEvent(event); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals(error, e.getMessage()); + } + } + + @Test + public void testCallingUndefinedFunction() { + // given + FunctionType type = types.getFunctionType(types.getVoidType(), List.of()); + Function called = new Function("called", type, List.of(), 1, null); + builder.setEntryPointId("test_func"); + + builder.startCurrentFunction(new Function("test_func", type, List.of(), 0, null)); + cfBuilder.getOrCreateLabel("test_label"); + cfBuilder.startBlock("test_label"); + builder.addEvent(newVoidFunctionCall(called, List.of())); + cfBuilder.endBlock(new Skip()); + builder.endCurrentFunction(); + + try { + // when + builder.build(); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals("Call to undefined function 'called'", e.getMessage()); + } + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/extensions/VisitorExtensionClspvReflectionTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/extensions/VisitorExtensionClspvReflectionTest.java new file mode 100644 index 0000000000..9f2868d4d2 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/extensions/VisitorExtensionClspvReflectionTest.java @@ -0,0 +1,379 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv.extensions; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.integers.IntLiteral; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.extenstions.VisitorExtensionClspvReflection; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockProgramBuilder; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks.MockSpirvParser; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.utils.ThreadGrid; +import com.dat3m.dartagnan.program.memory.ScopedPointerVariable; +import org.junit.Before; +import org.junit.Test; + +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class VisitorExtensionClspvReflectionTest { + + private final MockProgramBuilder builder = new MockProgramBuilder(new ThreadGrid(2, 3, 4, 1)); + + @Before + public void before() { + builder.mockIntType("%uint", 32); + + builder.mockVectorType("%v1uint", "%uint", 1); + builder.mockVectorType("%v2uint", "%uint", 2); + builder.mockVectorType("%v3uint", "%uint", 3); + + builder.mockConstant("%uint_0", "%uint", 0); + builder.mockConstant("%uint_1", "%uint", 1); + builder.mockConstant("%uint_4", "%uint", 4); + builder.mockConstant("%uint_8", "%uint", 8); + builder.mockConstant("%uint_12", "%uint", 12); + } + + @Test + public void testPushConstant() { + // given + String input = """ + %ext = OpExtInstImport "NonSemantic.ClspvReflection.5" + %1 = OpExtInst %void %ext PushConstantGlobalOffset %uint_0 %uint_12 + %2 = OpExtInst %void %ext PushConstantGlobalSize %uint_0 %uint_12 + %3 = OpExtInst %void %ext PushConstantEnqueuedLocalSize %uint_0 %uint_12 + %4 = OpExtInst %void %ext PushConstantNumWorkgroups %uint_0 %uint_12 + %5 = OpExtInst %void %ext PushConstantRegionOffset %uint_0 %uint_12 + %6 = OpExtInst %void %ext PushConstantRegionGroupOffset %uint_0 %uint_12 + """; + + builder.mockAggregateType("%6x_v3uint", "%v3uint", "%v3uint", "%v3uint", "%v3uint", "%v3uint", "%v3uint"); + builder.mockPtrType("%ptr_6x_v3uint", "%6x_v3uint", "PushConstant"); + ScopedPointerVariable pointer = builder.mockVariable("%var", "%ptr_6x_v3uint"); + + // when + new MockSpirvParser(input).spv().accept(new VisitorExtensionClspvReflection(builder)); + + // then + verifyPushConstant(pointer, 0, List.of(0, 0, 0)); + verifyPushConstant(pointer, 12, List.of(24, 1, 1)); + verifyPushConstant(pointer, 24, List.of(6, 1, 1)); + verifyPushConstant(pointer, 36, List.of(4, 1, 1)); + verifyPushConstant(pointer, 48, List.of(0, 0, 0)); + verifyPushConstant(pointer, 60, List.of(0, 0, 0)); + } + + @Test + public void testPushConstantMissingVariable() { + // given + String input = """ + %ext = OpExtInstImport "NonSemantic.ClspvReflection.5" + %1 = OpExtInst %void %ext PushConstantGlobalOffset %uint_0 %uint_12 + """; + + try { + // when + visit(input); + fail("Should throw exception"); + + } catch (ParsingException e) { + // then + assertEquals("Cannot identify PushConstant referenced by CLSPV extension", e.getMessage()); + } + } + + @Test + public void testPushConstantMultipleVariables() { + // given + String input = """ + %ext = OpExtInstImport "NonSemantic.ClspvReflection.5" + %1 = OpExtInst %void %ext PushConstantGlobalOffset %uint_0 %uint_12 + """; + + builder.mockAggregateType("%6x_v3uint", "%v3uint", "%v3uint", "%v3uint", "%v3uint", "%v3uint", "%v3uint"); + builder.mockPtrType("%ptr_6x_v3uint", "%6x_v3uint", "PushConstant"); + builder.mockVariable("%var1", "%ptr_6x_v3uint"); + builder.mockVariable("%var2", "%ptr_6x_v3uint"); + + try { + // when + visit(input); + fail("Should throw exception"); + + } catch (ParsingException e) { + // then + assertEquals("Cannot identify PushConstant referenced by CLSPV extension", e.getMessage()); + } + } + + @Test + public void testPushConstantMismatchingVariableType() { + // given + String input = """ + %ext = OpExtInstImport "NonSemantic.ClspvReflection.5" + %1 = OpExtInst %void %ext PushConstantGlobalOffset %uint_0 %uint_12 + """; + + builder.mockPtrType("%ptr_uint", "%uint", "PushConstant"); + builder.mockVariable("%var", "%ptr_uint"); + + try { + // when + visit(input); + fail("Should throw exception"); + + } catch (ParsingException e) { + // then + assertEquals("Unexpected type 'bv32' for PushConstant '%var'", e.getMessage()); + } + } + + @Test + public void testPushConstantIndexOutOfBound() { + // given + String input = """ + %ext = OpExtInstImport "NonSemantic.ClspvReflection.5" + %1 = OpExtInst %void %ext PushConstantGlobalOffset %uint_0 %uint_12 + %2 = OpExtInst %void %ext PushConstantGlobalSize %uint_0 %uint_12 + %3 = OpExtInst %void %ext PushConstantEnqueuedLocalSize %uint_0 %uint_12 + """; + + builder.mockAggregateType("%2x_v3uint", "%v3uint", "%v3uint"); + builder.mockPtrType("%ptr_2x_v3uint", "%2x_v3uint", "PushConstant"); + builder.mockVariable("%var", "%ptr_2x_v3uint"); + + try { + // when + visit(input); + fail("Should throw exception"); + + } catch (ParsingException e) { + // then + assertEquals("Out of bounds definition 'PushConstantEnqueuedLocalSize' " + + "in PushConstant '%var'", e.getMessage()); + } + } + + @Test + public void testPushConstantMismatchingElementType() { + // given + String input = """ + %ext = OpExtInstImport "NonSemantic.ClspvReflection.5" + %1 = OpExtInst %void %ext PushConstantGlobalOffset %uint_0 %uint_12 + """; + + builder.mockAggregateType("%1x_v2uint", "%v2uint"); + builder.mockPtrType("%ptr_1x_v2uint", "%1x_v2uint", "PushConstant"); + builder.mockVariable("%var", "%ptr_1x_v2uint"); + + try { + // when + visit(input); + fail("Should throw exception"); + + } catch (ParsingException e) { + // then + assertEquals("Unexpected element type in '%var' at index 0", e.getMessage()); + } + } + + @Test + public void testPodPushConstant() { + String input = """ + %ext = OpExtInstImport "NonSemantic.ClspvReflection.5" + %1 = OpExtInst %void %ext ArgumentInfo %kernel + %2 = OpExtInst %void %ext ArgumentPodPushConstant %kernel %uint_0 %uint_0 %uint_4 %1 + %3 = OpExtInst %void %ext ArgumentInfo %kernel + %4 = OpExtInst %void %ext ArgumentPodPushConstant %kernel %uint_1 %uint_4 %uint_8 %3 + """; + + builder.mockAggregateType("%v1uint_v2uint", "%v1uint", "%v2uint"); + builder.mockPtrType("%ptr_v1uint_v2uint", "%v1uint_v2uint", "PushConstant"); + ScopedPointerVariable pointer = builder.mockVariable("%var", "%ptr_v1uint_v2uint"); + + // when + new MockSpirvParser(input).spv().accept(new VisitorExtensionClspvReflection(builder)); + + // then + assertEquals(12, pointer.getAddress().size()); + } + + @Test + public void testPodPushConstantMixed() { + String input = """ + %ext = OpExtInstImport "NonSemantic.ClspvReflection.5" + %1 = OpExtInst %void %ext PushConstantGlobalSize %uint_0 %uint_12 + %2 = OpExtInst %void %ext ArgumentInfo %kernel + %3 = OpExtInst %void %ext ArgumentPodPushConstant %kernel %uint_1 %uint_0 %uint_4 %2 + """; + + builder.mockAggregateType("%v3uint_v1uint", "%v3uint", "%v1uint"); + builder.mockPtrType("%ptr_v3uint_v1uint", "%v3uint_v1uint", "PushConstant"); + ScopedPointerVariable pointer = builder.mockVariable("%var", "%ptr_v3uint_v1uint"); + + // when + new MockSpirvParser(input).spv().accept(new VisitorExtensionClspvReflection(builder)); + + // then + assertEquals(16, pointer.getAddress().size()); + verifyPushConstant(pointer, 0, List.of(24, 1, 1)); + } + + @Test + public void testPodPushConstantMissingVariable() { + String input = """ + %ext = OpExtInstImport "NonSemantic.ClspvReflection.5" + %1 = OpExtInst %void %ext ArgumentInfo %kernel + %2 = OpExtInst %void %ext ArgumentPodPushConstant %kernel %uint_0 %uint_0 %uint_4 %1 + %3 = OpExtInst %void %ext ArgumentInfo %kernel + %4 = OpExtInst %void %ext ArgumentPodPushConstant %kernel %uint_1 %uint_4 %uint_8 %3 + """; + + try { + // when + visit(input); + fail("Should throw exception"); + + } catch (ParsingException e) { + // then + assertEquals("Cannot identify PushConstant referenced by CLSPV extension", e.getMessage()); + } + } + + @Test + public void testPodPushConstantMultipleVariables() { + String input = """ + %ext = OpExtInstImport "NonSemantic.ClspvReflection.5" + %1 = OpExtInst %void %ext ArgumentInfo %kernel + %2 = OpExtInst %void %ext ArgumentPodPushConstant %kernel %uint_0 %uint_0 %uint_4 %1 + %3 = OpExtInst %void %ext ArgumentInfo %kernel + %4 = OpExtInst %void %ext ArgumentPodPushConstant %kernel %uint_1 %uint_4 %uint_8 %3 + """; + + builder.mockAggregateType("%v3uint_v1uint", "%v3uint", "%v1uint"); + builder.mockPtrType("%ptr_v3uint_v1uint", "%v3uint_v1uint", "PushConstant"); + builder.mockVariable("%var1", "%ptr_v3uint_v1uint"); + builder.mockVariable("%var2", "%ptr_v3uint_v1uint"); + + try { + // when + visit(input); + fail("Should throw exception"); + + } catch (ParsingException e) { + // then + assertEquals("Cannot identify PushConstant referenced by CLSPV extension", e.getMessage()); + } + } + + @Test + public void testPodPushConstantPodMismatchingVariableType() { + String input = """ + %ext = OpExtInstImport "NonSemantic.ClspvReflection.5" + %1 = OpExtInst %void %ext ArgumentInfo %kernel + %2 = OpExtInst %void %ext ArgumentPodPushConstant %kernel %uint_0 %uint_0 %uint_4 %1 + %3 = OpExtInst %void %ext ArgumentInfo %kernel + %4 = OpExtInst %void %ext ArgumentPodPushConstant %kernel %uint_1 %uint_4 %uint_8 %3 + """; + + builder.mockPtrType("%ptr_uint", "%uint", "PushConstant"); + builder.mockVariable("%var", "%ptr_uint"); + + try { + // when + visit(input); + fail("Should throw exception"); + + } catch (ParsingException e) { + // then + assertEquals("Unexpected type 'bv32' for PushConstant '%var'", e.getMessage()); + } + } + + @Test + public void testPodPushConstantIndexOutOfBound() { + String input = """ + %ext = OpExtInstImport "NonSemantic.ClspvReflection.5" + %1 = OpExtInst %void %ext ArgumentInfo %kernel + %2 = OpExtInst %void %ext ArgumentPodPushConstant %kernel %uint_0 %uint_0 %uint_4 %1 + %3 = OpExtInst %void %ext ArgumentInfo %kernel + %4 = OpExtInst %void %ext ArgumentPodPushConstant %kernel %uint_1 %uint_4 %uint_8 %3 + """; + + builder.mockAggregateType("%1x_v1uint", "%v1uint"); + builder.mockPtrType("%ptr_1x_v1uint", "%1x_v1uint", "PushConstant"); + builder.mockVariable("%var", "%ptr_1x_v1uint"); + + try { + // when + visit(input); + fail("Should throw exception"); + + } catch (ParsingException e) { + // then + assertEquals("Out of bounds definition 'ArgumentPodPushConstant' " + + "in PushConstant '%var'", e.getMessage()); + } + } + + @Test + public void testPodPushConstantMismatchingElementType() { + String input = """ + %ext = OpExtInstImport "NonSemantic.ClspvReflection.5" + %1 = OpExtInst %void %ext ArgumentInfo %kernel + %2 = OpExtInst %void %ext ArgumentPodPushConstant %kernel %uint_0 %uint_0 %uint_4 %1 + %3 = OpExtInst %void %ext ArgumentInfo %kernel + %4 = OpExtInst %void %ext ArgumentPodPushConstant %kernel %uint_1 %uint_4 %uint_8 %3 + """; + + builder.mockAggregateType("%v1uint_uint_uint", "%v1uint", "%uint", "%uint"); + builder.mockPtrType("%ptr_v1uint_uint_uint", "%v1uint_uint_uint", "PushConstant"); + builder.mockVariable("%var", "%ptr_v1uint_uint_uint"); + + try { + // when + visit(input); + fail("Should throw exception"); + + } catch (ParsingException e) { + // then + assertEquals("Unexpected offset in PushConstant '%var' element '1'", e.getMessage()); + } + } + + @Test + public void testPodPushConstantElementSizeOutOfBound() { + String input = """ + %ext = OpExtInstImport "NonSemantic.ClspvReflection.5" + %1 = OpExtInst %void %ext ArgumentInfo %kernel + %2 = OpExtInst %void %ext ArgumentPodPushConstant %kernel %uint_0 %uint_0 %uint_4 %1 + %3 = OpExtInst %void %ext ArgumentInfo %kernel + %4 = OpExtInst %void %ext ArgumentPodPushConstant %kernel %uint_1 %uint_4 %uint_8 %3 + """; + + builder.mockAggregateType("%2x_v1uint", "%v1uint", "%v1uint"); + builder.mockPtrType("%ptr_2x_v1uint", "%2x_v1uint", "PushConstant"); + builder.mockVariable("%var", "%ptr_2x_v1uint"); + + try { + // when + visit(input); + fail("Should throw exception"); + + } catch (ParsingException e) { + // then + assertEquals("Unexpected offset in PushConstant '%var' element '1'", e.getMessage()); + } + } + + private void visit(String input) { + new MockSpirvParser(input).spv().accept(new VisitorExtensionClspvReflection(builder)); + } + + private void verifyPushConstant(ScopedPointerVariable pointer, int offset, List expected) { + for (int i = 0; i < expected.size(); i++) { + int actual = ((IntLiteral) pointer.getAddress().getInitialValue(offset + i * 4)).getValueAsInt(); + assertEquals(expected.get(i).intValue(), actual); + } + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/helpers/HelperTagsTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/helpers/HelperTagsTest.java new file mode 100644 index 0000000000..b8d6f33754 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/helpers/HelperTagsTest.java @@ -0,0 +1,125 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv.helpers; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.type.IntegerType; +import com.dat3m.dartagnan.expression.type.TypeFactory; +import org.junit.Test; + +import java.util.Set; + +import static com.dat3m.dartagnan.program.event.Tag.Spirv.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class HelperTagsTest { + + private static final ExpressionFactory expressions = ExpressionFactory.getInstance(); + private static final IntegerType archType = TypeFactory.getInstance().getArchType(); + + @Test + public void testValidScope() { + doTestValidScope(0, CROSS_DEVICE); + doTestValidScope(1, DEVICE); + doTestValidScope(2, WORKGROUP); + doTestValidScope(3, SUBGROUP); + doTestValidScope(4, INVOCATION); + doTestValidScope(5, QUEUE_FAMILY); + doTestValidScope(6, SHADER_CALL); + } + + private void doTestValidScope(int input, String expected) { + // given + Expression expr = expressions.makeValue(input, archType); + + // when + String scope = HelperTags.parseScope("test", expr); + + // then + assertEquals(expected, scope); + } + + @Test + public void testInvalidScope() { + doTestInvalidScope(7, "Illegal scope value 7"); + doTestInvalidScope(-1, "Illegal scope value -1"); + } + + private void doTestInvalidScope(int input, String error) { + // given + Expression expr = expressions.makeValue(input, archType); + + try { + // when + HelperTags.parseScope("test", expr); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals(error, e.getMessage()); + } + } + + @Test + public void testValidMemorySemantics() { + doTestValidSemantics(0x0, Set.of(RELAXED)); + doTestValidSemantics(0x10, Set.of(SEQ_CST)); + doTestValidSemantics(0x40, Set.of(RELAXED, SEM_UNIFORM)); + doTestValidSemantics(0x42, Set.of(ACQUIRE, SEM_UNIFORM)); + doTestValidSemantics(0x44, Set.of(RELEASE, SEM_UNIFORM)); + doTestValidSemantics(0x48, Set.of(ACQ_REL, SEM_UNIFORM)); + doTestValidSemantics(0x50, Set.of(SEQ_CST, SEM_UNIFORM)); + doTestValidSemantics(0x90, Set.of(SEQ_CST, SEM_SUBGROUP)); + doTestValidSemantics(0x110, Set.of(SEQ_CST, SEM_WORKGROUP)); + doTestValidSemantics(0x210, Set.of(SEQ_CST, SEM_CROSS_WORKGROUP)); + doTestValidSemantics(0x410, Set.of(SEQ_CST, SEM_ATOMIC_COUNTER)); + doTestValidSemantics(0x810, Set.of(SEQ_CST, SEM_IMAGE)); + doTestValidSemantics(0x1010, Set.of(SEQ_CST, SEM_OUTPUT)); + doTestValidSemantics(0xd0, Set.of(SEQ_CST, SEM_UNIFORM, SEM_SUBGROUP)); + doTestValidSemantics(0xf10, Set.of(SEQ_CST, SEM_WORKGROUP, SEM_CROSS_WORKGROUP, + SEM_ATOMIC_COUNTER, SEM_IMAGE)); + doTestValidSemantics(0xfd0, Set.of(SEQ_CST, SEM_UNIFORM, SEM_SUBGROUP, SEM_WORKGROUP, + SEM_CROSS_WORKGROUP, SEM_ATOMIC_COUNTER, SEM_IMAGE)); + doTestValidSemantics(0x2010, Set.of(SEQ_CST, SEM_AVAILABLE)); + doTestValidSemantics(0x4010, Set.of(SEQ_CST, SEM_VISIBLE)); + doTestValidSemantics(0x6108, Set.of(ACQ_REL, SEM_WORKGROUP, SEM_AVAILABLE, SEM_VISIBLE)); + doTestValidSemantics(0x8010, Set.of(SEQ_CST, SEM_VOLATILE)); + doTestValidSemantics(0xe010, Set.of(SEQ_CST, SEM_AVAILABLE, SEM_VISIBLE, SEM_VOLATILE)); + doTestValidSemantics(0xefd0, Set.of(SEQ_CST, SEM_AVAILABLE, SEM_VISIBLE, SEM_VOLATILE, + SEM_UNIFORM, SEM_SUBGROUP, SEM_WORKGROUP, SEM_CROSS_WORKGROUP, SEM_ATOMIC_COUNTER, SEM_IMAGE)); + } + + public void doTestValidSemantics(int input, Set expected) { + // given + Expression expr = expressions.makeValue(input, archType); + + // when + Set tags = HelperTags.parseMemorySemanticsTags("test", expr); + + // then + assertEquals(expected, tags); + } + + @Test + public void testInvalidSemantics() { + doTestInvalidSemantics(0x1, "Unexpected memory semantics bits"); + doTestInvalidSemantics(0x3, "Unexpected memory semantics bits"); + doTestInvalidSemantics(0xffff, "Unexpected memory semantics bits"); + doTestInvalidSemantics(0x6, "Selected multiple non-relaxed memory order bits"); + doTestInvalidSemantics(0x18, "Selected multiple non-relaxed memory order bits"); + } + + private void doTestInvalidSemantics(int input, String error) { + // given + Expression expr = expressions.makeValue(input, archType); + + try { + // when + HelperTags.parseMemorySemanticsTags("test", expr); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals(error, e.getMessage()); + } + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/mocks/MockControlFlowBuilder.java b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/mocks/MockControlFlowBuilder.java new file mode 100644 index 0000000000..02506234f3 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/mocks/MockControlFlowBuilder.java @@ -0,0 +1,32 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks; + +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.builders.ControlFlowBuilder; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.Event; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class MockControlFlowBuilder extends ControlFlowBuilder { + public MockControlFlowBuilder(Map expressions) { + super(expressions); + } + + public List getBlockStack() { + return blockStack.stream().toList(); + } + + public Map getMergeLabelIds() { + return Map.copyOf(mergeLabelIds); + } + + public Map getLastBlockEvents() { + return Map.copyOf(lastBlockEvents); + } + + public Map getPhiDefinitions(String blockId) { + return Map.copyOf(phiDefinitions.computeIfAbsent(blockId, k -> new HashMap<>())); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/mocks/MockProgramBuilder.java b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/mocks/MockProgramBuilder.java new file mode 100644 index 0000000000..fe19f6231a --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/mocks/MockProgramBuilder.java @@ -0,0 +1,149 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks; + +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.Type; +import com.dat3m.dartagnan.expression.booleans.BoolLiteral; +import com.dat3m.dartagnan.expression.integers.IntLiteral; +import com.dat3m.dartagnan.expression.type.*; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.helpers.HelperTags; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.builders.ProgramBuilder; +import com.dat3m.dartagnan.parsers.program.visitors.spirv.utils.ThreadGrid; +import com.dat3m.dartagnan.program.memory.ScopedPointerVariable; +import com.dat3m.dartagnan.expression.type.ScopedPointerType; +import com.dat3m.dartagnan.program.Function; +import com.dat3m.dartagnan.program.event.core.Label; +import com.dat3m.dartagnan.program.memory.MemoryObject; + +import java.util.*; +import java.util.stream.Collectors; + +public class MockProgramBuilder extends ProgramBuilder { + + private static final TypeFactory typeFactory = TypeFactory.getInstance(); + private static final ExpressionFactory exprFactory = ExpressionFactory.getInstance(); + + public MockProgramBuilder() { + this(new ThreadGrid(1, 1, 1, 1)); + } + + public MockProgramBuilder(ThreadGrid grid) { + super(grid); + controlFlowBuilder = new MockControlFlowBuilder(expressions); + } + + @Override + public void setNextOps(Set nextOps) { + // Do nothing in the mock + } + + public VoidType mockVoidType(String id) { + return (VoidType) addType(id, typeFactory.getVoidType()); + } + + public BooleanType mockBoolType(String id) { + return (BooleanType) addType(id, typeFactory.getBooleanType()); + } + + public IntegerType mockIntType(String id, int bitWidth) { + return (IntegerType) addType(id, typeFactory.getIntegerType(bitWidth)); + } + + public ScopedPointerType mockPtrType(String id, String typeId, String storageClass) { + String storageClassTag = HelperTags.parseStorageClass(storageClass); + return (ScopedPointerType) addType(id, typeFactory.getScopedPointerType(storageClassTag, getType(typeId))); + } + + public ArrayType mockVectorType(String id, String innerTypeId, int size) { + Type innerType = getType(innerTypeId); + ArrayType type = size > 0 + ? typeFactory.getArrayType(innerType, size) + : typeFactory.getArrayType(innerType); + return (ArrayType) addType(id, type); + } + + public AggregateType mockAggregateType(String id, String... innerTypeIds) { + List innerTypes = Arrays.stream(innerTypeIds).map(this::getType).toList(); + AggregateType type = typeFactory.getAggregateType(innerTypes); + return (AggregateType) addType(id, type); + } + + public FunctionType mockFunctionType(String id, String retTypeId, String... argTypeIds) { + Type retType = getType(retTypeId); + List argTypes = Arrays.stream(argTypeIds).map(this::getType).toList(); + FunctionType type = typeFactory.getFunctionType(retType, argTypes); + return (FunctionType) addType(id, type); + } + + public Expression mockConstant(String id, String typeId, Object value) { + Type type = getType(typeId); + if (type instanceof BooleanType) { + BoolLiteral bConst = exprFactory.makeValue((boolean) value); + return addExpression(id, bConst); + } else if (type instanceof IntegerType iType) { + IntLiteral iValue = exprFactory.makeValue((int) value, iType); + return addExpression(id, iValue); + } else if (type instanceof ArrayType aType) { + Type elementType = aType.getElementType(); + List elements = mockConstantArrayElements(elementType, value); + Expression construction = exprFactory.makeArray(elementType, elements, true); + return addExpression(id, construction); + } else if (type instanceof AggregateType) { + List members = ((List) value).stream().map(s -> getExpression((String) s)).toList(); + Expression construction = exprFactory.makeConstruct(members); + return addExpression(id, construction); + } + throw new UnsupportedOperationException("Unsupported mock constant type " + typeId); + } + + private List mockConstantArrayElements(Type elementType, Object value) { + if (elementType instanceof BooleanType) { + return ((List) value).stream() + .map(v -> exprFactory.makeValue((boolean) v)) + .collect(Collectors.toList()); + } else if (elementType instanceof IntegerType iType) { + return ((List) value).stream() + .map(v -> exprFactory.makeValue((int) v, iType)) + .collect(Collectors.toList()); + } + throw new UnsupportedOperationException("Unsupported mock constant array element type " + elementType); + } + + public Expression mockUndefinedValue(String id, String typeId) { + Expression expression = makeUndefinedValue(getType(typeId)); + return addExpression(id, expression); + } + + public ScopedPointerVariable mockVariable(String id, String typeId) { + ScopedPointerType pointerType = (ScopedPointerType)getType(typeId); + Type pointedType = pointerType.getPointedType(); + String scopeId = pointerType.getScopeId(); + int bytes = typeFactory.getMemorySizeInBytes(pointedType); + MemoryObject memoryObject = program.getMemory().allocate(bytes); + memoryObject.setName(id); + ScopedPointerVariable pointer = exprFactory.makeScopedPointerVariable(id, scopeId, pointedType, memoryObject); + return (ScopedPointerVariable) addExpression(id, pointer); + } + + public void mockFunctionStart(boolean addStartLabel) { + FunctionType type = typeFactory.getFunctionType(typeFactory.getVoidType(), List.of()); + startCurrentFunction(new Function("mock_function", type, List.of(), 0, null)); + if (addStartLabel) { + Label label = controlFlowBuilder.getOrCreateLabel("%mock_label"); + controlFlowBuilder.startBlock("%mock_label"); + addEvent(label); + } + } + + public Function getCurrentFunction() { + return currentFunction; + } + + public Map getTypes() { + return Map.copyOf(types); + } + + public Map getExpressions() { + return Map.copyOf(expressions); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/mocks/MockSpirvParser.java b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/mocks/MockSpirvParser.java new file mode 100644 index 0000000000..f16134bb07 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/parsers/program/visitors/spirv/mocks/MockSpirvParser.java @@ -0,0 +1,22 @@ +package com.dat3m.dartagnan.parsers.program.visitors.spirv.mocks; + +import com.dat3m.dartagnan.exception.AbortErrorListener; +import com.dat3m.dartagnan.parsers.SpirvLexer; +import com.dat3m.dartagnan.parsers.SpirvParser; +import org.antlr.v4.runtime.*; + +public class MockSpirvParser extends SpirvParser { + public MockSpirvParser(String input) { + super(mockTokenStream(input)); + addErrorListener(new DiagnosticErrorListener(true)); + addErrorListener(new AbortErrorListener()); + } + + private static TokenStream mockTokenStream(String input) { + CharStream charStream = CharStreams.fromString(input); + SpirvLexer lexer = new SpirvLexer(charStream); + lexer.addErrorListener(new DiagnosticErrorListener(true)); + lexer.addErrorListener(new AbortErrorListener()); + return new CommonTokenStream(lexer); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/program/processing/compilation/VisitorSpirvVulkanTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/program/processing/compilation/VisitorSpirvVulkanTest.java new file mode 100644 index 0000000000..20461a6ad8 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/program/processing/compilation/VisitorSpirvVulkanTest.java @@ -0,0 +1,509 @@ +package com.dat3m.dartagnan.program.processing.compilation; + +import com.dat3m.dartagnan.expression.Expression; +import com.dat3m.dartagnan.expression.ExpressionFactory; +import com.dat3m.dartagnan.expression.integers.IntBinaryOp; +import com.dat3m.dartagnan.expression.type.FunctionType; +import com.dat3m.dartagnan.expression.type.IntegerType; +import com.dat3m.dartagnan.expression.type.TypeFactory; +import com.dat3m.dartagnan.program.Function; +import com.dat3m.dartagnan.program.Register; +import com.dat3m.dartagnan.program.event.Event; +import com.dat3m.dartagnan.program.event.EventFactory; +import com.dat3m.dartagnan.program.event.Tag; +import com.dat3m.dartagnan.program.event.core.*; +import com.dat3m.dartagnan.program.event.lang.spirv.*; +import com.dat3m.dartagnan.program.memory.MemoryObject; +import com.google.common.collect.Sets; +import org.junit.Test; + +import java.util.List; +import java.util.Set; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; + +public class VisitorSpirvVulkanTest { + + private static final TypeFactory types = TypeFactory.getInstance(); + private static final ExpressionFactory expressions = ExpressionFactory.getInstance(); + private static final IntegerType archType = types.getArchType(); + + private final VisitorSpirvVulkan visitor = new VisitorSpirvVulkan(); + + @Test + public void testLoad() { + doTestLoad( + Set.of(Tag.Spirv.SC_PRIVATE), + Set.of() + ); + doTestLoad( + Set.of(Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE, Tag.Vulkan.VISIBLE) + ); + doTestLoad( + Set.of(Tag.Spirv.MEM_VISIBLE, Tag.Spirv.SC_UNIFORM), + Set.of(Tag.Vulkan.VISIBLE, Tag.Vulkan.SC0, Tag.Vulkan.NON_PRIVATE) + ); + doTestLoad( + Set.of(Tag.Spirv.MEM_VISIBLE, Tag.Spirv.DEVICE, Tag.Spirv.SC_UNIFORM), + Set.of(Tag.Vulkan.VISIBLE, Tag.Vulkan.DEVICE, Tag.Vulkan.VISDEVICE, Tag.Vulkan.SC0, Tag.Vulkan.NON_PRIVATE) + ); + } + + private void doTestLoad(Set spvTags, Set vulTags) { + // given + Register register = mock(Register.class); + MemoryObject address = mock(MemoryObject.class); + Load e = EventFactory.newLoad(register, address); + e.addTags(spvTags); + + // when + List seq = visitor.visitLoad(e); + + // then + assertEquals(1, seq.size()); + Load load = (Load) seq.get(0); + Set baseTags = Set.of(Tag.VISIBLE, Tag.MEMORY, Tag.READ); + assertEquals(Sets.union(baseTags, vulTags), load.getTags()); + } + + @Test + public void testStore() { + doTestStore( + Set.of(Tag.Spirv.SC_PRIVATE), + Set.of() + ); + doTestStore( + Set.of(Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE, Tag.Vulkan.AVAILABLE) + ); + doTestStore( + Set.of(Tag.Spirv.MEM_AVAILABLE, Tag.Spirv.SC_UNIFORM), + Set.of(Tag.Vulkan.AVAILABLE, Tag.Vulkan.SC0, Tag.Vulkan.NON_PRIVATE) + ); + doTestStore( + Set.of(Tag.Spirv.MEM_AVAILABLE, Tag.Spirv.DEVICE, Tag.Spirv.SC_UNIFORM), + Set.of(Tag.Vulkan.AVAILABLE, Tag.Vulkan.DEVICE, Tag.Vulkan.AVDEVICE, Tag.Vulkan.SC0, Tag.Vulkan.NON_PRIVATE) + ); + } + + private void doTestStore(Set spvTags, Set vulTags) { + // given + Expression value = mock(Expression.class); + MemoryObject address = mock(MemoryObject.class); + Store e = EventFactory.newStore(address, value); + e.addTags(spvTags); + + // when + List seq = visitor.visitStore(e); + + // then + assertEquals(1, seq.size()); + Store load = (Store) seq.get(0); + Set baseTags = Set.of(Tag.VISIBLE, Tag.MEMORY, Tag.WRITE); + assertEquals(Sets.union(baseTags, vulTags), load.getTags()); + } + + @Test + public void testSpirvLoad() { + doTestSpirvLoad( + Set.of(Tag.Spirv.RELAXED, Tag.Spirv.SUBGROUP, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.SUB_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE) + ); + doTestSpirvLoad( + Set.of(Tag.Spirv.SEQ_CST, Tag.Spirv.SUBGROUP, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.ACQUIRE, Tag.Vulkan.SUB_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE) + ); + doTestSpirvLoad( + Set.of(Tag.Spirv.ACQUIRE, Tag.Spirv.WORKGROUP, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.ACQUIRE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE) + ); + doTestSpirvLoad( + Set.of(Tag.Spirv.ACQUIRE, Tag.Spirv.WORKGROUP, Tag.Spirv.SEM_UNIFORM, Tag.Spirv.SEM_VISIBLE, Tag.Spirv.SC_UNIFORM), + Set.of(Tag.Vulkan.ACQUIRE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SEMSC0, Tag.Vulkan.SEM_VISIBLE, Tag.Vulkan.SC0, Tag.Vulkan.NON_PRIVATE) + ); + doTestSpirvLoad( + Set.of(Tag.Spirv.RELAXED, Tag.Spirv.DEVICE, Tag.Spirv.SC_UNIFORM), + Set.of(Tag.Vulkan.DEVICE, Tag.Vulkan.VISDEVICE, Tag.Vulkan.SC0, Tag.Vulkan.NON_PRIVATE) + ); + } + + private void doTestSpirvLoad(Set spvTags, Set vulTags) { + // given + Register register = mock(Register.class); + MemoryObject address = mock(MemoryObject.class); + String scope = Tag.Spirv.getScopeTag(spvTags); + SpirvLoad e = EventFactory.Spirv.newSpirvLoad(register, address, scope, spvTags); + e.setFunction(mock(Function.class)); + + // when + List seq = visitor.visitSpirvLoad(e); + + // then + assertEquals(1, seq.size()); + Load load = (Load) seq.get(0); + Set baseTags = Set.of(Tag.VISIBLE, Tag.MEMORY, Tag.READ, Tag.Vulkan.ATOM, + Tag.Vulkan.VISIBLE, Tag.Vulkan.NON_PRIVATE); + assertEquals(Sets.union(baseTags, vulTags), load.getTags()); + } + + @Test + public void testSpirvStore() { + doTestSpirvStore( + Set.of(Tag.Spirv.RELAXED, Tag.Spirv.SUBGROUP, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.SUB_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE) + ); + doTestSpirvStore( + Set.of(Tag.Spirv.SEQ_CST, Tag.Spirv.SUBGROUP, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.RELEASE, Tag.Vulkan.SUB_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE) + ); + doTestSpirvStore( + Set.of(Tag.Spirv.RELEASE, Tag.Spirv.WORKGROUP, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.RELEASE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE) + ); + doTestSpirvStore( + Set.of(Tag.Spirv.RELEASE, Tag.Spirv.WORKGROUP, Tag.Spirv.SEM_UNIFORM, Tag.Spirv.SEM_AVAILABLE, Tag.Spirv.SC_UNIFORM), + Set.of(Tag.Vulkan.RELEASE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SEMSC0, Tag.Vulkan.SEM_AVAILABLE, Tag.Vulkan.SC0, Tag.Vulkan.NON_PRIVATE) + ); + doTestSpirvStore( + Set.of(Tag.Spirv.RELAXED, Tag.Spirv.DEVICE, Tag.Spirv.SC_UNIFORM), + Set.of(Tag.Vulkan.DEVICE, Tag.Vulkan.AVDEVICE, Tag.Vulkan.SC0, Tag.Vulkan.NON_PRIVATE) + ); + } + + private void doTestSpirvStore(Set spvTags, Set vulTags) { + // given + Expression value = mock(Expression.class); + MemoryObject address = mock(MemoryObject.class); + String scope = Tag.Spirv.getScopeTag(spvTags); + SpirvStore e = EventFactory.Spirv.newSpirvStore(address, value, scope, spvTags); + e.setFunction(mock(Function.class)); + + // when + List seq = visitor.visitSpirvStore(e); + + // then + assertEquals(1, seq.size()); + Store store = (Store) seq.get(0); + Set baseTags = Set.of(Tag.VISIBLE, Tag.MEMORY, Tag.WRITE, Tag.Vulkan.ATOM, + Tag.Vulkan.AVAILABLE, Tag.Vulkan.NON_PRIVATE); + assertEquals(Sets.union(baseTags, vulTags), store.getTags()); + } + + @Test + public void testSpirvXchg() { + doTestSpirvXchg( + Set.of(Tag.Spirv.RELAXED, Tag.Spirv.SUBGROUP, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.SUB_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE), + Set.of(Tag.Vulkan.SUB_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE) + ); + doTestSpirvXchg( + Set.of(Tag.Spirv.ACQUIRE, Tag.Spirv.WORKGROUP, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.ACQUIRE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE), + Set.of(Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE) + ); + doTestSpirvXchg( + Set.of(Tag.Spirv.RELEASE, Tag.Spirv.WORKGROUP, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE), + Set.of(Tag.Vulkan.RELEASE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE) + ); + doTestSpirvXchg( + Set.of(Tag.Spirv.ACQ_REL, Tag.Spirv.WORKGROUP, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.ACQUIRE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE), + Set.of(Tag.Vulkan.RELEASE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE) + ); + doTestSpirvXchg( + Set.of(Tag.Spirv.SEQ_CST, Tag.Spirv.WORKGROUP, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.ACQUIRE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE), + Set.of(Tag.Vulkan.RELEASE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE) + ); + doTestSpirvXchg( + Set.of(Tag.Spirv.RELAXED, Tag.Spirv.DEVICE, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.DEVICE, Tag.Vulkan.VISDEVICE, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE), + Set.of(Tag.Vulkan.DEVICE, Tag.Vulkan.AVDEVICE, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE) + ); + } + + private void doTestSpirvXchg(Set spvTags, Set loadTags, Set storeTags) { + // given + Function function = new Function("mock", mock(FunctionType.class), List.of(), 0, null); + Register register = function.newRegister(types.getBooleanType()); + Expression value = mock(Expression.class); + MemoryObject address = mock(MemoryObject.class); + String scope = Tag.Spirv.getScopeTag(spvTags); + SpirvXchg e = EventFactory.Spirv.newSpirvXchg(register, address, value, scope, spvTags); + e.setFunction(function); + + // when + List seq = visitor.visitSpirvXchg(e); + + // then + assertEquals(3, seq.size()); + Load load = (Load) seq.get(0); + Set baseLoadTags = Set.of(Tag.VISIBLE, Tag.MEMORY, Tag.READ, Tag.RMW, Tag.Vulkan.ATOM, + Tag.Vulkan.VISIBLE, Tag.Vulkan.NON_PRIVATE); + assertEquals(Sets.union(baseLoadTags, loadTags), load.getTags()); + Store store = (Store) seq.get(1); + Set baseStoreTags = Set.of(Tag.VISIBLE, Tag.MEMORY, Tag.WRITE, Tag.RMW, Tag.Vulkan.ATOM, + Tag.Vulkan.AVAILABLE, Tag.Vulkan.NON_PRIVATE); + assertEquals(Sets.union(baseStoreTags, storeTags), store.getTags()); + Local local = (Local) seq.get(2); + assertEquals(register, local.getResultRegister()); + } + + @Test + public void testSpirvRmw() { + doTestSpirvRmw( + Set.of(Tag.Spirv.RELAXED, Tag.Spirv.SUBGROUP, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.SUB_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE), + Set.of(Tag.Vulkan.SUB_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE) + ); + doTestSpirvRmw( + Set.of(Tag.Spirv.ACQUIRE, Tag.Spirv.WORKGROUP, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.ACQUIRE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE), + Set.of(Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE) + ); + doTestSpirvRmw( + Set.of(Tag.Spirv.RELEASE, Tag.Spirv.WORKGROUP, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE), + Set.of(Tag.Vulkan.RELEASE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE) + ); + doTestSpirvRmw( + Set.of(Tag.Spirv.ACQ_REL, Tag.Spirv.WORKGROUP, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.ACQUIRE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE), + Set.of(Tag.Vulkan.RELEASE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE) + ); + doTestSpirvRmw( + Set.of(Tag.Spirv.SEQ_CST, Tag.Spirv.WORKGROUP, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.ACQUIRE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE), + Set.of(Tag.Vulkan.RELEASE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE) + ); + doTestSpirvRmw( + Set.of(Tag.Spirv.RELAXED, Tag.Spirv.DEVICE, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.DEVICE, Tag.Vulkan.VISDEVICE, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE), + Set.of(Tag.Vulkan.DEVICE, Tag.Vulkan.AVDEVICE, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE) + ); + } + + private void doTestSpirvRmw(Set spvTags, Set loadTags, Set storeTags) { + // given + Function function = new Function("mock", mock(FunctionType.class), List.of(), 0, null); + Register register = function.newRegister(archType); + Expression value = expressions.makeValue(1, archType); + MemoryObject address = mock(MemoryObject.class); + String scope = Tag.Spirv.getScopeTag(spvTags); + SpirvRmw e = EventFactory.Spirv.newSpirvRmw(register, address, IntBinaryOp.ADD, value, scope, spvTags); + e.setFunction(function); + + // when + List seq = visitor.visitSpirvRMW(e); + + // then + assertEquals(3, seq.size()); + Load load = (Load) seq.get(0); + Set baseLoadTags = Set.of(Tag.VISIBLE, Tag.MEMORY, Tag.READ, Tag.RMW, Tag.Vulkan.ATOM, + Tag.Vulkan.VISIBLE, Tag.Vulkan.NON_PRIVATE); + assertEquals(Sets.union(baseLoadTags, loadTags), load.getTags()); + Store store = (Store) seq.get(1); + Set baseStoreTags = Set.of(Tag.VISIBLE, Tag.MEMORY, Tag.WRITE, Tag.RMW, Tag.Vulkan.ATOM, + Tag.Vulkan.AVAILABLE, Tag.Vulkan.NON_PRIVATE); + assertEquals(Sets.union(baseStoreTags, storeTags), store.getTags()); + Local local = (Local) seq.get(2); + assertEquals(register, local.getResultRegister()); + } + + @Test + public void testSpirvCmpXchg() { + doTestSpirvCmpXchg( + Tag.Spirv.WORKGROUP, + Set.of(Tag.Spirv.RELAXED, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Spirv.RELAXED, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE), + Set.of(Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE)); + doTestSpirvCmpXchg( + Tag.Spirv.WORKGROUP, + Set.of(Tag.Spirv.ACQUIRE, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Spirv.ACQUIRE, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.ACQUIRE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE), + Set.of(Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE)); + doTestSpirvCmpXchg( + Tag.Spirv.WORKGROUP, + Set.of(Tag.Spirv.RELEASE, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Spirv.RELAXED, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE), + Set.of(Tag.Vulkan.RELEASE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE)); + doTestSpirvCmpXchg( + Tag.Spirv.WORKGROUP, + Set.of(Tag.Spirv.ACQ_REL, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Spirv.ACQUIRE, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.ACQUIRE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE), + Set.of(Tag.Vulkan.RELEASE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE)); + doTestSpirvCmpXchg( + Tag.Spirv.WORKGROUP, + Set.of(Tag.Spirv.SEQ_CST, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Spirv.ACQUIRE, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.ACQUIRE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE), + Set.of(Tag.Vulkan.RELEASE, Tag.Vulkan.WORK_GROUP, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE)); + doTestSpirvCmpXchg( + Tag.Spirv.DEVICE, + Set.of(Tag.Spirv.RELAXED, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Spirv.RELAXED, Tag.Spirv.SC_WORKGROUP), + Set.of(Tag.Vulkan.DEVICE, Tag.Vulkan.VISDEVICE, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE), + Set.of(Tag.Vulkan.DEVICE, Tag.Vulkan.AVDEVICE, Tag.Vulkan.SC1, Tag.Vulkan.NON_PRIVATE)); + } + + private void doTestSpirvCmpXchg(String scope, Set eqTags, Set neqTags, Set loadTags, Set storeTags) { + // given + Function function = new Function("mock", mock(FunctionType.class), List.of(), 0, null); + Register register = function.newRegister(archType); + Expression cmp = expressions.makeValue(0, archType); + Expression value = expressions.makeValue(1, archType); + MemoryObject address = mock(MemoryObject.class); + SpirvCmpXchg e = EventFactory.Spirv.newSpirvCmpXchg(register, address, cmp, value, scope, eqTags, neqTags); + e.setFunction(function); + + // when + List seq = visitor.visitSpirvCmpXchg(e); + + // then + assertEquals(5, seq.size()); + Load load = (Load) seq.get(0); + Set baseLoadTags = Set.of(Tag.VISIBLE, Tag.MEMORY, Tag.READ, Tag.RMW, + Tag.Vulkan.ATOM, Tag.Vulkan.VISIBLE, Tag.Vulkan.NON_PRIVATE); + assertEquals(Sets.union(baseLoadTags, loadTags), load.getTags()); + Store store = (Store) seq.get(3); + Set baseStoreTags = Set.of(Tag.VISIBLE, Tag.MEMORY, Tag.WRITE, Tag.RMW, + Tag.Vulkan.ATOM, Tag.Vulkan.AVAILABLE, Tag.Vulkan.NON_PRIVATE); + assertEquals(Sets.union(baseStoreTags, storeTags), store.getTags()); + } + + @Test + public void testCmpXchgIllegal() { + doTestSpirvCmpXchgIllegal( + Set.of(Tag.Spirv.ACQUIRE), + Set.of(Tag.Spirv.RELAXED), + "Spir-V CmpXchg with unequal tag sets is not supported"); + doTestSpirvCmpXchgIllegal( + Set.of(Tag.Spirv.ACQ_REL), + Set.of(Tag.Spirv.RELAXED), + "Spir-V CmpXchg with unequal tag sets is not supported"); + doTestSpirvCmpXchgIllegal( + Set.of(Tag.Spirv.RELAXED, Tag.Spirv.SEM_UNIFORM), + Set.of(Tag.Spirv.RELAXED), + "Spir-V CmpXchg with unequal tag sets is not supported"); + doTestSpirvCmpXchgIllegal( + Set.of(Tag.Spirv.RELAXED), + Set.of(Tag.Spirv.RELAXED, Tag.Spirv.SEM_UNIFORM), + "Spir-V CmpXchg with unequal tag sets is not supported"); + } + + private void doTestSpirvCmpXchgIllegal(Set eqTags, Set neqTags, String error) { + // given + Function function = new Function("mock", mock(FunctionType.class), List.of(), 0, null); + Register register = function.newRegister(archType); + Expression cmp = expressions.makeValue(0, archType); + Expression value = expressions.makeValue(1, archType); + MemoryObject address = mock(MemoryObject.class); + SpirvCmpXchg e = EventFactory.Spirv.newSpirvCmpXchg(register, + address, cmp, value, Tag.Spirv.WORKGROUP, eqTags, neqTags); + e.setFunction(function); + + try { + // when + visitor.visitSpirvCmpXchg(e); + fail("Should throw exception"); + } catch (Exception ex) { + // then + assertEquals(error, ex.getMessage()); + } + } + + @Test + public void testSpirvMemoryBarrier() { + doTestSpirvMemoryBarrier( + Set.of(Tag.Spirv.RELAXED, Tag.Spirv.SUBGROUP), + Set.of(Tag.Vulkan.SUB_GROUP) + ); + doTestSpirvMemoryBarrier( + Set.of(Tag.Spirv.ACQUIRE, Tag.Spirv.SUBGROUP), + Set.of(Tag.Vulkan.ACQUIRE, Tag.Vulkan.SUB_GROUP) + ); + doTestSpirvMemoryBarrier( + Set.of(Tag.Spirv.RELEASE, Tag.Spirv.SUBGROUP), + Set.of(Tag.Vulkan.RELEASE, Tag.Vulkan.SUB_GROUP) + ); + doTestSpirvMemoryBarrier( + Set.of(Tag.Spirv.ACQ_REL, Tag.Spirv.SUBGROUP), + Set.of(Tag.Vulkan.ACQUIRE, Tag.Vulkan.RELEASE, Tag.Vulkan.SUB_GROUP) + ); + doTestSpirvMemoryBarrier( + Set.of(Tag.Spirv.SEQ_CST, Tag.Spirv.SUBGROUP), + Set.of(Tag.Vulkan.ACQUIRE, Tag.Vulkan.RELEASE, Tag.Vulkan.SUB_GROUP) + ); + } + + private void doTestSpirvMemoryBarrier(Set spvTags, Set expected) { + // given + GenericVisibleEvent e = new GenericVisibleEvent("membar", Tag.FENCE); + e.addTags(spvTags); + + // when + List seq = visitor.visitGenericVisibleEvent(e); + + // then + assertEquals(1, seq.size()); + GenericVisibleEvent barrier = (GenericVisibleEvent) seq.get(0); + Set baseTags = Set.of(Tag.VISIBLE, Tag.FENCE); + assertEquals(Sets.union(baseTags, expected), barrier.getTags()); + } + + @Test + public void testSpirvControlBarrier() { + doTestSpirvControlBarrier( + Set.of(), + Set.of() + ); + doTestSpirvControlBarrier( + Set.of(Tag.Spirv.RELAXED, Tag.Spirv.SUBGROUP), + Set.of(Tag.FENCE, Tag.Vulkan.SUB_GROUP) + ); + doTestSpirvControlBarrier( + Set.of(Tag.Spirv.ACQUIRE, Tag.Spirv.SUBGROUP), + Set.of(Tag.FENCE, Tag.Vulkan.ACQUIRE, Tag.Vulkan.SUB_GROUP) + ); + doTestSpirvControlBarrier( + Set.of(Tag.Spirv.RELEASE, Tag.Spirv.SUBGROUP), + Set.of(Tag.FENCE, Tag.Vulkan.RELEASE, Tag.Vulkan.SUB_GROUP) + ); + doTestSpirvControlBarrier( + Set.of(Tag.Spirv.ACQ_REL, Tag.Spirv.SUBGROUP), + Set.of(Tag.FENCE, Tag.Vulkan.ACQUIRE, Tag.Vulkan.RELEASE, Tag.Vulkan.SUB_GROUP) + ); + doTestSpirvControlBarrier( + Set.of(Tag.Spirv.SEQ_CST, Tag.Spirv.SUBGROUP), + Set.of(Tag.FENCE, Tag.Vulkan.ACQUIRE, Tag.Vulkan.RELEASE, Tag.Vulkan.SUB_GROUP) + ); + } + + private void doTestSpirvControlBarrier(Set spvTags, Set expected) { + // given + ControlBarrier e = EventFactory.newControlBarrier("cbar", mock(Expression.class)); + e.addTags(Tag.Spirv.CONTROL); + if (!spvTags.isEmpty()) { + e.addTags(spvTags); + } else { + e.removeTags(Tag.FENCE); + } + + // when + List seq = visitor.visitControlBarrier(e); + + // then + assertEquals(1, seq.size()); + ControlBarrier barrier = (ControlBarrier) seq.get(0); + Set baseTags = Set.of(Tag.VISIBLE, Tag.Vulkan.CBAR); + assertEquals(Sets.union(baseTags, expected), barrier.getTags()); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/basic/SpirvAssertionsTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/basic/SpirvAssertionsTest.java new file mode 100644 index 0000000000..18878d7f92 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/basic/SpirvAssertionsTest.java @@ -0,0 +1,154 @@ +package com.dat3m.dartagnan.spirv.basic; + +import com.dat3m.dartagnan.configuration.Arch; +import com.dat3m.dartagnan.parsers.cat.ParserCat; +import com.dat3m.dartagnan.parsers.program.ProgramParser; +import com.dat3m.dartagnan.program.Program; +import com.dat3m.dartagnan.utils.Result; +import com.dat3m.dartagnan.verification.VerificationTask; +import com.dat3m.dartagnan.verification.solving.AssumeSolver; +import com.dat3m.dartagnan.wmm.Wmm; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.sosy_lab.common.ShutdownManager; +import org.sosy_lab.common.configuration.Configuration; +import org.sosy_lab.common.configuration.InvalidConfigurationException; +import org.sosy_lab.common.log.BasicLogManager; +import org.sosy_lab.java_smt.SolverContextFactory; +import org.sosy_lab.java_smt.api.ProverEnvironment; +import org.sosy_lab.java_smt.api.SolverContext; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.EnumSet; + +import static com.dat3m.dartagnan.configuration.Property.PROGRAM_SPEC; +import static com.dat3m.dartagnan.utils.ResourceHelper.getRootPath; +import static com.dat3m.dartagnan.utils.ResourceHelper.getTestResourcePath; +import static com.dat3m.dartagnan.utils.Result.FAIL; +import static com.dat3m.dartagnan.utils.Result.PASS; +import static org.junit.Assert.assertEquals; + +@RunWith(Parameterized.class) +public class SpirvAssertionsTest { + + private final String modelPath = getRootPath("cat/spirv.cat"); + private final String programPath; + private final int bound; + private final Result expected; + + public SpirvAssertionsTest(String file, int bound, Result expected) { + this.programPath = getTestResourcePath("spirv/basic/" + file); + this.bound = bound; + this.expected = expected; + } + + @Parameterized.Parameters(name = "{index}: {0}, {1}, {2}") + public static Iterable data() throws IOException { + return Arrays.asList(new Object[][]{ + {"empty-exists-false.spv.dis", 1, FAIL}, + {"empty-exists-true.spv.dis", 1, PASS}, + {"empty-forall-false.spv.dis", 1, FAIL}, + {"empty-forall-true.spv.dis", 1, PASS}, + {"empty-not-exists-false.spv.dis", 1, PASS}, + {"empty-not-exists-true.spv.dis", 1, FAIL}, + {"init-forall.spv.dis", 1, PASS}, + {"init-forall-split.spv.dis", 1, PASS}, + {"init-forall-not-exists.spv.dis", 1, PASS}, + {"init-forall-not-exists-fail.spv.dis", 1, FAIL}, + {"uninitialized-exists.spv.dis", 1, PASS}, + {"uninitialized-forall.spv.dis", 1, FAIL}, + {"uninitialized-private-exists.spv.dis", 1, PASS}, + {"uninitialized-private-forall.spv.dis", 1, FAIL}, + {"read-write.spv.dis", 1, PASS}, + {"vector-init.spv.dis", 1, PASS}, + {"vector.spv.dis", 1, PASS}, + {"array.spv.dis", 1, PASS}, + {"array-of-vector.spv.dis", 1, PASS}, + {"array-of-vector1.spv.dis", 1, PASS}, + {"vector-read-write.spv.dis", 1, PASS}, + {"mixed-size.spv.dis", 1, PASS}, + {"ids.spv.dis", 1, PASS}, + {"builtin-constant.spv.dis", 1, PASS}, + {"builtin-variable.spv.dis", 1, PASS}, + {"builtin-default-config.spv.dis", 1, PASS}, + {"builtin-all-123.spv.dis", 1, PASS}, + {"builtin-all-321.spv.dis", 1, PASS}, + {"branch-cond-ff.spv.dis", 1, PASS}, + {"branch-cond-ff-inverted.spv.dis", 1, PASS}, + {"branch-cond-bf.spv.dis", 1, FAIL}, + {"branch-cond-bf.spv.dis", 2, PASS}, + {"branch-cond-bf.spv.dis", 3, PASS}, + {"branch-cond-fb.spv.dis", 1, FAIL}, + {"branch-cond-fb.spv.dis", 2, PASS}, + {"branch-cond-fb.spv.dis", 3, PASS}, + {"branch-cond-struct.spv.dis", 1, PASS}, + {"branch-cond-struct-read-write.spv.dis", 1, PASS}, + {"branch-race.spv.dis", 1, PASS}, + {"branch-loop.spv.dis", 2, FAIL}, + {"branch-loop.spv.dis", 3, PASS}, + {"branch-loop.spv.dis", 4, PASS}, + {"loop-struct-cond.spv.dis", 1, FAIL}, + {"loop-struct-cond.spv.dis", 2, PASS}, + {"loop-struct-cond.spv.dis", 3, PASS}, + {"loop-struct-cond-suffix.spv.dis", 1, FAIL}, + {"loop-struct-cond-suffix.spv.dis", 2, PASS}, + {"loop-struct-cond-suffix.spv.dis", 3, PASS}, + {"loop-struct-cond-sequence.spv.dis", 2, FAIL}, + {"loop-struct-cond-sequence.spv.dis", 3, PASS}, + {"loop-struct-cond-sequence.spv.dis", 4, PASS}, + {"loop-struct-cond-nested.spv.dis", 2, FAIL}, + {"loop-struct-cond-nested.spv.dis", 3, PASS}, + {"loop-struct-cond-nested.spv.dis", 4, PASS}, + {"phi.spv.dis", 1, PASS}, + {"phi-unstruct-true.spv.dis", 1, PASS}, + {"phi-unstruct-false.spv.dis", 1, PASS}, + {"cmpxchg-const-const.spv.dis", 1, PASS}, + {"cmpxchg-const-reg.spv.dis", 1, PASS}, + {"cmpxchg-reg-const.spv.dis", 1, PASS}, + {"cmpxchg-reg-reg.spv.dis", 1, PASS}, + {"memory-scopes.spv.dis", 1, PASS}, + {"rmw-extremum-true.spv.dis", 1, PASS}, + {"rmw-extremum-false.spv.dis", 1, FAIL}, + {"push-constants.spv.dis", 1, PASS}, + {"push-constants-pod.spv.dis", 1, PASS}, + {"push-constant-mixed.spv.dis", 1, PASS} + }); + } + + @Test + public void testAllSolvers() throws Exception { + /* TODO: Implementation + try (SolverContext ctx = mkCtx(); ProverEnvironment prover = mkProver(ctx)) { + assertEquals(expected, RefinementSolver.run(ctx, prover, mkTask()).getResult()); + }*/ + try (SolverContext ctx = mkCtx(); ProverEnvironment prover = mkProver(ctx)) { + assertEquals(expected, AssumeSolver.run(ctx, prover, mkTask()).getResult()); + } + } + + private SolverContext mkCtx() throws InvalidConfigurationException { + Configuration cfg = Configuration.builder().build(); + return SolverContextFactory.createSolverContext( + cfg, + BasicLogManager.create(cfg), + ShutdownManager.create().getNotifier(), + SolverContextFactory.Solvers.Z3); + } + + private ProverEnvironment mkProver(SolverContext ctx) { + return ctx.newProverEnvironment(SolverContext.ProverOptions.GENERATE_MODELS); + } + + private VerificationTask mkTask() throws Exception { + VerificationTask.VerificationTaskBuilder builder = VerificationTask.builder() + .withConfig(Configuration.builder().build()) + .withBound(bound) + .withTarget(Arch.VULKAN); + Program program = new ProgramParser().parse(new File(programPath)); + Wmm mcm = new ParserCat().parse(new File(modelPath)); + return builder.build(program, mcm, EnumSet.of(PROGRAM_SPEC)); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/benchmarks/SpirvAssertionsTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/benchmarks/SpirvAssertionsTest.java new file mode 100644 index 0000000000..96acad8bbc --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/benchmarks/SpirvAssertionsTest.java @@ -0,0 +1,147 @@ +package com.dat3m.dartagnan.spirv.benchmarks; + +import com.dat3m.dartagnan.configuration.Arch; +import com.dat3m.dartagnan.parsers.cat.ParserCat; +import com.dat3m.dartagnan.parsers.program.ProgramParser; +import com.dat3m.dartagnan.program.Program; +import com.dat3m.dartagnan.utils.Result; +import com.dat3m.dartagnan.verification.VerificationTask; +import com.dat3m.dartagnan.verification.solving.AssumeSolver; +import com.dat3m.dartagnan.wmm.Wmm; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.sosy_lab.common.ShutdownManager; +import org.sosy_lab.common.configuration.Configuration; +import org.sosy_lab.common.configuration.InvalidConfigurationException; +import org.sosy_lab.common.log.BasicLogManager; +import org.sosy_lab.java_smt.SolverContextFactory; +import org.sosy_lab.java_smt.api.ProverEnvironment; +import org.sosy_lab.java_smt.api.SolverContext; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.EnumSet; + +import static com.dat3m.dartagnan.configuration.Property.PROGRAM_SPEC; +import static com.dat3m.dartagnan.utils.ResourceHelper.getRootPath; +import static com.dat3m.dartagnan.utils.ResourceHelper.getTestResourcePath; +import static com.dat3m.dartagnan.utils.Result.FAIL; +import static com.dat3m.dartagnan.utils.Result.PASS; +import static org.junit.Assert.assertEquals; + +@RunWith(Parameterized.class) +public class SpirvAssertionsTest { + + private final String modelPath = getRootPath("cat/spirv.cat"); + private final String programPath; + private final int bound; + private final Result expected; + + public SpirvAssertionsTest(String file, int bound, Result expected) { + this.programPath = getTestResourcePath("spirv/benchmarks/" + file); + this.bound = bound; + this.expected = expected; + } + + @Parameterized.Parameters(name = "{index}: {0}, {1}, {2}") + public static Iterable data() throws IOException { + return Arrays.asList(new Object[][]{ + {"caslock-1.1.2.spv.dis", 2, PASS}, + {"caslock-2.1.1.spv.dis", 2, PASS}, + {"caslock-acq2rx.spv.dis", 1, FAIL}, + {"caslock-rel2rx.spv.dis", 1, FAIL}, + {"caslock-dv2wg-2.1.1.spv.dis", 2, PASS}, + {"caslock-dv2wg-1.1.2.spv.dis", 1, FAIL}, + {"CORR.spv.dis", 1, PASS}, + {"IRIW.spv.dis", 1, PASS}, + {"MP.spv.dis", 1, PASS}, + {"MP-acq2rx.spv.dis", 1, FAIL}, + {"MP-rel2rx.spv.dis", 1, FAIL}, + {"SB.spv.dis", 1, PASS}, + {"ticketlock-1.1.2.spv.dis", 1, PASS}, + {"ticketlock-2.1.1.spv.dis", 1, PASS}, + {"ticketlock-acq2rx.spv.dis", 1, FAIL}, + {"ticketlock-rel2rx.spv.dis", 1, FAIL}, + {"ticketlock-dv2wg-2.1.1.spv.dis", 2, PASS}, + {"ticketlock-dv2wg-1.1.2.spv.dis", 1, FAIL}, + {"ttaslock-1.1.2.spv.dis", 2, PASS}, + {"ttaslock-2.1.1.spv.dis", 2, PASS}, + {"ttaslock-acq2rx.spv.dis", 1, FAIL}, + {"ttaslock-rel2rx.spv.dis", 1, FAIL}, + {"ttaslock-dv2wg-2.1.1.spv.dis", 2, PASS}, + {"ttaslock-dv2wg-1.1.2.spv.dis", 1, FAIL}, + + {"xf-barrier-2.1.2.spv.dis", 4, PASS}, + // Slow test + // {"xf-barrier-3.1.3.spv.dis", 9, PASS}, + // TODO: IMO should pass (spinloop handling?) + // {"xf-barrier-1.1.2.spv.dis", 2, PASS}, + {"xf-barrier-2.1.1.spv.dis", 2, PASS}, + {"xf-barrier-fail1.spv.dis", 4, FAIL}, + {"xf-barrier-fail2.spv.dis", 4, FAIL}, + {"xf-barrier-fail3.spv.dis", 4, FAIL}, + {"xf-barrier-fail4.spv.dis", 4, FAIL}, + {"xf-barrier-weakest.spv.dis", 4, FAIL}, + + {"xf-barrier-local-2.1.2.spv.dis", 4, FAIL}, + // Slow test + // {"xf-barrier-local-3.1.3.spv.dis", 9, FAIL}, + // TODO: ?? + // {"xf-barrier-local-1.1.2.spv.dis", 2, FAIL}, + {"xf-barrier-local-2.1.1.spv.dis", 2, FAIL}, + {"xf-barrier-local-fail1.spv.dis", 4, FAIL}, + {"xf-barrier-local-fail2.spv.dis", 4, FAIL}, + {"xf-barrier-local-fail3.spv.dis", 4, FAIL}, + {"xf-barrier-local-fail4.spv.dis", 4, FAIL}, + {"xf-barrier-local-weakest.spv.dis", 4, FAIL}, + + {"xf-barrier-zero-2.1.2.spv.dis", 4, FAIL}, + // Slow test + // {"xf-barrier-zero-3.1.3.spv.dis", 9, FAIL}, + // TODO: ?? + // {"xf-barrier-zero-1.1.2.spv.dis", 2, FAIL}, + {"xf-barrier-zero-2.1.1.spv.dis", 2, FAIL}, + {"xf-barrier-zero-fail1.spv.dis", 4, FAIL}, + {"xf-barrier-zero-fail2.spv.dis", 4, FAIL}, + {"xf-barrier-zero-fail3.spv.dis", 4, FAIL}, + {"xf-barrier-zero-fail4.spv.dis", 4, FAIL}, + {"xf-barrier-zero-weakest.spv.dis", 4, FAIL}, + }); + } + + @Test + public void testAllSolvers() throws Exception { + /* TODO: Implementation + try (SolverContext ctx = mkCtx(); ProverEnvironment prover = mkProver(ctx)) { + assertEquals(expected, RefinementSolver.run(ctx, prover, mkTask()).getResult()); + }*/ + try (SolverContext ctx = mkCtx(); ProverEnvironment prover = mkProver(ctx)) { + assertEquals(expected, AssumeSolver.run(ctx, prover, mkTask()).getResult()); + } + } + + private SolverContext mkCtx() throws InvalidConfigurationException { + Configuration cfg = Configuration.builder().build(); + return SolverContextFactory.createSolverContext( + cfg, + BasicLogManager.create(cfg), + ShutdownManager.create().getNotifier(), + SolverContextFactory.Solvers.Z3); + } + + private ProverEnvironment mkProver(SolverContext ctx) { + return ctx.newProverEnvironment(SolverContext.ProverOptions.GENERATE_MODELS); + } + + private VerificationTask mkTask() throws Exception { + VerificationTask.VerificationTaskBuilder builder = VerificationTask.builder() + .withConfig(Configuration.builder().build()) + .withBound(bound) + .withTarget(Arch.VULKAN); + Program program = new ProgramParser().parse(new File(programPath)); + Wmm mcm = new ParserCat().parse(new File(modelPath)); + return builder.build(program, mcm, EnumSet.of(PROGRAM_SPEC)); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/benchmarks/SpirvChecksTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/benchmarks/SpirvChecksTest.java new file mode 100644 index 0000000000..6043e53303 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/benchmarks/SpirvChecksTest.java @@ -0,0 +1,151 @@ +package com.dat3m.dartagnan.spirv.benchmarks; + +import com.dat3m.dartagnan.configuration.Arch; +import com.dat3m.dartagnan.parsers.cat.ParserCat; +import com.dat3m.dartagnan.parsers.program.ProgramParser; +import com.dat3m.dartagnan.program.Program; +import com.dat3m.dartagnan.utils.Result; +import com.dat3m.dartagnan.verification.VerificationTask; +import com.dat3m.dartagnan.verification.solving.AssumeSolver; +import com.dat3m.dartagnan.wmm.Wmm; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.sosy_lab.common.ShutdownManager; +import org.sosy_lab.common.configuration.Configuration; +import org.sosy_lab.common.configuration.InvalidConfigurationException; +import org.sosy_lab.common.log.BasicLogManager; +import org.sosy_lab.java_smt.SolverContextFactory; +import org.sosy_lab.java_smt.api.ProverEnvironment; +import org.sosy_lab.java_smt.api.SolverContext; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.EnumSet; + +import static com.dat3m.dartagnan.configuration.Property.CAT_SPEC; +import static com.dat3m.dartagnan.utils.ResourceHelper.getRootPath; +import static com.dat3m.dartagnan.utils.ResourceHelper.getTestResourcePath; +import static com.dat3m.dartagnan.utils.Result.PASS; +import static com.dat3m.dartagnan.utils.Result.UNKNOWN; +import static org.junit.Assert.assertEquals; + +@RunWith(Parameterized.class) +public class SpirvChecksTest { + + private final String modelPath = getRootPath("cat/spirv-check.cat"); + private final String programPath; + private final int bound; + private final Result expected; + + public SpirvChecksTest(String file, int bound, Result expected) { + this.programPath = getTestResourcePath("spirv/benchmarks/" + file); + this.bound = bound; + this.expected = expected; + } + + @Parameterized.Parameters(name = "{index}: {0}, {1}, {2}") + public static Iterable data() throws IOException { + return Arrays.asList(new Object[][]{ + {"caslock-1.1.2.spv.dis", 2, PASS}, + {"caslock-2.1.1.spv.dis", 2, PASS}, + {"caslock-acq2rx.spv.dis", 1, PASS}, + {"caslock-rel2rx.spv.dis", 1, PASS}, + {"caslock-dv2wg-2.1.1.spv.dis", 2, PASS}, + {"caslock-dv2wg-1.1.2.spv.dis", 1, PASS}, + {"caslock-dv2wg-2.2.1.spv.dis", 2, PASS}, + {"caslock-dv2wg-2.2.2.spv.dis", 1, PASS}, + {"CORR.spv.dis", 1, PASS}, + {"IRIW.spv.dis", 1, PASS}, + {"MP.spv.dis", 1, PASS}, + {"MP-acq2rx.spv.dis", 1, PASS}, + {"MP-rel2rx.spv.dis", 1, PASS}, + {"SB.spv.dis", 1, PASS}, + {"ticketlock-1.1.2.spv.dis", 2, PASS}, + {"ticketlock-2.1.1.spv.dis", 2, PASS}, + {"ticketlock-acq2rx.spv.dis", 1, PASS}, + {"ticketlock-rel2rx.spv.dis", 1, PASS}, + {"ticketlock-dv2wg-2.1.1.spv.dis", 2, PASS}, + {"ticketlock-dv2wg-1.1.2.spv.dis", 1, PASS}, + {"ticketlock-dv2wg-2.2.1.spv.dis", 2, PASS}, + {"ticketlock-dv2wg-2.2.2.spv.dis", 1, PASS}, + // TODO: Why UNKNOWN if concrete result for assertions + {"ttaslock-1.1.2.spv.dis", 2, UNKNOWN}, + {"ttaslock-2.1.1.spv.dis", 2, UNKNOWN}, + {"ttaslock-acq2rx.spv.dis", 2, UNKNOWN}, + {"ttaslock-rel2rx.spv.dis", 2, UNKNOWN}, + {"ttaslock-dv2wg-2.1.1.spv.dis", 2, UNKNOWN}, + {"ttaslock-dv2wg-1.1.2.spv.dis", 2, UNKNOWN}, + {"ttaslock-dv2wg-2.2.1.spv.dis", 2, UNKNOWN}, + {"ttaslock-dv2wg-2.2.2.spv.dis", 2, UNKNOWN}, + + {"xf-barrier-2.1.2.spv.dis", 4, PASS}, + // Slow test + // {"xf-barrier-3.1.3.spv.dis", 9, PASS}, + {"xf-barrier-2.1.1.spv.dis", 2, PASS}, + {"xf-barrier-1.1.2.spv.dis", 2, PASS}, + {"xf-barrier-fail1.spv.dis", 4, PASS}, + {"xf-barrier-fail2.spv.dis", 4, PASS}, + {"xf-barrier-fail3.spv.dis", 4, PASS}, + {"xf-barrier-fail4.spv.dis", 4, PASS}, + {"xf-barrier-weakest.spv.dis", 4, PASS}, + + {"xf-barrier-local-2.1.2.spv.dis", 4, PASS}, + // Slow test + // {"xf-barrier-local-3.1.3.spv.dis", 9, PASS}, + {"xf-barrier-local-2.1.1.spv.dis", 2, PASS}, + {"xf-barrier-local-1.1.2.spv.dis", 2, PASS}, + {"xf-barrier-local-fail1.spv.dis", 4, PASS}, + {"xf-barrier-local-fail2.spv.dis", 4, PASS}, + {"xf-barrier-local-fail3.spv.dis", 4, PASS}, + {"xf-barrier-local-fail4.spv.dis", 4, PASS}, + {"xf-barrier-local-weakest.spv.dis", 4, PASS}, + + // Fails check checkRelIsSem for a barrier with semantics 0x8 (rel_acq, no storage class semantics) + // {"xf-barrier-zero-2.1.2.spv.dis", 4, PASS}, + // {"xf-barrier-zero-3.1.3.spv.dis", 9, PASS}, + // {"xf-barrier-zero-2.1.1.spv.dis", 2, PASS}, + // {"xf-barrier-zero-1.1.2.spv.dis", 2, PASS}, + // {"xf-barrier-zero-fail1.spv.dis", 4, PASS}, + // {"xf-barrier-zero-fail2.spv.dis", 4, PASS}, + // {"xf-barrier-zero-fail3.spv.dis", 4, PASS}, + // {"xf-barrier-zero-fail4.spv.dis", 4, PASS}, + // {"xf-barrier-zero-weakest.spv.dis", 4, PASS}, + }); + } + + @Test + public void testAllSolvers() throws Exception { + /* TODO: Implementation + try (SolverContext ctx = mkCtx(); ProverEnvironment prover = mkProver(ctx)) { + assertEquals(expected, RefinementSolver.run(ctx, prover, mkTask()).getResult()); + }*/ + try (SolverContext ctx = mkCtx(); ProverEnvironment prover = mkProver(ctx)) { + assertEquals(expected, AssumeSolver.run(ctx, prover, mkTask()).getResult()); + } + } + + private SolverContext mkCtx() throws InvalidConfigurationException { + Configuration cfg = Configuration.builder().build(); + return SolverContextFactory.createSolverContext( + cfg, + BasicLogManager.create(cfg), + ShutdownManager.create().getNotifier(), + SolverContextFactory.Solvers.Z3); + } + + private ProverEnvironment mkProver(SolverContext ctx) { + return ctx.newProverEnvironment(SolverContext.ProverOptions.GENERATE_MODELS); + } + + private VerificationTask mkTask() throws Exception { + VerificationTask.VerificationTaskBuilder builder = VerificationTask.builder() + .withConfig(Configuration.builder().build()) + .withBound(bound) + .withTarget(Arch.VULKAN); + Program program = new ProgramParser().parse(new File(programPath)); + Wmm mcm = new ParserCat().parse(new File(modelPath)); + return builder.build(program, mcm, EnumSet.of(CAT_SPEC)); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/benchmarks/SpirvRacesTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/benchmarks/SpirvRacesTest.java new file mode 100644 index 0000000000..5f4ac94440 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/benchmarks/SpirvRacesTest.java @@ -0,0 +1,152 @@ +package com.dat3m.dartagnan.spirv.benchmarks; + +import com.dat3m.dartagnan.configuration.Arch; +import com.dat3m.dartagnan.parsers.cat.ParserCat; +import com.dat3m.dartagnan.parsers.program.ProgramParser; +import com.dat3m.dartagnan.program.Program; +import com.dat3m.dartagnan.utils.Result; +import com.dat3m.dartagnan.verification.VerificationTask; +import com.dat3m.dartagnan.verification.solving.AssumeSolver; +import com.dat3m.dartagnan.wmm.Wmm; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.sosy_lab.common.ShutdownManager; +import org.sosy_lab.common.configuration.Configuration; +import org.sosy_lab.common.configuration.InvalidConfigurationException; +import org.sosy_lab.common.log.BasicLogManager; +import org.sosy_lab.java_smt.SolverContextFactory; +import org.sosy_lab.java_smt.api.ProverEnvironment; +import org.sosy_lab.java_smt.api.SolverContext; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.EnumSet; + +import static com.dat3m.dartagnan.configuration.Property.CAT_SPEC; +import static com.dat3m.dartagnan.utils.ResourceHelper.getRootPath; +import static com.dat3m.dartagnan.utils.ResourceHelper.getTestResourcePath; +import static com.dat3m.dartagnan.utils.Result.FAIL; +import static com.dat3m.dartagnan.utils.Result.PASS; +import static org.junit.Assert.assertEquals; + +@RunWith(Parameterized.class) +public class SpirvRacesTest { + + private final String modelPath = getRootPath("cat/spirv.cat"); + private final String programPath; + private final int bound; + private final Result expected; + + public SpirvRacesTest(String file, int bound, Result expected) { + this.programPath = getTestResourcePath("spirv/benchmarks/" + file); + this.bound = bound; + this.expected = expected; + } + + @Parameterized.Parameters(name = "{index}: {0}, {1}, {2}") + public static Iterable data() throws IOException { + return Arrays.asList(new Object[][]{ + {"caslock-1.1.2.spv.dis", 2, PASS}, + {"caslock-2.1.1.spv.dis", 2, PASS}, + {"caslock-acq2rx.spv.dis", 1, FAIL}, + {"caslock-rel2rx.spv.dis", 1, FAIL}, + {"caslock-dv2wg-2.1.1.spv.dis", 2, PASS}, + {"caslock-dv2wg-1.1.2.spv.dis", 1, FAIL}, + {"caslock-dv2wg-2.2.1.spv.dis", 2, PASS}, + {"caslock-dv2wg-2.2.2.spv.dis", 1, FAIL}, + {"CORR.spv.dis", 1, PASS}, + {"IRIW.spv.dis", 1, PASS}, + {"MP.spv.dis", 1, FAIL}, + {"MP-acq2rx.spv.dis", 1, FAIL}, + {"MP-rel2rx.spv.dis", 1, FAIL}, + {"SB.spv.dis", 1, PASS}, + {"ticketlock-1.1.2.spv.dis", 2, PASS}, + {"ticketlock-2.1.1.spv.dis", 2, PASS}, + {"ticketlock-acq2rx.spv.dis", 1, FAIL}, + {"ticketlock-rel2rx.spv.dis", 1, FAIL}, + {"ticketlock-dv2wg-2.1.1.spv.dis", 2, PASS}, + {"ticketlock-dv2wg-1.1.2.spv.dis", 1, FAIL}, + {"ticketlock-dv2wg-2.2.1.spv.dis", 2, PASS}, + {"ticketlock-dv2wg-2.2.2.spv.dis", 1, FAIL}, + {"ttaslock-1.1.2.spv.dis", 2, PASS}, + {"ttaslock-2.1.1.spv.dis", 2, PASS}, + {"ttaslock-acq2rx.spv.dis", 1, FAIL}, + {"ttaslock-rel2rx.spv.dis", 1, FAIL}, + {"ttaslock-dv2wg-2.1.1.spv.dis", 2, PASS}, + {"ttaslock-dv2wg-1.1.2.spv.dis", 1, FAIL}, + {"ttaslock-dv2wg-2.2.1.spv.dis", 4, PASS}, + {"ttaslock-dv2wg-2.2.2.spv.dis", 1, FAIL}, + + {"xf-barrier-2.1.2.spv.dis", 4, PASS}, + // Slow test + // {"xf-barrier-3.1.3.spv.dis", 9, PASS}, + {"xf-barrier-2.1.1.spv.dis", 2, PASS}, + {"xf-barrier-1.1.2.spv.dis", 2, PASS}, + {"xf-barrier-fail1.spv.dis", 4, FAIL}, + {"xf-barrier-fail2.spv.dis", 4, FAIL}, + {"xf-barrier-fail3.spv.dis", 4, FAIL}, + {"xf-barrier-fail4.spv.dis", 4, FAIL}, + {"xf-barrier-weakest.spv.dis", 4, FAIL}, + + {"xf-barrier-local-2.1.2.spv.dis", 4, FAIL}, + // Slow test + // {"xf-barrier-local-3.1.3.spv.dis", 9, FAIL}, + {"xf-barrier-local-2.1.1.spv.dis", 2, FAIL}, + // one thread in workgroup, barrier semantics doesn't matter + {"xf-barrier-local-1.1.2.spv.dis", 2, PASS}, + {"xf-barrier-local-fail1.spv.dis", 4, FAIL}, + {"xf-barrier-local-fail2.spv.dis", 4, FAIL}, + {"xf-barrier-local-fail3.spv.dis", 4, FAIL}, + {"xf-barrier-local-fail4.spv.dis", 4, FAIL}, + {"xf-barrier-local-weakest.spv.dis", 4, FAIL}, + + {"xf-barrier-zero-2.1.2.spv.dis", 4, FAIL}, + // Slow test + // {"xf-barrier-zero-3.1.3.spv.dis", 9, FAIL}, + {"xf-barrier-zero-2.1.1.spv.dis", 2, FAIL}, + // one thread in workgroup, barrier semantics doesn't matter + {"xf-barrier-zero-1.1.2.spv.dis", 2, PASS}, + {"xf-barrier-zero-fail1.spv.dis", 4, FAIL}, + {"xf-barrier-zero-fail2.spv.dis", 4, FAIL}, + {"xf-barrier-zero-fail3.spv.dis", 4, FAIL}, + {"xf-barrier-zero-fail4.spv.dis", 4, FAIL}, + {"xf-barrier-zero-weakest.spv.dis", 4, FAIL}, + }); + } + + @Test + public void testAllSolvers() throws Exception { + /* TODO: Implementation + try (SolverContext ctx = mkCtx(); ProverEnvironment prover = mkProver(ctx)) { + assertEquals(expected, RefinementSolver.run(ctx, prover, mkTask()).getResult()); + }*/ + try (SolverContext ctx = mkCtx(); ProverEnvironment prover = mkProver(ctx)) { + assertEquals(expected, AssumeSolver.run(ctx, prover, mkTask()).getResult()); + } + } + + private SolverContext mkCtx() throws InvalidConfigurationException { + Configuration cfg = Configuration.builder().build(); + return SolverContextFactory.createSolverContext( + cfg, + BasicLogManager.create(cfg), + ShutdownManager.create().getNotifier(), + SolverContextFactory.Solvers.Z3); + } + + private ProverEnvironment mkProver(SolverContext ctx) { + return ctx.newProverEnvironment(SolverContext.ProverOptions.GENERATE_MODELS); + } + + private VerificationTask mkTask() throws Exception { + VerificationTask.VerificationTaskBuilder builder = VerificationTask.builder() + .withConfig(Configuration.builder().build()) + .withBound(bound) + .withTarget(Arch.VULKAN); + Program program = new ProgramParser().parse(new File(programPath)); + Wmm mcm = new ParserCat().parse(new File(modelPath)); + return builder.build(program, mcm, EnumSet.of(CAT_SPEC)); + } +} \ No newline at end of file diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/gpuverify/SpirvChecksTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/gpuverify/SpirvChecksTest.java new file mode 100644 index 0000000000..6124efb5b0 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/gpuverify/SpirvChecksTest.java @@ -0,0 +1,379 @@ +package com.dat3m.dartagnan.spirv.gpuverify; + +import com.dat3m.dartagnan.configuration.Arch; +import com.dat3m.dartagnan.parsers.cat.ParserCat; +import com.dat3m.dartagnan.parsers.program.ProgramParser; +import com.dat3m.dartagnan.program.Program; +import com.dat3m.dartagnan.utils.Result; +import com.dat3m.dartagnan.verification.VerificationTask; +import com.dat3m.dartagnan.verification.solving.AssumeSolver; +import com.dat3m.dartagnan.wmm.Wmm; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.sosy_lab.common.ShutdownManager; +import org.sosy_lab.common.configuration.Configuration; +import org.sosy_lab.common.configuration.InvalidConfigurationException; +import org.sosy_lab.common.log.BasicLogManager; +import org.sosy_lab.java_smt.SolverContextFactory; +import org.sosy_lab.java_smt.api.ProverEnvironment; +import org.sosy_lab.java_smt.api.SolverContext; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.EnumSet; + +import static com.dat3m.dartagnan.configuration.Property.CAT_SPEC; +import static com.dat3m.dartagnan.utils.ResourceHelper.getRootPath; +import static com.dat3m.dartagnan.utils.ResourceHelper.getTestResourcePath; +import static com.dat3m.dartagnan.utils.Result.PASS; +import static com.dat3m.dartagnan.utils.Result.UNKNOWN; +import static org.junit.Assert.assertEquals; + +@RunWith(Parameterized.class) +public class SpirvChecksTest { + + private final String modelPath = getRootPath("cat/spirv-check.cat"); + private final String programPath; + private final int bound; + private final Result expected; + + public SpirvChecksTest(String file, int bound, Result expected) { + this.programPath = getTestResourcePath("spirv/gpuverify/" + file); + this.bound = bound; + this.expected = expected; + } + + @Parameterized.Parameters(name = "{index}: {0}, {1}, {2}") + public static Iterable data() throws IOException { + return Arrays.asList(new Object[][]{ + {"atomics/atomic_read_race.spv.dis", 1, PASS}, + {"atomics/equality_fail.spv.dis", 1, PASS}, + {"atomics/forloop.spv.dis", 2, UNKNOWN}, + {"atomics/histo.spv.dis", 1, PASS}, + {"barrier_intervals/test1.spv.dis", 1, PASS}, + {"basicbarrier.spv.dis", 1, PASS}, + {"basicglobalarray.spv.dis", 1, PASS}, + {"benign_race_tests/fail/writeafterread_addition.spv.dis", 1, PASS}, + {"benign_race_tests/fail/writeafterread_otherval.spv.dis", 1, PASS}, + {"benign_race_tests/fail/writezero_nobenign.spv.dis", 1, PASS}, + {"benign_race_tests/pass/writezero.spv.dis", 1, PASS}, + {"checkarrays/pass/specifyall.spv.dis", 1, PASS}, + {"divergence/race_and_divergence.spv.dis", 1, PASS}, + {"divergence/race_no_divergence.spv.dis", 1, PASS}, + {"inter_group_and_barrier_flag_tests/fail/local_id.spv.dis", 1, PASS}, + {"inter_group_and_barrier_flag_tests/fail/missing_local_barrier_flag.spv.dis", 1, PASS}, + + // Fails check checkRelIsSem for a barrier with semantics 0x8 (rel_acq, no storage class semantics) + // {"inter_group_and_barrier_flag_tests/fail/no_barrier_flags.spv.dis", 1, PASS}, + + {"inter_group_and_barrier_flag_tests/fail/sync.spv.dis", 1, PASS}, + {"inter_group_and_barrier_flag_tests/pass/local_barrier_flag.spv.dis", 1, PASS}, + {"inter_group_and_barrier_flag_tests/pass/local_id_benign_write_write.spv.dis", 1, PASS}, + {"inter_group_and_barrier_flag_tests/pass/pass_due_to_intra_group_flag.spv.dis", 1, PASS}, + {"localarrayaccess.spv.dis", 1, PASS}, + + // Fails check checkRelIsSem for a barrier with semantics 0x8 (rel_acq, no storage class semantics) + // {"mem_fence.spv.dis", 1, PASS}, + + {"misc/fail/miscfail1.spv.dis", 1, PASS}, + {"misc/fail/miscfail3.spv.dis", 1, PASS}, + {"misc/fail/struct_member_race.spv.dis", 1, PASS}, + {"misc/pass/misc13.spv.dis", 1, PASS}, + {"misc/pass/misc2.spv.dis", 1, PASS}, + {"multidimarrays/test5.spv.dis", 1, PASS}, + {"no_log/pass.spv.dis", 1, PASS}, + {"null_pointers/null_pointer_assignment_equal.spv.dis", 1, PASS}, + {"null_pointers/null_pointer_assignment_unequal.spv.dis", 1, PASS}, + {"null_pointers/null_pointer_greater.spv.dis", 1, PASS}, + {"pointertests/test_return_pointer.spv.dis", 1, PASS}, + {"report_global_id/test1.spv.dis", 1, PASS}, + {"report_global_id/test2.spv.dis", 1, PASS}, + {"sourcelocation_tests/barrier_divergence/pass.spv.dis", 1, PASS}, + {"sourcelocation_tests/needs_source_location_ensures.spv.dis", 1, PASS}, + {"sourcelocation_tests/needs_source_location_requires.spv.dis", 1, PASS}, + {"sourcelocation_tests/race_with_loop.spv.dis", 2, UNKNOWN}, + {"sourcelocation_tests/races/fail/read_write.spv.dis", 1, PASS}, + {"sourcelocation_tests/races/fail/write_read.spv.dis", 1, PASS}, + {"sourcelocation_tests/races/fail/write_write/loop.spv.dis", 2, UNKNOWN}, + {"sourcelocation_tests/races/fail/write_write/normal.spv.dis", 1, PASS}, + {"sourcelocation_tests/races/pass/no_race.spv.dis", 1, PASS}, + {"sourcelocation_tests/races/pass/read_read.spv.dis", 1, PASS}, + {"test_2d_global_index_inference.spv.dis", 2, UNKNOWN}, + {"test_2d_local_index_inference_2.spv.dis", 1, PASS}, + {"test_for_benign_read_write_bug.spv.dis", 1, PASS}, + {"test_local_id_inference.spv.dis", 1, PASS}, + {"test_mod_invariants/global_reduce_strength.spv.dis", 2, UNKNOWN}, + {"test_mod_invariants/local_direct.spv.dis", 2, UNKNOWN}, + {"test_part_load_store/store_int_and_short.spv.dis", 1, PASS}, + {"test_structs/use_array_element.spv.dis", 1, PASS}, + {"test_structs/use_element.spv.dis", 1, PASS}, + {"test_structs/use_struct_element.spv.dis", 1, PASS}, + + {"saturate/sadd.spv.dis", 1, PASS}, + {"saturate/ssub.spv.dis", 1, PASS}, + + {"atomics/refined_atomic_abstraction/bad_local_counters.spv.dis", 1, PASS}, + {"atomics/refined_atomic_abstraction/intra_local_counters.spv.dis", 1, PASS}, + + {"atomics/counter.spv.dis", 1, PASS}, + + {"barrier_intervals/test2.spv.dis", 1, PASS}, + {"sourcelocation_tests/barrier_divergence/fail.spv.dis", 1, PASS}, + + {"global_size/local_size_fail_divide_global_size.spv.dis", 1, PASS}, + {"global_size/mismatch_dims.spv.dis", 1, PASS}, + {"global_size/num_groups_and_global_size.spv.dis", 1, PASS}, + + // Unsupported large array (4K elements) leading to OOM + // {"misc/fail/2d_array_race.spv.dis", 1, PASS}, + + // Unsupported null as a pointer + // {"null_pointers/atomic_null.spv.dis", 1, PASS}, + + // Unsupported cuda warps + // {"warpsync/intragroup_scan.spv.dis", 1, PASS}, + // {"warpsync/scan_warp.spv.dis", 1, PASS}, + + // Unsupported barriers in a loop + // {"barrier_intervals/test3.spv.dis", 1, PASS}, + // {"barrier_intervals/test4.spv.dis", 1, PASS}, + // {"misc/pass/misc12.spv.dis", 1, PASS}, + // {"skeletonbinomialoptions.spv.dis", 1, PASS}, + + // Unsupported non-constant tags + // {"inter_group_and_barrier_flag_tests/fail/bad_read_then_write.spv.dis", 1, PASS}, + // {"inter_group_and_barrier_flag_tests/fail/bad_write_then_read.spv.dis", 1, PASS}, + // {"inter_group_and_barrier_flag_tests/pass/read_then_write.spv.dis", 1, PASS}, + // {"inter_group_and_barrier_flag_tests/pass/write_then_read.spv.dis", 1, PASS}, + + // Unsupported vector registers + // {"annotation_tests/test_axiom.spv.dis", 1, PASS}, + // {"async_work_group_copy/fail/test13.spv.dis", 1, PASS}, + // {"async_work_group_copy/fail/test7.spv.dis", 1, PASS}, + // {"async_work_group_copy/fail/test8.spv.dis", 1, PASS}, + // {"async_work_group_copy/fail/test9.spv.dis", 1, PASS}, + // {"induction_variable.spv.dis", 1, PASS}, + // {"inter_group_and_barrier_flag_tests/fail/missing_global_barrier_flag.spv.dis", 1, PASS}, + // {"inter_group_and_barrier_flag_tests/fail/sync_within_group_wrong_flag.spv.dis", 1, PASS}, + // {"inter_group_and_barrier_flag_tests/pass/global_barrier.spv.dis", 1, PASS}, + // {"inter_group_and_barrier_flag_tests/pass/sync_within_group.spv.dis", 1, PASS}, + // {"k-induction/amazingreduction.spv.dis", 1, PASS}, + // {"reducedstrength_generalised.spv.dis", 1, PASS}, + // {"test_2d_local_index_inference.spv.dis", 1, PASS}, + // {"test_global_id_inference.spv.dis", 1, PASS}, + // {"test_line_number_problem.spv.dis", 1, PASS}, + // {"test_mod_invariants/local_reduce_strength.spv.dis", 1, PASS}, + + // Unsupported control flow + // {"test_for_ssa_bug.spv.dis", 1, PASS}, + // {"transitiveclosuresimplified.spv.dis", 1, PASS}, + + // Unsupported spir-v ops + // {"alignment/int3int4.spv.dis", 1, PASS}, + // {"alignment/race_location.spv.dis", 1, PASS}, + // {"async_work_group_copy/fail/test1.spv.dis", 1, PASS}, + // {"async_work_group_copy/fail/test10.spv.dis", 1, PASS}, + // {"async_work_group_copy/fail/test14.spv.dis", 1, PASS}, + // {"async_work_group_copy/fail/test15.spv.dis", 1, PASS}, + // {"async_work_group_copy/fail/test16.spv.dis", 1, PASS}, + // {"async_work_group_copy/fail/test17.spv.dis", 1, PASS}, + // {"async_work_group_copy/fail/test18.spv.dis", 1, PASS}, + // {"async_work_group_copy/fail/test2.spv.dis", 1, PASS}, + // {"async_work_group_copy/fail/test4.spv.dis", 1, PASS}, + // {"async_work_group_copy/fail/test5.spv.dis", 1, PASS}, + // {"async_work_group_copy/pass/test1.spv.dis", 1, PASS}, + // {"async_work_group_copy/pass/test2.spv.dis", 1, PASS}, + // {"async_work_group_copy/pass/test3.spv.dis", 1, PASS}, + // {"async_work_group_copy/pass/test4.spv.dis", 1, PASS}, + // {"async_work_group_copy/pass/test5.spv.dis", 1, PASS}, + // {"async_work_group_copy/pass/test6.spv.dis", 1, PASS}, + // {"async_work_group_copy/pass/test7.spv.dis", 1, PASS}, + // {"async_work_group_copy/pass/test8.spv.dis", 1, PASS}, + // {"async_work_group_copy/pass/test9.spv.dis", 1, PASS}, + // {"atomics/definitions_atom_int.spv.dis", 1, PASS}, + // {"atomics/definitions_float.spv.dis", 1, PASS}, + // {"atomics/definitions_int.spv.dis", 1, PASS}, + // {"atomics/definitions_long.spv.dis", 1, PASS}, + // {"atomics/displaced.spv.dis", 1, PASS}, + // {"atomics/mismatched_types/int_add_with_float.spv.dis", 1, PASS}, + // {"atomics/mismatched_types/int_add_with_long.spv.dis", 1, PASS}, + // {"atomics/mismatched_types/int_add_with_short.spv.dis", 1, PASS}, + // {"atomics/pointers.spv.dis", 1, PASS}, + // {"atomics/refined_atomic_abstraction/many_accesses.spv.dis", 1, PASS}, + // {"atomics/refined_atomic_abstraction/one_access.spv.dis", 1, PASS}, + // {"atomics/refined_atomic_abstraction/predication.spv.dis", 1, PASS}, + // {"barrierconditionalkernelparam.spv.dis", 1, PASS}, + // {"benign_race_tests/fail/writetiddiv64_offbyone.spv.dis", 1, PASS}, + // {"benign_race_tests/fail/writewritearray_adversarial.spv.dis", 1, PASS}, + // {"benign_race_tests/pass/writeinloop.spv.dis", 1, PASS}, + // {"ceil.spv.dis", 1, PASS}, + // {"constantnotparam.spv.dis", 1, PASS}, + // {"derivedfrombinomialoptions.spv.dis", 1, PASS}, + // {"floatcastrequired.spv.dis", 1, PASS}, + // {"get_global_id.spv.dis", 1, PASS}, + // {"globalarray/fail.spv.dis", 1, PASS}, + // {"globalarray/pass.spv.dis", 1, PASS}, + // {"imagetests/fail2dimagecopy.spv.dis", 1, PASS}, + // {"imagetests/test2dimagecopy.spv.dis", 1, PASS}, + // {"imagetests/testsampler.spv.dis", 1, PASS}, + // {"imagetests/testsampler2.spv.dis", 1, PASS}, + // {"misc/fail/4d_array_of_vectors_race.spv.dis", 1, PASS}, + // {"misc/fail/miscfail9.spv.dis", 1, PASS}, + // {"misc/fail/vector_element_race.spv.dis", 1, PASS}, + // {"misc/pass/misc15.spv.dis", 1, PASS}, + // {"misc/pass/misc16.spv.dis", 1, PASS}, + // {"misc/pass/misc7.spv.dis", 1, PASS}, + // {"misc/pass/misc8.spv.dis", 1, PASS}, + // {"noraceduetoreturn.spv.dis", 1, PASS}, + // {"null_pointers/store_to_null_and_non_null.spv.dis", 1, PASS}, + // {"pointeranalysistests/manyprocedures.spv.dis", 1, PASS}, + // {"pointeranalysistests/manyproceduresinlined.spv.dis", 1, PASS}, + // {"pointeranalysistests/testbasicaliasing.spv.dis", 1, PASS}, + // {"pointeranalysistests/testbasicaliasing2.spv.dis", 1, PASS}, + // {"pointeranalysistests/testbasicpointerarithmetic.spv.dis", 1, PASS}, + // {"pointeranalysistests/testbasicpointerarithmetic2.spv.dis", 1, PASS}, + // {"pointeranalysistests/testinterprocedural.spv.dis", 1, PASS}, + // {"pointertests/test_copy_between_memory_spaces2.spv.dis", 1, PASS}, + // {"pow2/64bit_loopcounter.spv.dis", 1, PASS}, + // {"pow2/64bit_relational.spv.dis", 1, PASS}, + // {"saturate/uadd.spv.dis", 1, PASS}, + // {"saturate/usub.spv.dis", 1, PASS}, + // {"shuffle/shuffle.spv.dis", 1, PASS}, + // {"simplebinomialoptions.spv.dis", 1, PASS}, + // {"sourcelocation_tests/races/fail/write_write/elem_width_16.spv.dis", 1, PASS}, + // {"ternarytest.spv.dis", 1, PASS}, + // {"ternarytest2.spv.dis", 1, PASS}, + // {"test_for_get_group_id.spv.dis", 1, PASS}, + // {"vectortests/float4arrayaccess.spv.dis", 1, PASS}, + // {"vectortests/int3arrayaccess.spv.dis", 1, PASS}, + // {"vectortests/test_paren.spv.dis", 1, PASS}, + // {"warpsync/2d.spv.dis", 1, PASS}, + // {"warpsync/broken_shuffle.spv.dis", 1, PASS}, + // {"warpsync/shuffle.spv.dis", 1, PASS}, + + // Compiler eliminated reads of unused value + // {"misc/fail/miscfail8.spv.dis", 1, PASS}, + // {"pointertests/test_copy_between_memory_spaces.spv.dis", 1, PASS}, + // {"sourcelocation_tests/race_from_call.spv.dis", 1, PASS}, + // {"sourcelocation_tests/race_from_call_in_loop.spv.dis", 1, PASS}, + // {"sourcelocation_tests/races_from_indirect_calls.spv.dis", 1, PASS}, + + // Compiler eliminated the whole main function + // {"addressofinit.spv.dis", 1, PASS}, + // {"array_bounds_tests/array_in_array.spv.dis", 1, PASS}, + // {"array_bounds_tests/array_in_array_2.spv.dis", 1, PASS}, + // {"array_bounds_tests/array_in_array_param.spv.dis", 1, PASS}, + // {"array_bounds_tests/multi_dim_array.spv.dis", 1, PASS}, + // {"array_bounds_tests/multi_dim_array_fail_upper.spv.dis", 1, PASS}, + // {"array_bounds_tests/negative_index_multi_dim.spv.dis", 1, PASS}, + // {"array_bounds_tests/negative_index_multi_dim_fail.spv.dis", 1, PASS}, + // {"array_bounds_tests/private_array.spv.dis", 1, PASS}, + // {"array_bounds_tests/realign_simple.spv.dis", 1, PASS}, + // {"array_bounds_tests/realign_simple_fail.spv.dis", 1, PASS}, + // {"array_bounds_tests/simple_array.spv.dis", 1, PASS}, + // {"array_bounds_tests/simple_array_fail_lower.spv.dis", 1, PASS}, + // {"array_bounds_tests/simple_array_fail_upper.spv.dis", 1, PASS}, + // {"array_bounds_tests/simple_array_fail_var.spv.dis", 1, PASS}, + // {"basic1.spv.dis", 1, PASS}, + // {"benign_race_tests/pass/writeafterread.spv.dis", 1, PASS}, + // {"bitand.spv.dis", 1, PASS}, + // {"bitnot.spv.dis", 1, PASS}, + // {"bitor.spv.dis", 1, PASS}, + // {"bitxor.spv.dis", 1, PASS}, + // {"bool_bv_test.spv.dis", 1, PASS}, + // {"casttofloat.spv.dis", 1, PASS}, + // {"checkarrays/fail/arraydoesnotexist1.spv.dis", 1, PASS}, + // {"checkarrays/fail/arraydoesnotexist2.spv.dis", 1, PASS}, + // {"conditional_int_test.spv.dis", 1, PASS}, + // {"derived_from_uniformity_analysis_bug.spv.dis", 1, PASS}, + // {"derivedfrombinomialoptions2.spv.dis", 1, PASS}, + // {"fail_equality_and_adversarial.spv.dis", 1, PASS}, + // {"float_constant_test2.spv.dis", 1, PASS}, + // {"floatrelationalop.spv.dis", 1, PASS}, + // {"leftshiftequals.spv.dis", 1, PASS}, + // {"localmultidimarraydecl.spv.dis", 1, PASS}, + // {"misc/fail/4d_array_of_structs_race.spv.dis", 1, PASS}, + // {"misc/fail/4d_array_race.spv.dis", 1, PASS}, + // {"misc/fail/4d_array_with_casting.spv.dis", 1, PASS}, + // {"misc/fail/miscfail10.spv.dis", 1, PASS}, + // {"misc/pass/misc3.spv.dis", 1, PASS}, + // {"misc/pass/misc4.spv.dis", 1, PASS}, + // {"modifyparam.spv.dis", 1, PASS}, + // {"multidimarrays/test1.spv.dis", 1, PASS}, + // {"multidimarrays/test2.spv.dis", 1, PASS}, + // {"multidimarrays/test3.spv.dis", 1, PASS}, + // {"multidimarrays/test4.spv.dis", 1, PASS}, + // {"multiplelocals.spv.dis", 1, PASS}, + // {"multiplelocals2.spv.dis", 1, PASS}, + // {"notunaryoptest.spv.dis", 1, PASS}, + // {"null_pointers/load_from_null.spv.dis", 1, PASS}, + // {"null_statement.spv.dis", 1, PASS}, + // {"pointertests/param_addressof.spv.dis", 1, PASS}, + // {"pointertests/pointerarith.spv.dis", 1, PASS}, + // {"pointertests/test_derived_from_binomial_opts.spv.dis", 1, PASS}, + // {"pointertests/test_opencl_local_array.spv.dis", 1, PASS}, + // {"pointertests/test_opencl_local_param.spv.dis", 1, PASS}, + // {"pointertests/test_pass_value_from_array.spv.dis", 1, PASS}, + // {"predicated_undef.spv.dis", 1, PASS}, + // {"reducedstrengthnonloopbug.spv.dis", 1, PASS}, + // {"return_tests/id_dependent_return.spv.dis", 1, PASS}, + // {"return_tests/multiloop_return.spv.dis", 1, PASS}, + // {"return_tests/multiloop_return_simplified.spv.dis", 1, PASS}, + // {"return_tests/simple_return.spv.dis", 1, PASS}, + // {"rightshiftequals.spv.dis", 1, PASS}, + // {"shared_int.spv.dis", 1, PASS}, + // {"simpleparampassing.spv.dis", 1, PASS}, + // {"simpleprocedurecall.spv.dis", 1, PASS}, + // {"simplereturn.spv.dis", 1, PASS}, + // {"test_address_of_bug.spv.dis", 1, PASS}, + // {"test_float_neq.spv.dis", 1, PASS}, + // {"test_structs/store_array_element.spv.dis", 1, PASS}, + // {"test_structs/store_element.spv.dis", 1, PASS}, + // {"test_structs/store_struct_element.spv.dis", 1, PASS}, + // {"unusedreturn.spv.dis", 1, PASS}, + // {"vectortests/addressofvector.spv.dis", 1, PASS}, + // {"vectortests/double2simpleaccess.spv.dis", 1, PASS}, + // {"vectortests/double4simpleaccess.spv.dis", 1, PASS}, + // {"vectortests/float2simpleaccess.spv.dis", 1, PASS}, + // {"vectortests/float4simpleaccess.spv.dis", 1, PASS}, + // {"vectortests/vectorsplat.spv.dis", 1, PASS}, + // {"vectortests/vectorswizzle.spv.dis", 1, PASS}, + }); + } + + @Test + public void testAllSolvers() throws Exception { + /* TODO: Implementation + try (SolverContext ctx = mkCtx(); ProverEnvironment prover = mkProver(ctx)) { + assertEquals(expected, RefinementSolver.run(ctx, prover, mkTask()).getResult()); + }*/ + try (SolverContext ctx = mkCtx(); ProverEnvironment prover = mkProver(ctx)) { + assertEquals(expected, AssumeSolver.run(ctx, prover, mkTask()).getResult()); + } + } + + private SolverContext mkCtx() throws InvalidConfigurationException { + Configuration cfg = Configuration.builder().build(); + return SolverContextFactory.createSolverContext( + cfg, + BasicLogManager.create(cfg), + ShutdownManager.create().getNotifier(), + SolverContextFactory.Solvers.Z3); + } + + private ProverEnvironment mkProver(SolverContext ctx) { + return ctx.newProverEnvironment(SolverContext.ProverOptions.GENERATE_MODELS); + } + + private VerificationTask mkTask() throws Exception { + VerificationTask.VerificationTaskBuilder builder = VerificationTask.builder() + .withConfig(Configuration.builder().build()) + .withBound(bound) + .withTarget(Arch.VULKAN); + Program program = new ProgramParser().parse(new File(programPath)); + Wmm mcm = new ParserCat().parse(new File(modelPath)); + return builder.build(program, mcm, EnumSet.of(CAT_SPEC)); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/gpuverify/SpirvRacesTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/gpuverify/SpirvRacesTest.java new file mode 100644 index 0000000000..29b7ad7990 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/gpuverify/SpirvRacesTest.java @@ -0,0 +1,379 @@ +package com.dat3m.dartagnan.spirv.gpuverify; + +import com.dat3m.dartagnan.configuration.Arch; +import com.dat3m.dartagnan.parsers.cat.ParserCat; +import com.dat3m.dartagnan.parsers.program.ProgramParser; +import com.dat3m.dartagnan.program.Program; +import com.dat3m.dartagnan.utils.Result; +import com.dat3m.dartagnan.verification.VerificationTask; +import com.dat3m.dartagnan.verification.solving.AssumeSolver; +import com.dat3m.dartagnan.wmm.Wmm; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.sosy_lab.common.ShutdownManager; +import org.sosy_lab.common.configuration.Configuration; +import org.sosy_lab.common.configuration.InvalidConfigurationException; +import org.sosy_lab.common.log.BasicLogManager; +import org.sosy_lab.java_smt.SolverContextFactory; +import org.sosy_lab.java_smt.api.ProverEnvironment; +import org.sosy_lab.java_smt.api.SolverContext; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.EnumSet; + +import static com.dat3m.dartagnan.configuration.Property.CAT_SPEC; +import static com.dat3m.dartagnan.utils.ResourceHelper.getRootPath; +import static com.dat3m.dartagnan.utils.ResourceHelper.getTestResourcePath; +import static com.dat3m.dartagnan.utils.Result.*; +import static org.junit.Assert.assertEquals; + +@RunWith(Parameterized.class) +public class SpirvRacesTest { + + private final String modelPath = getRootPath("cat/spirv.cat"); + private final String programPath; + private final int bound; + private final Result expected; + + public SpirvRacesTest(String file, int bound, Result expected) { + this.programPath = getTestResourcePath("spirv/gpuverify/" + file); + this.bound = bound; + this.expected = expected; + } + + @Parameterized.Parameters(name = "{index}: {0}, {1}, {2}") + public static Iterable data() throws IOException { + return Arrays.asList(new Object[][]{ + // Agree with gpu-verify + {"atomics/atomic_read_race.spv.dis", 1, FAIL}, + {"atomics/equality_fail.spv.dis", 1, PASS}, + {"atomics/forloop.spv.dis", 1, FAIL}, + {"atomics/histo.spv.dis", 1, PASS}, + {"barrier_intervals/test1.spv.dis", 1, PASS}, + {"basicbarrier.spv.dis", 1, PASS}, + {"basicglobalarray.spv.dis", 1, PASS}, + {"benign_race_tests/fail/writeafterread_addition.spv.dis", 1, FAIL}, + {"benign_race_tests/fail/writeafterread_otherval.spv.dis", 1, FAIL}, + {"benign_race_tests/fail/writezero_nobenign.spv.dis", 1, FAIL}, + {"benign_race_tests/pass/writezero.spv.dis", 1, FAIL}, + {"checkarrays/pass/specifyall.spv.dis", 1, PASS}, + {"divergence/race_and_divergence.spv.dis", 1, FAIL}, + {"divergence/race_no_divergence.spv.dis", 1, FAIL}, + {"inter_group_and_barrier_flag_tests/fail/local_id.spv.dis", 1, FAIL}, + {"inter_group_and_barrier_flag_tests/fail/missing_local_barrier_flag.spv.dis", 1, FAIL}, + {"inter_group_and_barrier_flag_tests/fail/no_barrier_flags.spv.dis", 1, FAIL}, + {"inter_group_and_barrier_flag_tests/fail/sync.spv.dis", 1, FAIL}, + {"inter_group_and_barrier_flag_tests/pass/local_barrier_flag.spv.dis", 1, PASS}, + {"inter_group_and_barrier_flag_tests/pass/local_id_benign_write_write.spv.dis", 1, FAIL}, + {"inter_group_and_barrier_flag_tests/pass/pass_due_to_intra_group_flag.spv.dis", 1, FAIL}, + {"localarrayaccess.spv.dis", 1, PASS}, + {"mem_fence.spv.dis", 1, PASS}, + {"misc/fail/miscfail1.spv.dis", 1, FAIL}, + {"misc/fail/miscfail3.spv.dis", 1, FAIL}, + {"misc/fail/struct_member_race.spv.dis", 1, FAIL}, + {"misc/pass/misc13.spv.dis", 1, PASS}, + {"misc/pass/misc2.spv.dis", 1, PASS}, + {"multidimarrays/test5.spv.dis", 1, FAIL}, + {"no_log/pass.spv.dis", 1, FAIL}, + {"null_pointers/null_pointer_assignment_equal.spv.dis", 1, FAIL}, + {"null_pointers/null_pointer_assignment_unequal.spv.dis", 1, FAIL}, + {"null_pointers/null_pointer_greater.spv.dis", 1, FAIL}, + {"pointertests/test_return_pointer.spv.dis", 1, PASS}, + {"report_global_id/test1.spv.dis", 1, PASS}, + {"report_global_id/test2.spv.dis", 1, FAIL}, + {"sourcelocation_tests/barrier_divergence/pass.spv.dis", 1, PASS}, + {"sourcelocation_tests/needs_source_location_ensures.spv.dis", 1, PASS}, + {"sourcelocation_tests/needs_source_location_requires.spv.dis", 1, PASS}, + {"sourcelocation_tests/race_with_loop.spv.dis", 2, UNKNOWN}, + {"sourcelocation_tests/races/fail/read_write.spv.dis", 1, FAIL}, + {"sourcelocation_tests/races/fail/write_read.spv.dis", 1, FAIL}, + {"sourcelocation_tests/races/fail/write_write/loop.spv.dis", 1, FAIL}, + {"sourcelocation_tests/races/fail/write_write/normal.spv.dis", 1, FAIL}, + {"sourcelocation_tests/races/pass/no_race.spv.dis", 1, PASS}, + {"sourcelocation_tests/races/pass/read_read.spv.dis", 1, PASS}, + {"test_2d_global_index_inference.spv.dis", 2, UNKNOWN}, + {"test_2d_local_index_inference_2.spv.dis", 1, PASS}, + {"test_for_benign_read_write_bug.spv.dis", 1, FAIL}, + {"test_local_id_inference.spv.dis", 1, PASS}, + {"test_mod_invariants/global_reduce_strength.spv.dis", 1, UNKNOWN}, + {"test_part_load_store/store_int_and_short.spv.dis", 1, PASS}, + {"test_for_ssa_bug.spv.dis", 2, PASS}, + {"test_structs/use_array_element.spv.dis", 1, PASS}, + {"test_structs/use_element.spv.dis", 1, PASS}, + {"test_structs/use_struct_element.spv.dis", 1, PASS}, + + // Fails in gpu-verify, but should pass (even according to the annotation in the test) + {"saturate/sadd.spv.dis", 1, PASS}, + {"saturate/ssub.spv.dis", 1, PASS}, + + // Passes in gpu-verify, but has race (even according to the annotation in the test) + {"atomics/refined_atomic_abstraction/bad_local_counters.spv.dis", 1, FAIL}, + {"atomics/refined_atomic_abstraction/intra_local_counters.spv.dis", 1, FAIL}, + + // Should pass according to gpu-verify, suspecting a bug in the memory model + {"atomics/counter.spv.dis", 1, FAIL}, + + // In gpu-verify fails barrier divergence but not leading to a data race + {"barrier_intervals/test2.spv.dis", 1, PASS}, + {"sourcelocation_tests/barrier_divergence/fail.spv.dis", 1, PASS}, + + // In gpu-verify fails command-line test, no races + {"global_size/local_size_fail_divide_global_size.spv.dis", 1, PASS}, + {"global_size/mismatch_dims.spv.dis", 1, PASS}, + {"global_size/num_groups_and_global_size.spv.dis", 1, PASS}, + + // Unsupported large array (4K elements) leading to OOM + // {"misc/fail/2d_array_race.spv.dis", 1, FAIL}, + + // Unsupported (array size too large) + // TODO: Analyze + // {"test_mod_invariants/local_direct.spv.dis", 1, UNKNOWN}, + + // Unsupported null as a pointer + // {"null_pointers/atomic_null.spv.dis", 1, ??}, + + // Unsupported cuda warps + // {"warpsync/intragroup_scan.spv.dis", 1, FAIL}, + // {"warpsync/scan_warp.spv.dis", 1, FAIL}, + + // Unsupported barriers in a loop + // {"barrier_intervals/test3.spv.dis", 1, PASS}, + // {"barrier_intervals/test4.spv.dis", 1, PASS}, + // {"misc/pass/misc12.spv.dis", 1, PASS}, + // {"skeletonbinomialoptions.spv.dis", 1, PASS}, + + // Unsupported non-constant tags + // {"inter_group_and_barrier_flag_tests/fail/bad_read_then_write.spv.dis", 1, FAIL}, + // {"inter_group_and_barrier_flag_tests/fail/bad_write_then_read.spv.dis", 1, FAIL}, + // {"inter_group_and_barrier_flag_tests/pass/read_then_write.spv.dis", 1, PASS}, + // {"inter_group_and_barrier_flag_tests/pass/write_then_read.spv.dis", 1, PASS}, + + // Unsupported vector registers + // {"annotation_tests/test_axiom.spv.dis", 1, PASS}, + // {"async_work_group_copy/fail/test13.spv.dis", 1, FAIL}, + // {"async_work_group_copy/fail/test7.spv.dis", 1, ??}, + // {"async_work_group_copy/fail/test8.spv.dis", 1, ??}, + // {"async_work_group_copy/fail/test9.spv.dis", 1, ??}, + // {"induction_variable.spv.dis", 1, PASS}, + // {"inter_group_and_barrier_flag_tests/fail/missing_global_barrier_flag.spv.dis", 1, FAIL}, + // {"inter_group_and_barrier_flag_tests/fail/sync_within_group_wrong_flag.spv.dis", 1, FAIL}, + // {"inter_group_and_barrier_flag_tests/pass/global_barrier.spv.dis", 1, PASS}, + // {"inter_group_and_barrier_flag_tests/pass/sync_within_group.spv.dis", 1, PASS}, + // {"k-induction/amazingreduction.spv.dis", 1, FAIL}, + // {"reducedstrength_generalised.spv.dis", 1, PASS}, + // {"test_2d_local_index_inference.spv.dis", 1, PASS}, + // {"test_global_id_inference.spv.dis", 1, PASS}, + // {"test_line_number_problem.spv.dis", 1, FAIL}, + // {"test_mod_invariants/local_reduce_strength.spv.dis", 1, PASS}, + + // Unsupported spir-v ops + // {"alignment/int3int4.spv.dis", 1, PASS}, + // {"alignment/race_location.spv.dis", 1, FAIL}, + // {"async_work_group_copy/fail/test1.spv.dis", 1, FAIL}, + // {"async_work_group_copy/fail/test10.spv.dis", 1, FAIL}, + // {"async_work_group_copy/fail/test14.spv.dis", 1, FAIL}, + // {"async_work_group_copy/fail/test15.spv.dis", 1, ??}, + // {"async_work_group_copy/fail/test16.spv.dis", 1, ??}, + // {"async_work_group_copy/fail/test17.spv.dis", 1, ??}, + // {"async_work_group_copy/fail/test18.spv.dis", 1, ??}, + // {"async_work_group_copy/fail/test2.spv.dis", 1, FAIL}, + // {"async_work_group_copy/fail/test4.spv.dis", 1, FAIL}, + // {"async_work_group_copy/fail/test5.spv.dis", 1, FAIL}, + // {"async_work_group_copy/pass/test1.spv.dis", 1, PASS}, + // {"async_work_group_copy/pass/test2.spv.dis", 1, PASS}, + // {"async_work_group_copy/pass/test3.spv.dis", 1, PASS}, + // {"async_work_group_copy/pass/test4.spv.dis", 1, PASS}, + // {"async_work_group_copy/pass/test5.spv.dis", 1, PASS}, + // {"async_work_group_copy/pass/test6.spv.dis", 1, ??}, + // {"async_work_group_copy/pass/test7.spv.dis", 1, ??}, + // {"async_work_group_copy/pass/test8.spv.dis", 1, ??}, + // {"async_work_group_copy/pass/test9.spv.dis", 1, ??}, + // {"atomics/definitions_atom_int.spv.dis", 1, PASS}, + // {"atomics/definitions_float.spv.dis", 1, PASS}, + // {"atomics/definitions_int.spv.dis", 1, PASS}, + // {"atomics/definitions_long.spv.dis", 1, PASS}, + // {"atomics/displaced.spv.dis", 1, PASS}, + // {"atomics/mismatched_types/int_add_with_float.spv.dis", 1, PASS}, + // {"atomics/mismatched_types/int_add_with_long.spv.dis", 1, ??}, + // {"atomics/mismatched_types/int_add_with_short.spv.dis", 1, PASS}, + // {"atomics/pointers.spv.dis", 1, FAIL}, + // {"atomics/refined_atomic_abstraction/many_accesses.spv.dis", 1, PASS}, + // {"atomics/refined_atomic_abstraction/one_access.spv.dis", 1, PASS}, + // {"atomics/refined_atomic_abstraction/predication.spv.dis", 1, FAIL}, + // {"barrierconditionalkernelparam.spv.dis", 1, PASS}, + // {"benign_race_tests/fail/writetiddiv64_offbyone.spv.dis", 1, FAIL}, + // {"benign_race_tests/fail/writewritearray_adversarial.spv.dis", 1, FAIL}, + // {"benign_race_tests/pass/writeinloop.spv.dis", 1, FAIL}, + // {"ceil.spv.dis", 1, PASS}, + // {"constantnotparam.spv.dis", 1, PASS}, + // {"derivedfrombinomialoptions.spv.dis", 1, PASS}, + // {"floatcastrequired.spv.dis", 1, PASS}, + // {"get_global_id.spv.dis", 1, PASS}, + // {"globalarray/fail.spv.dis", 1, FAIL}, + // {"globalarray/pass.spv.dis", 1, PASS}, + // {"imagetests/fail2dimagecopy.spv.dis", 1, FAIL}, + // {"imagetests/test2dimagecopy.spv.dis", 1, PASS}, + // {"imagetests/testsampler.spv.dis", 1, PASS}, + // {"imagetests/testsampler2.spv.dis", 1, PASS}, + // {"misc/fail/4d_array_of_vectors_race.spv.dis", 1, FAIL}, + // {"misc/fail/miscfail9.spv.dis", 1, FAIL}, + // {"misc/fail/vector_element_race.spv.dis", 1, FAIL}, + // {"misc/pass/misc15.spv.dis", 1, FAIL}, + // {"misc/pass/misc16.spv.dis", 1, PASS}, + // {"misc/pass/misc7.spv.dis", 1, PASS}, + // {"misc/pass/misc8.spv.dis", 1, PASS}, + // {"noraceduetoreturn.spv.dis", 1, PASS}, + // {"null_pointers/store_to_null_and_non_null.spv.dis", 1, ??}, + // {"pointeranalysistests/manyprocedures.spv.dis", 1, PASS}, + // {"pointeranalysistests/manyproceduresinlined.spv.dis", 1, PASS}, + // {"pointeranalysistests/testbasicaliasing.spv.dis", 1, PASS}, + // {"pointeranalysistests/testbasicaliasing2.spv.dis", 1, PASS}, + // {"pointeranalysistests/testbasicpointerarithmetic.spv.dis", 1, PASS}, + // {"pointeranalysistests/testbasicpointerarithmetic2.spv.dis", 1, PASS}, + // {"pointeranalysistests/testinterprocedural.spv.dis", 1, PASS}, + // {"pointertests/test_copy_between_memory_spaces2.spv.dis", 1, FAIL}, + // {"pow2/64bit_loopcounter.spv.dis", 1, PASS}, + // {"pow2/64bit_relational.spv.dis", 1, PASS}, + // {"saturate/uadd.spv.dis", 1, ??}, + // {"saturate/usub.spv.dis", 1, ??}, + // {"shuffle/shuffle.spv.dis", 1, PASS}, + // {"simplebinomialoptions.spv.dis", 1, PASS}, + // {"sourcelocation_tests/races/fail/write_write/elem_width_16.spv.dis", 1, FAIL}, + // {"ternarytest.spv.dis", 1, PASS}, + // {"ternarytest2.spv.dis", 1, PASS}, + // {"test_for_get_group_id.spv.dis", 1, PASS}, + // {"transitiveclosuresimplified.spv.dis", 1, PASS}, + // {"vectortests/float4arrayaccess.spv.dis", 1, PASS}, + // {"vectortests/int3arrayaccess.spv.dis", 1, PASS}, + // {"vectortests/test_paren.spv.dis", 1, FAIL}, + // {"warpsync/2d.spv.dis", 1, FAIL}, + // {"warpsync/broken_shuffle.spv.dis", 1, FAIL}, + // {"warpsync/shuffle.spv.dis", 1, FAIL}, + + // Compiler eliminated reads of unused value + // {"misc/fail/miscfail8.spv.dis", 1, FAIL}, + // {"pointertests/test_copy_between_memory_spaces.spv.dis", 1, FAIL}, + // {"sourcelocation_tests/race_from_call.spv.dis", 1, FAIL}, + // {"sourcelocation_tests/race_from_call_in_loop.spv.dis", 1, FAIL}, + // {"sourcelocation_tests/races_from_indirect_calls.spv.dis", 1, FAIL}, + + // Compiler eliminated the whole main function + // {"addressofinit.spv.dis", 1, PASS}, + // {"array_bounds_tests/array_in_array.spv.dis", 1, FAIL}, + // {"array_bounds_tests/array_in_array_2.spv.dis", 1, PASS}, + // {"array_bounds_tests/array_in_array_param.spv.dis", 1, FAIL}, + // {"array_bounds_tests/multi_dim_array.spv.dis", 1, PASS}, + // {"array_bounds_tests/multi_dim_array_fail_upper.spv.dis", 1, PASS}, + // {"array_bounds_tests/negative_index_multi_dim.spv.dis", 1, PASS}, + // {"array_bounds_tests/negative_index_multi_dim_fail.spv.dis", 1, PASS}, + // {"array_bounds_tests/private_array.spv.dis", 1, PASS}, + // {"array_bounds_tests/realign_simple.spv.dis", 1, PASS}, + // {"array_bounds_tests/realign_simple_fail.spv.dis", 1, PASS}, + // {"array_bounds_tests/simple_array.spv.dis", 1, PASS}, + // {"array_bounds_tests/simple_array_fail_lower.spv.dis", 1, PASS}, + // {"array_bounds_tests/simple_array_fail_upper.spv.dis", 1, PASS}, + // {"array_bounds_tests/simple_array_fail_var.spv.dis", 1, PASS}, + // {"basic1.spv.dis", 1, PASS}, + // {"benign_race_tests/pass/writeafterread.spv.dis", 1, FAIL}, + // {"bitand.spv.dis", 1, PASS}, + // {"bitnot.spv.dis", 1, PASS}, + // {"bitor.spv.dis", 1, PASS}, + // {"bitxor.spv.dis", 1, PASS}, + // {"bool_bv_test.spv.dis", 1, PASS}, + // {"casttofloat.spv.dis", 1, PASS}, + // {"checkarrays/fail/arraydoesnotexist1.spv.dis", 1, PASS}, + // {"checkarrays/fail/arraydoesnotexist2.spv.dis", 1, PASS}, + // {"conditional_int_test.spv.dis", 1, PASS}, + // {"derived_from_uniformity_analysis_bug.spv.dis", 1, PASS}, + // {"derivedfrombinomialoptions2.spv.dis", 1, PASS}, + // {"fail_equality_and_adversarial.spv.dis", 1, PASS}, + // {"float_constant_test2.spv.dis", 1, PASS}, + // {"floatrelationalop.spv.dis", 1, PASS}, + // {"leftshiftequals.spv.dis", 1, PASS}, + // {"localmultidimarraydecl.spv.dis", 1, PASS}, + // {"misc/fail/4d_array_of_structs_race.spv.dis", 1, FAIL}, + // {"misc/fail/4d_array_race.spv.dis", 1, FAIL}, + // {"misc/fail/4d_array_with_casting.spv.dis", 1, FAIL}, + // {"misc/fail/miscfail10.spv.dis", 1, FAIL}, + // {"misc/pass/misc3.spv.dis", 1, PASS}, + // {"misc/pass/misc4.spv.dis", 1, PASS}, + // {"modifyparam.spv.dis", 1, PASS}, + // {"multidimarrays/test1.spv.dis", 1, PASS}, + // {"multidimarrays/test2.spv.dis", 1, PASS}, + // {"multidimarrays/test3.spv.dis", 1, PASS}, + // {"multidimarrays/test4.spv.dis", 1, PASS}, + // {"multiplelocals.spv.dis", 1, PASS}, + // {"multiplelocals2.spv.dis", 1, PASS}, + // {"notunaryoptest.spv.dis", 1, PASS}, + // {"null_pointers/load_from_null.spv.dis", 1, ??}, + // {"null_statement.spv.dis", 1, PASS}, + // {"pointertests/param_addressof.spv.dis", 1, PASS}, + // {"pointertests/pointerarith.spv.dis", 1, PASS}, + // {"pointertests/test_derived_from_binomial_opts.spv.dis", 1, PASS}, + // {"pointertests/test_opencl_local_array.spv.dis", 1, ??}, + // {"pointertests/test_opencl_local_param.spv.dis", 1, ??}, + // {"pointertests/test_pass_value_from_array.spv.dis", 1, PASS}, + // {"predicated_undef.spv.dis", 1, PASS}, + // {"reducedstrengthnonloopbug.spv.dis", 1, PASS}, + // {"return_tests/id_dependent_return.spv.dis", 1, PASS}, + // {"return_tests/multiloop_return.spv.dis", 1, PASS}, + // {"return_tests/multiloop_return_simplified.spv.dis", 1, PASS}, + // {"return_tests/simple_return.spv.dis", 1, PASS}, + // {"rightshiftequals.spv.dis", 1, PASS}, + // {"shared_int.spv.dis", 1, FAIL}, + // {"simpleparampassing.spv.dis", 1, PASS}, + // {"simpleprocedurecall.spv.dis", 1, PASS}, + // {"simplereturn.spv.dis", 1, PASS}, + // {"test_address_of_bug.spv.dis", 1, PASS}, + // {"test_float_neq.spv.dis", 1, PASS}, + // {"test_structs/store_array_element.spv.dis", 1, PASS}, + // {"test_structs/store_element.spv.dis", 1, PASS}, + // {"test_structs/store_struct_element.spv.dis", 1, PASS}, + // {"unusedreturn.spv.dis", 1, PASS}, + // {"vectortests/addressofvector.spv.dis", 1, PASS}, + // {"vectortests/double2simpleaccess.spv.dis", 1, PASS}, + // {"vectortests/double4simpleaccess.spv.dis", 1, PASS}, + // {"vectortests/float2simpleaccess.spv.dis", 1, PASS}, + // {"vectortests/float4simpleaccess.spv.dis", 1, PASS}, + // {"vectortests/vectorsplat.spv.dis", 1, PASS}, + // {"vectortests/vectorswizzle.spv.dis", 1, PASS}, + }); + } + + @Test + public void testAllSolvers() throws Exception { + /* TODO: Implementation + try (SolverContext ctx = mkCtx(); ProverEnvironment prover = mkProver(ctx)) { + assertEquals(expected, RefinementSolver.run(ctx, prover, mkTask()).getResult()); + }*/ + try (SolverContext ctx = mkCtx(); ProverEnvironment prover = mkProver(ctx)) { + assertEquals(expected, AssumeSolver.run(ctx, prover, mkTask()).getResult()); + } + } + + private SolverContext mkCtx() throws InvalidConfigurationException { + Configuration cfg = Configuration.builder().build(); + return SolverContextFactory.createSolverContext( + Configuration.builder().build(), + BasicLogManager.create(cfg), + ShutdownManager.create().getNotifier(), + SolverContextFactory.Solvers.Z3); + } + + private ProverEnvironment mkProver(SolverContext ctx) { + return ctx.newProverEnvironment(SolverContext.ProverOptions.GENERATE_MODELS); + } + + private VerificationTask mkTask() throws Exception { + VerificationTask.VerificationTaskBuilder builder = VerificationTask.builder() + .withConfig(Configuration.builder().build()) + .withBound(bound) + .withTarget(Arch.VULKAN); + Program program = new ProgramParser().parse(new File(programPath)); + Wmm mcm = new ParserCat().parse(new File(modelPath)); + return builder.build(program, mcm, EnumSet.of(CAT_SPEC)); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/header/AbstractTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/header/AbstractTest.java new file mode 100644 index 0000000000..1b7ba45689 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/header/AbstractTest.java @@ -0,0 +1,62 @@ +package com.dat3m.dartagnan.spirv.header; + +import com.dat3m.dartagnan.parsers.program.ParserSpirv; +import com.dat3m.dartagnan.program.Program; +import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.CharStreams; + +public abstract class AbstractTest { + + protected static final String BODY = """ + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %uint16 = OpTypeInt 16 0 + %uint32 = OpTypeInt 32 0 + %uint64 = OpTypeInt 64 0 + %c0 = OpConstant %uint64 0 + %c1 = OpConstant %uint64 1 + %c2 = OpConstant %uint64 2 + %c3 = OpConstant %uint64 3 + %c0_16 = OpConstant %uint16 0 + %c1_32 = OpConstant %uint32 1 + %v1uint = OpTypeVector %uint64 1 + %v3uint = OpTypeVector %uint64 3 + %a2uint = OpTypeArray %uint64 %c2 + %a3uint = OpTypeArray %uint64 %c3 + %struct = OpTypeStruct %a2uint %v1uint + %struct_2 = OpTypeStruct %uint16 %uint32 %uint64 + %v1v1uint = OpTypeVector %v1uint 1 + %ptr_uint16 = OpTypePointer Uniform %uint16 + %ptr_uint32 = OpTypePointer Uniform %uint32 + %ptr_uint64 = OpTypePointer Uniform %uint64 + %ptr_v3uint = OpTypePointer Uniform %v3uint + %ptr_a3uint = OpTypePointer Uniform %a3uint + %ptr_struct_1 = OpTypePointer Uniform %struct + %ptr_struct_2 = OpTypePointer Uniform %struct_2 + %ptr_v1v1uint = OpTypePointer Uniform %v1v1uint + %func = OpTypeFunction %void + %v1 = OpVariable %ptr_uint64 Uniform + %v2 = OpVariable %ptr_uint64 Uniform + %v3 = OpVariable %ptr_uint64 Uniform + %v3v = OpVariable %ptr_v3uint Uniform + %v4 = OpVariable %ptr_v3uint Uniform + %v5 = OpVariable %ptr_a3uint Uniform + %v6 = OpVariable %ptr_struct_1 Uniform + %v7 = OpVariable %ptr_struct_2 Uniform + %v8 = OpVariable %ptr_v1v1uint Uniform + %main = OpFunction %void None %func + %label = OpLabel + OpReturn + OpFunctionEnd + """; + + protected Program parse(String header) { + ParserSpirv parser = new ParserSpirv(); + String data = String.format("%s\n%s", header, BODY); + CharStream charStream = CharStreams.fromString(data); + return parser.parse(charStream); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/header/AssertTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/header/AssertTest.java new file mode 100644 index 0000000000..53158761a9 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/header/AssertTest.java @@ -0,0 +1,102 @@ +package com.dat3m.dartagnan.spirv.header; + +import com.dat3m.dartagnan.program.Program; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import java.util.Arrays; + +import static com.dat3m.dartagnan.program.Program.SpecificationType.*; +import static org.junit.Assert.assertEquals; + +@RunWith(Parameterized.class) +public class AssertTest extends AbstractTest { + + private final String input; + private final String expValue; + private final Program.SpecificationType expType; + + public AssertTest(String input, String expValue, Program.SpecificationType expType) { + this.input = input; + this.expValue = expValue; + this.expType = expType; + } + + @Parameterized.Parameters() + public static Iterable data() { + return Arrays.asList(new Object[][]{ + // scalar + {"; @Output: forall %v1==1 and %v2>2 and %v3<3", + "(%v1 == bv64(1)) && (%v2 > bv64(2)) && (%v3 < bv64(3))", + FORALL}, + {"; @Output: forall 1!=%v1 and 2>%v2 and 3<%v3", + "(bv64(1) != %v1) && (bv64(2) > %v2) && (bv64(3) < %v3)", + FORALL}, + + // vector + {"; @Output: forall %v4[0]<=1 and %v4[1]>=2 and %v4[2]==3", + "(%v4[0] <= bv64(1)) && (%v4[1] >= bv64(2)) && (%v4[2] == bv64(3))", + FORALL}, + {"; @Output: forall 1<=%v4[0] and 2>=%v4[1] and 3==%v4[2]", + "(bv64(1) <= %v4[0]) && (bv64(2) >= %v4[1]) && (bv64(3) == %v4[2])", + FORALL}, + + // array + {"; @Output: forall (%v5[0]==1 and %v5[1]==2 and %v5[2]==3)", + "(%v5[0] == bv64(1)) && (%v5[1] == bv64(2)) && (%v5[2] == bv64(3))", + FORALL}, + {"; @Output: forall (1==%v5[0] and 2==%v5[1] and 3==%v5[2])", + "(bv64(1) == %v5[0]) && (bv64(2) == %v5[1]) && (bv64(3) == %v5[2])", + FORALL}, + + // struct + {"; @Output: forall (%v6[0][0]==1 and %v6[0][1]==2 and %v6[1][0]==3)", + "(%v6[0][0] == bv64(1)) && (%v6[0][1] == bv64(2)) && (%v6[1][0] == bv64(3))", + FORALL}, + {"; @Output: forall (1==%v6[0][0] and 2==%v6[0][1] and 3==%v6[1][0])", + "(bv64(1) == %v6[0][0]) && (bv64(2) == %v6[0][1]) && (bv64(3) == %v6[1][0])", + FORALL}, + + // bit width + {"; @Output: forall (%v7[0]==1 and %v7[1]==2 and %v7[2]==3)", + "(%v7[0] == bv16(1)) && (%v7[1] == bv32(2)) && (%v7[2] == bv64(3))", + FORALL}, + + // precedence + {"; @Output: forall %v1==1 and %v2==2 or %v3==3", + "((%v1 == bv64(1)) && (%v2 == bv64(2))) || (%v3 == bv64(3))", + FORALL}, + {"; @Output: forall %v1==1 and (%v2==2 or %v3==3)", + "(%v1 == bv64(1)) && ((%v2 == bv64(2)) || (%v3 == bv64(3)))", + FORALL}, + + // assert types + {"; @Output: exists (%v1==1 and %v2==2 and %v3==3)", + "(%v1 == bv64(1)) && (%v2 == bv64(2)) && (%v3 == bv64(3))", + EXISTS}, + {""" + ; @Output: forall (%v1==1) + ; @Output: forall (%v2==2 and %v3==3) + """, + "(%v1 == bv64(1)) && (%v2 == bv64(2)) && (%v3 == bv64(3))", + FORALL}, + {""" + ; @Output: not exists (%v1!=1) + ; @Output: not exists (%v2!=2 or %v3!=3) + """, + "(%v1 != bv64(1)) || (%v2 != bv64(2)) || (%v3 != bv64(3))", + NOT_EXISTS}, + }); + } + + @Test + public void testAssertions() { + // when + Program program = parse(input); + + // then + assertEquals(expValue, program.getSpecification().toString()); + assertEquals(expType, program.getSpecificationType()); + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/header/BadFormatTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/header/BadFormatTest.java new file mode 100644 index 0000000000..85fe02802f --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/header/BadFormatTest.java @@ -0,0 +1,72 @@ +package com.dat3m.dartagnan.spirv.header; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import java.util.Arrays; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +@RunWith(Parameterized.class) +public class BadFormatTest extends AbstractTest { + + private final String input; + private final String error; + + public BadFormatTest(String input, String error) { + this.input = input; + this.error = error; + } + + @Parameterized.Parameters() + public static Iterable data() { + return Arrays.asList(new Object[][]{ + {""" + ; @Input: %v1=7, %v2=123, %v3=0 + ; @Input: %v1=7 + ; @Output: forall (%v1==7 and %v2==123 and %v3==0) + ; @Config: 1, 1, 1 + """, + "Duplicated input definition '%v1'"}, + {""" + ; @Input: %v1=7, %v2=123, %v3=0 + ; @Output: exists (%undefined!=456) + ; @Config: 1, 1, 1 + """, + "Reference to undefined expression '%undefined'"}, + {""" + ; @Input: %v1=7, %v2=123, %v3=0 + ; @Output: exists (%v1!=7) + ; @Output: not exists (%v2==123 and %v3==0) + ; @Config: 1, 1, 1 + """, + "Mixed assertion type is not supported"}, + {""" + ; @Input: %v1=7, %v2=123, %v3=0 + ; @Output: exists (%v1!=7) + ; @Output: forall (%v2==123 and %v3==0) + ; @Config: 1, 1, 1 + """, + "Mixed assertion type is not supported"}, + {""" + ; @Input: %v1=7, %v2=123, %v3=0 + ; @Output: exists (%v1!=7) + ; @Output: exists (%v2==123 and %v3==0) + ; @Config: 1, 1, 1 + """, + "Multiline assertion is not supported for type EXISTS"}, + }); + } + + @Test + public void testValidFormatHeader() { + try { + parse(input); + fail("Should throw exception"); + } catch (Exception e) { + assertEquals(error, e.getMessage()); + } + } +} \ No newline at end of file diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/header/BadIndexTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/header/BadIndexTest.java new file mode 100644 index 0000000000..24ce20246c --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/header/BadIndexTest.java @@ -0,0 +1,57 @@ +package com.dat3m.dartagnan.spirv.header; + +import com.dat3m.dartagnan.exception.ParsingException; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import java.util.Arrays; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +@RunWith(Parameterized.class) +public class BadIndexTest extends AbstractTest { + + private final String input; + private final String error; + + public BadIndexTest(String input, String error) { + this.input = input; + this.error = error; + } + + @Parameterized.Parameters() + public static Iterable data() { + return Arrays.asList(new Object[][]{ + {"; @Output: forall %v8[0][0][0]==0", + "Index is too deep for variable '%v8[0][0][0]'"}, + {"; @Output: forall %v8[0]==0", + "Index is not deep enough for variable '%v8[0]'"}, + {"; @Output: forall %v8[1][0]==0", + "Index is out of bounds for variable '%v8[1]'"}, + {"; @Output: forall %v8[0][1]==0", + "Index is out of bounds for variable '%v8[0][1]'"}, + {"; @Input: %v8={{{0}}}", + "Mismatching value type for variable '%v8[0][0]', expected 'bv64' but received '{ bv64 }'"}, + {"; @Input: %v8={0}", + "Mismatching value type for variable '%v8[0]', expected '[1 x bv64]' but received 'bv64'"}, + {"; @Input: %v8={{0}, {0}}", + "Unexpected number of elements in variable '%v8', expected 1 but received 2"}, + {"; @Input: %v8={{0, 0}}", + "Unexpected number of elements in variable '%v8[0]', expected 1 but received 2"}, + }); + } + + @Test + public void test() { + try { + // when + parse(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals(error, e.getMessage()); + } + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/header/ConfigTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/header/ConfigTest.java new file mode 100644 index 0000000000..9b9bddc347 --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/header/ConfigTest.java @@ -0,0 +1,71 @@ +package com.dat3m.dartagnan.spirv.header; + +import com.dat3m.dartagnan.exception.ParsingException; +import com.dat3m.dartagnan.program.Program; +import com.dat3m.dartagnan.program.ScopeHierarchy; +import com.dat3m.dartagnan.program.Thread; +import org.junit.Test; + +import java.util.List; + +import static com.dat3m.dartagnan.program.event.Tag.Vulkan.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class ConfigTest extends AbstractTest { + + @Test + public void testExplicitConfig() { + doTestLegalConfig("", List.of(1, 1, 1)); + doTestLegalConfig("; @Config: 1, 1, 1", List.of(1, 1, 1)); + doTestLegalConfig("; @Config: 2, 3, 4", List.of(2, 3, 4)); + doTestLegalConfig("; @Config: 4, 3, 2", List.of(4, 3, 2)); + } + + private void doTestLegalConfig(String input, List scopes) { + // when + Program program = parse(input); + + // then + int size = scopes.stream().reduce(1, (a, b) -> a * b); + List threads = program.getThreads(); + assertEquals(size, threads.size()); + + int sg_size = scopes.get(0); + int wg_size = scopes.get(1) * sg_size; + int qf_size = scopes.get(2) * wg_size; + for (int i = 0; i < size; i++) { + ScopeHierarchy hierarchy = threads.get(i).getScopeHierarchy(); + assertEquals(i, threads.get(i).getId()); + assertEquals(((i % qf_size) % wg_size) / sg_size, hierarchy.getScopeId(SUB_GROUP)); + assertEquals((i % qf_size) / wg_size, hierarchy.getScopeId(WORK_GROUP)); + assertEquals(i / qf_size, hierarchy.getScopeId(QUEUE_FAMILY)); + assertEquals(0, hierarchy.getScopeId(DEVICE)); + } + } + + @Test + public void testIllegalConfig() { + doTestIllegalConfig("; @Config: 1, 1", + "Line 2:16 mismatched input 'Op' expecting ','"); + doTestIllegalConfig("; @Config: 1, 1, 0", + "Thread grid dimensions must be positive"); + doTestIllegalConfig(""" + ; @Output: forall (1 == 1) + ; @Config: 1, 1, 1 + ; @Config: 1, 1, 1 + """, + "Multiple config headers are not allowed"); + } + + private void doTestIllegalConfig(String input, String error) { + try { + // when + parse(input); + fail("Should throw exception"); + } catch (ParsingException e) { + // then + assertEquals(error, e.getMessage()); + } + } +} diff --git a/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/header/InputTest.java b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/header/InputTest.java new file mode 100644 index 0000000000..ae7b9aeafb --- /dev/null +++ b/dartagnan/src/test/java/com/dat3m/dartagnan/spirv/header/InputTest.java @@ -0,0 +1,78 @@ +package com.dat3m.dartagnan.spirv.header; + +import com.dat3m.dartagnan.expression.integers.IntLiteral; +import com.dat3m.dartagnan.program.Program; +import com.dat3m.dartagnan.program.memory.MemoryObject; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import java.util.Arrays; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.junit.Assert.assertEquals; + +@RunWith(Parameterized.class) +public class InputTest extends AbstractTest { + + private final String input; + + public InputTest(String input) { + this.input = input; + } + + @Parameterized.Parameters() + public static Iterable data() { + return Arrays.asList(new Object[][]{ + {""" + ; @Input: %v1=1 + ; @Input: %v2=2 + ; @Input: %v3=3 + ; @Input: %v4 = {11, 12, 13} + ; @Input: %v5 = {21, 22, 23} + ; @Input: %v6 = {{31, 32}, {33}} + ; @Input: %v7 = {41, 42, 43} + ; @Input: %v8 = {{51}} + """}, + {""" + ; @Input: %v1=1, %v2=2, %v3=3, %v4 = {11, 12, 13}, %v5 = {21, 22, 23} + ; @Input: %v6 = {{31, 32}, {33}}, %v7 = {41, 42, 43}, %v8 = {{51}} + """} + }); + } + + @Test + public void testValues() { + Program program = parse(input); + Map memory = program.getMemory().getObjects().stream() + .collect(Collectors.toMap(MemoryObject::getName, Function.identity())); + + check(memory.get("%v1"), 0, 1); + check(memory.get("%v2"), 0, 2); + check(memory.get("%v3"), 0, 3); + + check(memory.get("%v4"), 0, 11); + check(memory.get("%v4"), 8, 12); + check(memory.get("%v4"), 16, 13); + + check(memory.get("%v5"), 0, 21); + check(memory.get("%v5"), 8, 22); + check(memory.get("%v5"), 16, 23); + + check(memory.get("%v6"), 0, 31); + check(memory.get("%v6"), 8, 32); + check(memory.get("%v6"), 16, 33); + + check(memory.get("%v7"), 0, 41); + check(memory.get("%v7"), 4, 42); + check(memory.get("%v7"), 8, 43); + + check(memory.get("%v8"), 0, 51); + } + + private void check(MemoryObject memObj, int idx, int expected) { + assertEquals(expected, ((IntLiteral) memObj.getInitialValue(idx)).getValueAsInt()); + } +} diff --git a/dartagnan/src/test/resources/VULKAN-CK-expected.csv b/dartagnan/src/test/resources/VULKAN-CK-expected.csv index db90b417c4..fa84a018c8 100644 --- a/dartagnan/src/test/resources/VULKAN-CK-expected.csv +++ b/dartagnan/src/test/resources/VULKAN-CK-expected.csv @@ -143,7 +143,7 @@ litmus/VULKAN/Kronos-Group/test5.litmus,1 litmus/VULKAN/Kronos-Group/test6.litmus,1 litmus/VULKAN/Kronos-Group/test9.litmus,1 litmus/VULKAN/Kronos-Group/waw.litmus,1 -litmus/VULKAN/Manual/asmo-weak.litmus,1 +litmus/VULKAN/Manual/asmo-plain.litmus,1 litmus/VULKAN/Manual/CoWW-RR.litmus,1 litmus/VULKAN/Manual/SB-2-wg.litmus,1 litmus/VULKAN/Manual/SB-2-dv.litmus,1 @@ -237,3 +237,8 @@ litmus/VULKAN/Manual/PC-bar-acq-rel-priv.litmus,1 litmus/VULKAN/Manual/PC-bar-atom.litmus,1 litmus/VULKAN/Manual/PC-bar-nonpriv.litmus,1 litmus/VULKAN/Manual/OOTA.litmus,1 +litmus/VULKAN/Manual/IRIW.litmus,1 +litmus/VULKAN/Manual/counter-atomic-store-rmw.litmus,1 +litmus/VULKAN/Manual/counter-plain-store-rmw.litmus,1 +litmus/VULKAN/Manual/counter-plain-store-atomic-load.litmus,1 +litmus/VULKAN/Manual/counter-plain-store-plain-load.litmus,1 \ No newline at end of file diff --git a/dartagnan/src/test/resources/VULKAN-DR-expected.csv b/dartagnan/src/test/resources/VULKAN-DR-expected.csv index 6f6ade6bdb..fd58008e84 100644 --- a/dartagnan/src/test/resources/VULKAN-DR-expected.csv +++ b/dartagnan/src/test/resources/VULKAN-DR-expected.csv @@ -82,13 +82,19 @@ litmus/VULKAN/Manual/MP-mesa.litmus,1 litmus/VULKAN/Manual/MP-mesa-load-acq.litmus,1 litmus/VULKAN/Manual/MP-mesa-fence-loop.litmus,1 litmus/VULKAN/Manual/MP-mesa-optimized.litmus,1 +litmus/VULKAN/Manual/XF-Barrier.litmus,1 litmus/VULKAN/Manual/XF-Barrier-relacq.litmus,1 +litmus/VULKAN/Manual/XF-Barrier-relacq2.litmus,0 litmus/VULKAN/Manual/XF-Barrier-rlx.litmus,0 litmus/VULKAN/Manual/XF-Barrier-weak.litmus,0 -litmus/VULKAN/Manual/asmo-weak.litmus,0 +litmus/VULKAN/Manual/asmo-plain.litmus,0 litmus/VULKAN/Manual/PC-bar-acq-rel-atom.litmus,1 litmus/VULKAN/Manual/PC-bar-acq-rel-nonpriv.litmus,1 litmus/VULKAN/Manual/PC-bar-acq-rel-priv.litmus,0 litmus/VULKAN/Manual/PC-bar-atom.litmus,1 litmus/VULKAN/Manual/PC-bar-nonpriv.litmus,0 litmus/VULKAN/Manual/OOTA.litmus,1 +litmus/VULKAN/Manual/counter-atomic-store-rmw.litmus,1 +litmus/VULKAN/Manual/counter-plain-store-rmw.litmus,1 +litmus/VULKAN/Manual/counter-plain-store-atomic-load.litmus,1 +litmus/VULKAN/Manual/counter-plain-store-plain-load.litmus,1 \ No newline at end of file diff --git a/dartagnan/src/test/resources/VULKAN-Liveness-expected.csv b/dartagnan/src/test/resources/VULKAN-Liveness-expected.csv index 2eb3b73162..af7e7c2f1c 100644 --- a/dartagnan/src/test/resources/VULKAN-Liveness-expected.csv +++ b/dartagnan/src/test/resources/VULKAN-Liveness-expected.csv @@ -70,4 +70,8 @@ litmus/VULKAN/CADP/3_threads_4_instructions/103_simple.litmus,1 litmus/VULKAN/CADP/3_threads_4_instructions/104_simple.litmus,1 litmus/VULKAN/Manual/XF-Barrier-relacq.litmus,1 litmus/VULKAN/Manual/XF-Barrier-rlx.litmus,1 -litmus/VULKAN/Manual/XF-Barrier-weak.litmus,0 \ No newline at end of file +litmus/VULKAN/Manual/XF-Barrier-weak.litmus,0 +litmus/VULKAN/Manual/bar-1.litmus,1 +litmus/VULKAN/Manual/bar-2.litmus,0 +litmus/VULKAN/Manual/bar-3.litmus,1 +litmus/VULKAN/Manual/bar-4.litmus,0 \ No newline at end of file diff --git a/dartagnan/src/test/resources/VULKAN-expected.csv b/dartagnan/src/test/resources/VULKAN-expected.csv index c33921ce78..3054c89cf2 100644 --- a/dartagnan/src/test/resources/VULKAN-expected.csv +++ b/dartagnan/src/test/resources/VULKAN-expected.csv @@ -73,7 +73,7 @@ litmus/VULKAN/Kronos-Group/test5.litmus,1 litmus/VULKAN/Kronos-Group/test6.litmus,1 litmus/VULKAN/Kronos-Group/test9.litmus,1 litmus/VULKAN/Kronos-Group/waw.litmus,1 -litmus/VULKAN/Manual/asmo-weak.litmus,0 +litmus/VULKAN/Manual/asmo-plain.litmus,0 litmus/VULKAN/Manual/ticketlock-same-wg.litmus,0 litmus/VULKAN/Manual/ticketlock-diff-wg.litmus,1 litmus/VULKAN/Manual/ticketlock-acq2rlx-1.litmus,0 @@ -86,12 +86,26 @@ litmus/VULKAN/Manual/MP-mesa-optimized.litmus,1 litmus/VULKAN/Manual/MP-avvis.litmus,0 litmus/VULKAN/Manual/MP-no-avvis.litmus,1 litmus/VULKAN/Manual/CoWW-RR.litmus,1 -litmus/VULKAN/Manual/XF-Barrier-relacq.litmus,0 -litmus/VULKAN/Manual/XF-Barrier-rlx.litmus,1 -litmus/VULKAN/Manual/XF-Barrier-weak.litmus,1 litmus/VULKAN/Manual/PC-bar-acq-rel-atom.litmus,1 litmus/VULKAN/Manual/PC-bar-acq-rel-nonpriv.litmus,1 litmus/VULKAN/Manual/PC-bar-acq-rel-priv.litmus,0 litmus/VULKAN/Manual/PC-bar-atom.litmus,0 litmus/VULKAN/Manual/PC-bar-nonpriv.litmus,0 litmus/VULKAN/Manual/OOTA.litmus,1 +litmus/VULKAN/Manual/IRIW.litmus,1 +litmus/VULKAN/Manual/counter-atomic-store-rmw.litmus,1 +litmus/VULKAN/Manual/counter-plain-store-rmw.litmus,0 +litmus/VULKAN/Manual/counter-plain-store-atomic-load.litmus,1 +litmus/VULKAN/Manual/counter-plain-store-plain-load.litmus,1 +litmus/VULKAN/Manual/bar-1.litmus,1 +litmus/VULKAN/Manual/bar-2.litmus,1 +litmus/VULKAN/Manual/bar-3.litmus,1 +litmus/VULKAN/Manual/bar-4.litmus,1 +litmus/VULKAN/Manual/xf-barrier.litmus,1 +litmus/VULKAN/Manual/xf-barrier-cbar-rlx-1.litmus,0 +litmus/VULKAN/Manual/xf-barrier-cbar-rlx-2.litmus,0 +litmus/VULKAN/Manual/xf-barrier-cbar-rlx-3.litmus,0 +litmus/VULKAN/Manual/xf-barrier-load-rlx-1.litmus,0 +litmus/VULKAN/Manual/xf-barrier-load-rlx-2.litmus,0 +litmus/VULKAN/Manual/xf-barrier-store-rlx-1.litmus,0 +litmus/VULKAN/Manual/xf-barrier-store-rlx-2.litmus,0 \ No newline at end of file diff --git a/dartagnan/src/test/resources/parsers/program/spirv/cas_lock.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/cas_lock.spv.dis deleted file mode 100644 index 0bb2834ddf..0000000000 --- a/dartagnan/src/test/resources/parsers/program/spirv/cas_lock.spv.dis +++ /dev/null @@ -1,97 +0,0 @@ -; SPIR-V -; Version: 1.0 -; Generator: Google Clspv; 0 -; Bound: 70 -; Schema: 0 - OpCapability Shader - OpExtension "SPV_KHR_storage_buffer_storage_class" - OpExtension "SPV_KHR_non_semantic_info" - %54 = OpExtInstImport "NonSemantic.ClspvReflection.5" - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %17 "mutex_test" - OpSource OpenCL_C 200 - %55 = OpString "mutex_test" - %56 = OpString " __kernel" - %59 = OpString "l" - %62 = OpString "res" - %65 = OpString "iters" - OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize - OpDecorate %_runtimearr_uint ArrayStride 4 - OpMemberDecorate %_struct_10 0 Offset 0 - OpDecorate %_struct_10 Block - OpDecorate %12 DescriptorSet 0 - OpDecorate %12 Binding 0 - OpDecorate %13 DescriptorSet 0 - OpDecorate %13 Binding 1 - OpDecorate %14 DescriptorSet 0 - OpDecorate %14 Binding 2 - OpDecorate %2 SpecId 0 - OpDecorate %3 SpecId 1 - OpDecorate %4 SpecId 2 - %uint = OpTypeInt 32 0 - %2 = OpSpecConstant %uint 1 - %3 = OpSpecConstant %uint 1 - %4 = OpSpecConstant %uint 1 - %v3uint = OpTypeVector %uint 3 -%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 -%_ptr_Private_v3uint = OpTypePointer Private %v3uint -%_runtimearr_uint = OpTypeRuntimeArray %uint - %_struct_10 = OpTypeStruct %_runtimearr_uint -%_ptr_StorageBuffer__struct_10 = OpTypePointer StorageBuffer %_struct_10 - %void = OpTypeVoid - %16 = OpTypeFunction %void -%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint - %uint_0 = OpConstant %uint 0 - %bool = OpTypeBool - %uint_1 = OpConstant %uint 1 - %uint_72 = OpConstant %uint 72 - %uint_66 = OpConstant %uint 66 - %uint_68 = OpConstant %uint 68 - %uint_3 = OpConstant %uint 3 - %uint_2 = OpConstant %uint 2 - %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize - %12 = OpVariable %_ptr_StorageBuffer__struct_10 StorageBuffer - %13 = OpVariable %_ptr_StorageBuffer__struct_10 StorageBuffer - %14 = OpVariable %_ptr_StorageBuffer__struct_10 StorageBuffer - %17 = OpFunction %void None %16 - %18 = OpLabel - %21 = OpAccessChain %_ptr_StorageBuffer_uint %12 %uint_0 %uint_0 - %22 = OpAccessChain %_ptr_StorageBuffer_uint %13 %uint_0 %uint_0 - %23 = OpAccessChain %_ptr_StorageBuffer_uint %14 %uint_0 %uint_0 - %24 = OpLoad %uint %23 - %26 = OpINotEqual %bool %24 %uint_0 - OpSelectionMerge %53 None - OpBranchConditional %26 %29 %53 - %29 = OpLabel - %30 = OpPhi %uint %47 %43 %uint_0 %18 - OpLoopMerge %51 %43 None - OpBranch %33 - %33 = OpLabel - %37 = OpAtomicCompareExchange %uint %21 %uint_1 %uint_72 %uint_66 %uint_1 %uint_0 - %38 = OpIEqual %bool %37 %uint_0 - OpLoopMerge %41 %33 None - OpBranchConditional %38 %41 %33 - %41 = OpLabel - OpBranch %43 - %43 = OpLabel - %44 = OpLoad %uint %22 - %45 = OpIAdd %uint %44 %uint_1 - OpStore %22 %45 - OpAtomicStore %21 %uint_1 %uint_68 %uint_0 - %47 = OpIAdd %uint %30 %uint_1 - %48 = OpLoad %uint %23 - %49 = OpUGreaterThanEqual %bool %47 %48 - OpBranchConditional %49 %51 %29 - %51 = OpLabel - OpBranch %53 - %53 = OpLabel - OpReturn - OpFunctionEnd - %58 = OpExtInst %void %54 Kernel %17 %55 %uint_3 %uint_0 %56 - %60 = OpExtInst %void %54 ArgumentInfo %59 - %61 = OpExtInst %void %54 ArgumentStorageBuffer %58 %uint_0 %uint_0 %uint_0 %60 - %63 = OpExtInst %void %54 ArgumentInfo %62 - %64 = OpExtInst %void %54 ArgumentStorageBuffer %58 %uint_1 %uint_0 %uint_1 %63 - %66 = OpExtInst %void %54 ArgumentInfo %65 - %68 = OpExtInst %void %54 ArgumentStorageBuffer %58 %uint_2 %uint_0 %uint_2 %66 - %69 = OpExtInst %void %54 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/parsers/program/spirv/invalid/malformed-loop-merge-true-label.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/invalid/malformed-loop-merge-true-label.spv.dis new file mode 100644 index 0000000000..cd4f3d23eb --- /dev/null +++ b/dartagnan/src/test/resources/parsers/program/spirv/invalid/malformed-loop-merge-true-label.spv.dis @@ -0,0 +1,19 @@ +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %main = OpFunction %void None %func + %label1 = OpLabel + %value1 = OpConstantTrue %bool + OpLoopMerge %label2 %label1 None + OpBranchConditional %value1 %label2 %label1 + %value2 = OpLogicalNot %bool %value1 ; illegal + %label2 = OpLabel + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/parsers/program/spirv/invalid/malformed-loop-merge.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/invalid/malformed-loop-merge.spv.dis new file mode 100644 index 0000000000..0d549158b0 --- /dev/null +++ b/dartagnan/src/test/resources/parsers/program/spirv/invalid/malformed-loop-merge.spv.dis @@ -0,0 +1,19 @@ +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %main = OpFunction %void None %func + %label1 = OpLabel + %value1 = OpConstantTrue %bool + OpLoopMerge %label2 %label1 None + %value2 = OpLogicalNot %bool %value1 ; illegal + OpBranchConditional %value1 %label2 %label1 + %label2 = OpLabel + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/parsers/program/spirv/invalid/malformed-selection-merge-label.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/invalid/malformed-selection-merge-label.spv.dis new file mode 100644 index 0000000000..b842c823a7 --- /dev/null +++ b/dartagnan/src/test/resources/parsers/program/spirv/invalid/malformed-selection-merge-label.spv.dis @@ -0,0 +1,21 @@ +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %value1 = OpConstantTrue %bool + %main = OpFunction %void None %func + %label0 = OpLabel + OpSelectionMerge %label2 None + OpBranchConditional %value1 %label1 %label2 + %value2 = OpLogicalNot %bool %value1 ; illegal + %label1 = OpLabel + OpBranch %label2 + %label2 = OpLabel + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/parsers/program/spirv/invalid/malformed-selection-merge.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/invalid/malformed-selection-merge.spv.dis new file mode 100644 index 0000000000..d16096c604 --- /dev/null +++ b/dartagnan/src/test/resources/parsers/program/spirv/invalid/malformed-selection-merge.spv.dis @@ -0,0 +1,21 @@ +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %value1 = OpConstantTrue %bool + %main = OpFunction %void None %func + %label0 = OpLabel + OpSelectionMerge %label2 None + %value2 = OpLogicalNot %bool %value1 ; illegal + OpBranchConditional %value1 %label1 %label2 + %label1 = OpLabel + OpBranch %label2 + %label2 = OpLabel + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/parsers/program/spirv/ticket_lock.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/ticket_lock.spv.dis deleted file mode 100644 index 5bcc01957a..0000000000 --- a/dartagnan/src/test/resources/parsers/program/spirv/ticket_lock.spv.dis +++ /dev/null @@ -1,113 +0,0 @@ -; SPIR-V -; Version: 1.0 -; Generator: Google Clspv; 0 -; Bound: 80 -; Schema: 0 - OpCapability Shader - OpExtension "SPV_KHR_storage_buffer_storage_class" - OpExtension "SPV_KHR_non_semantic_info" - %60 = OpExtInstImport "NonSemantic.ClspvReflection.5" - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %18 "mutex_test" - OpSource OpenCL_C 200 - %61 = OpString "mutex_test" - %62 = OpString " __kernel" - %65 = OpString "now_serving" - %68 = OpString "res" - %71 = OpString "iters" - %75 = OpString "next_ticket" - OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize - OpDecorate %_runtimearr_uint ArrayStride 4 - OpMemberDecorate %_struct_10 0 Offset 0 - OpDecorate %_struct_10 Block - OpDecorate %12 DescriptorSet 0 - OpDecorate %12 Binding 0 - OpDecorate %12 Coherent - OpDecorate %13 DescriptorSet 0 - OpDecorate %13 Binding 1 - OpDecorate %13 Coherent - OpDecorate %14 DescriptorSet 0 - OpDecorate %14 Binding 2 - OpDecorate %15 DescriptorSet 0 - OpDecorate %15 Binding 3 - OpDecorate %15 Coherent - OpDecorate %2 SpecId 0 - OpDecorate %3 SpecId 1 - OpDecorate %4 SpecId 2 - %uint = OpTypeInt 32 0 - %2 = OpSpecConstant %uint 1 - %3 = OpSpecConstant %uint 1 - %4 = OpSpecConstant %uint 1 - %v3uint = OpTypeVector %uint 3 -%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 -%_ptr_Private_v3uint = OpTypePointer Private %v3uint -%_runtimearr_uint = OpTypeRuntimeArray %uint - %_struct_10 = OpTypeStruct %_runtimearr_uint -%_ptr_StorageBuffer__struct_10 = OpTypePointer StorageBuffer %_struct_10 - %void = OpTypeVoid - %17 = OpTypeFunction %void -%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint - %uint_0 = OpConstant %uint 0 - %bool = OpTypeBool - %uint_1 = OpConstant %uint 1 - %uint_64 = OpConstant %uint 64 - %uint_72 = OpConstant %uint 72 - %uint_66 = OpConstant %uint 66 - %uint_68 = OpConstant %uint 68 - %uint_4 = OpConstant %uint 4 - %uint_2 = OpConstant %uint 2 - %uint_3 = OpConstant %uint 3 - %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize - %12 = OpVariable %_ptr_StorageBuffer__struct_10 StorageBuffer - %13 = OpVariable %_ptr_StorageBuffer__struct_10 StorageBuffer - %14 = OpVariable %_ptr_StorageBuffer__struct_10 StorageBuffer - %15 = OpVariable %_ptr_StorageBuffer__struct_10 StorageBuffer - %18 = OpFunction %void None %17 - %19 = OpLabel - %22 = OpAccessChain %_ptr_StorageBuffer_uint %12 %uint_0 %uint_0 - %23 = OpAccessChain %_ptr_StorageBuffer_uint %13 %uint_0 %uint_0 - %24 = OpAccessChain %_ptr_StorageBuffer_uint %14 %uint_0 %uint_0 - %25 = OpAccessChain %_ptr_StorageBuffer_uint %15 %uint_0 %uint_0 - %26 = OpLoad %uint %24 - %28 = OpINotEqual %bool %26 %uint_0 - OpSelectionMerge %59 None - OpBranchConditional %28 %31 %59 - %31 = OpLabel - %32 = OpPhi %uint %53 %47 %uint_0 %19 - OpMemoryBarrier %uint_1 %uint_64 - %36 = OpAtomicIAdd %uint %25 %uint_1 %uint_72 %uint_1 - OpLoopMerge %57 %47 None - OpBranch %39 - %39 = OpLabel - %41 = OpAtomicLoad %uint %22 %uint_1 %uint_66 - %42 = OpIEqual %bool %41 %36 - OpLoopMerge %45 %39 None - OpBranchConditional %42 %45 %39 - %45 = OpLabel - OpBranch %47 - %47 = OpLabel - %48 = OpLoad %uint %23 - %49 = OpIAdd %uint %48 %uint_1 - OpStore %23 %49 - %50 = OpAtomicLoad %uint %22 %uint_1 %uint_66 - %51 = OpIAdd %uint %50 %uint_1 - OpAtomicStore %22 %uint_1 %uint_68 %51 - %53 = OpIAdd %uint %32 %uint_1 - %54 = OpLoad %uint %24 - %55 = OpUGreaterThanEqual %bool %53 %54 - OpBranchConditional %55 %57 %31 - %57 = OpLabel - OpBranch %59 - %59 = OpLabel - OpReturn - OpFunctionEnd - %64 = OpExtInst %void %60 Kernel %18 %61 %uint_4 %uint_0 %62 - %66 = OpExtInst %void %60 ArgumentInfo %65 - %67 = OpExtInst %void %60 ArgumentStorageBuffer %64 %uint_0 %uint_0 %uint_0 %66 - %69 = OpExtInst %void %60 ArgumentInfo %68 - %70 = OpExtInst %void %60 ArgumentStorageBuffer %64 %uint_1 %uint_0 %uint_1 %69 - %72 = OpExtInst %void %60 ArgumentInfo %71 - %74 = OpExtInst %void %60 ArgumentStorageBuffer %64 %uint_2 %uint_0 %uint_2 %72 - %76 = OpExtInst %void %60 ArgumentInfo %75 - %78 = OpExtInst %void %60 ArgumentStorageBuffer %64 %uint_3 %uint_0 %uint_3 %76 - %79 = OpExtInst %void %60 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/parsers/program/spirv/2+2-write-rel.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/2+2-write-rel.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/2+2-write-rel.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/2+2-write-rel.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/2+2-write-results.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/2+2-write-results.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/2+2-write-results.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/2+2-write-results.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/2+2-write.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/2+2-write.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/2+2-write.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/2+2-write.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/compute.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/compute.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/compute.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/compute.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/valid/fibonacci.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/fibonacci.spv.dis new file mode 100644 index 0000000000..2e50cb6e7f --- /dev/null +++ b/dartagnan/src/test/resources/parsers/program/spirv/valid/fibonacci.spv.dis @@ -0,0 +1,125 @@ +; @Input: %_ = {{0, 1, 2, 3, 4, 5, 6, 7}} +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 72 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %fibonacci_u1_ "fibonacci(u1;" + OpName %n "n" + OpName %curr "curr" + OpName %prev "prev" + OpName %i "i" + OpName %temp "temp" + OpName %index "index" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %BUFFER_ELEMENTS "BUFFER_ELEMENTS" + OpName %Pos "Pos" + OpMemberName %Pos 0 "values" + OpName %_ "" + OpName %param "param" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %BUFFER_ELEMENTS SpecId 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %Pos 0 Offset 0 + OpDecorate %Pos BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %8 = OpTypeFunction %uint %_ptr_Function_uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%BUFFER_ELEMENTS = OpSpecConstant %uint 32 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %Pos = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform_Pos = OpTypePointer Uniform %Pos + %_ = OpVariable %_ptr_Uniform_Pos Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %main = OpFunction %void None %3 + %5 = OpLabel + %index = OpVariable %_ptr_Function_uint Function + %param = OpVariable %_ptr_Function_uint Function + %51 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %52 = OpLoad %uint %51 + OpStore %index %52 + %53 = OpLoad %uint %index + %55 = OpUGreaterThanEqual %bool %53 %BUFFER_ELEMENTS + OpSelectionMerge %57 None + OpBranchConditional %55 %56 %57 + %56 = OpLabel + OpReturn + %57 = OpLabel + %64 = OpLoad %uint %index + %65 = OpLoad %uint %index + %68 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %65 + %69 = OpLoad %uint %68 + OpStore %param %69 + %70 = OpFunctionCall %uint %fibonacci_u1_ %param + %71 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %64 + OpStore %71 %70 + OpReturn + OpFunctionEnd +%fibonacci_u1_ = OpFunction %uint None %8 + %n = OpFunctionParameter %_ptr_Function_uint + %11 = OpLabel + %curr = OpVariable %_ptr_Function_uint Function + %prev = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_uint Function + %temp = OpVariable %_ptr_Function_uint Function + %12 = OpLoad %uint %n + %15 = OpULessThanEqual %bool %12 %uint_1 + OpSelectionMerge %17 None + OpBranchConditional %15 %16 %17 + %16 = OpLabel + %18 = OpLoad %uint %n + OpReturnValue %18 + %17 = OpLabel + OpStore %curr %uint_1 + OpStore %prev %uint_1 + OpStore %i %uint_2 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %uint %i + %30 = OpLoad %uint %n + %31 = OpULessThan %bool %29 %30 + OpBranchConditional %31 %25 %26 + %25 = OpLabel + %33 = OpLoad %uint %curr + OpStore %temp %33 + %34 = OpLoad %uint %prev + %35 = OpLoad %uint %curr + %36 = OpIAdd %uint %35 %34 + OpStore %curr %36 + %37 = OpLoad %uint %temp + OpStore %prev %37 + OpBranch %27 + %27 = OpLabel + %38 = OpLoad %uint %i + %41 = OpIAdd %uint %38 %int_1 + OpStore %i %41 + OpBranch %24 + %26 = OpLabel + %42 = OpLoad %uint %curr + OpReturnValue %42 + OpFunctionEnd diff --git a/dartagnan/src/test/resources/parsers/program/spirv/global_barrier.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/global_barrier.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/global_barrier.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/global_barrier.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/iriw-acq-rel.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/iriw-acq-rel.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/iriw-acq-rel.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/iriw-acq-rel.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/iriw-acq.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/iriw-acq.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/iriw-acq.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/iriw-acq.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/iriw-results.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/iriw-results.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/iriw-results.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/iriw-results.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/iriw-sequentialized.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/iriw-sequentialized.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/iriw-sequentialized.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/iriw-sequentialized.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/iriw.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/iriw.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/iriw.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/iriw.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/isa2-acq.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/isa2-acq.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/isa2-acq.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/isa2-acq.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/isa2-addr-dep.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/isa2-addr-dep.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/isa2-addr-dep.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/isa2-addr-dep.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/isa2-rel-data-acq.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/isa2-rel-data-acq.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/isa2-rel-data-acq.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/isa2-rel-data-acq.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/isa2-rel-data-addr.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/isa2-rel-data-addr.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/isa2-rel-data-addr.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/isa2-rel-data-addr.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/isa2-results.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/isa2-results.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/isa2-results.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/isa2-results.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/isa2.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/isa2.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/isa2.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/isa2.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/load-buffer-acq-rel.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/load-buffer-acq-rel.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/load-buffer-acq-rel.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/load-buffer-acq-rel.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/load-buffer-cond.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/load-buffer-cond.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/load-buffer-cond.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/load-buffer-cond.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/load-buffer-results.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/load-buffer-results.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/load-buffer-results.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/load-buffer-results.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/load-buffer.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/load-buffer.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/load-buffer.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/load-buffer.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/message-passing-results.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/message-passing-results.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/message-passing-results.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/message-passing-results.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/message-passing.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/message-passing.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/message-passing.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/message-passing.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/primitive_barrier.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/primitive_barrier.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/primitive_barrier.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/primitive_barrier.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/rr-mem-device-scope-device.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/rr-mem-device-scope-device.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/rr-mem-device-scope-device.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/rr-mem-device-scope-device.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/rr-results.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/rr-results.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/rr-results.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/rr-results.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/shader.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/shader.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/shader.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/shader.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/store-buffer-acq-rel.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/store-buffer-acq-rel.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/store-buffer-acq-rel.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/store-buffer-acq-rel.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/store-buffer-results.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/store-buffer-results.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/store-buffer-results.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/store-buffer-results.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/store-buffer-rmw-acq-rel.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/store-buffer-rmw-acq-rel.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/store-buffer-rmw-acq-rel.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/store-buffer-rmw-acq-rel.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/store-buffer-rmw.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/store-buffer-rmw.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/store-buffer-rmw.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/store-buffer-rmw.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/store-buffer.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/store-buffer.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/store-buffer.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/store-buffer.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/wrc-acq.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/wrc-acq.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/wrc-acq.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/wrc-acq.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/wrc-addr-dep.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/wrc-addr-dep.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/wrc-addr-dep.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/wrc-addr-dep.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/wrc-rel-acq.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/wrc-rel-acq.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/wrc-rel-acq.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/wrc-rel-acq.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/wrc-results.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/wrc-results.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/wrc-results.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/wrc-results.spv.dis diff --git a/dartagnan/src/test/resources/parsers/program/spirv/wrc.spv.dis b/dartagnan/src/test/resources/parsers/program/spirv/valid/wrc.spv.dis similarity index 100% rename from dartagnan/src/test/resources/parsers/program/spirv/wrc.spv.dis rename to dartagnan/src/test/resources/parsers/program/spirv/valid/wrc.spv.dis diff --git a/dartagnan/src/test/resources/spirv/basic/array-of-vector.spv.dis b/dartagnan/src/test/resources/spirv/basic/array-of-vector.spv.dis new file mode 100644 index 0000000000..f32d02edf1 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/array-of-vector.spv.dis @@ -0,0 +1,31 @@ +; @Output: forall (%v3v[0][0]==0 and %v3v[1][0]==1 and %v3v[2][0]==2) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %func = OpTypeFunction %void + %uint = OpTypeInt 64 0 + %v1uint = OpTypeVector %uint 1 + %c3 = OpConstant %uint 3 + %v3v1uint = OpTypeArray %v1uint %c3 + %ptr_v3v1uint = OpTypePointer Uniform %v3v1uint + %ptr_uint = OpTypePointer Uniform %uint + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %v3v = OpVariable %ptr_v3v1uint Uniform + %main = OpFunction %void None %func + %label = OpLabel + %el0 = OpAccessChain %ptr_uint %v3v %c0 %c0 + %el1 = OpAccessChain %ptr_uint %v3v %c1 %c0 + %el2 = OpAccessChain %ptr_uint %v3v %c2 %c0 + OpStore %el0 %c0 + OpStore %el1 %c1 + OpStore %el2 %c2 + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/array-of-vector1.spv.dis b/dartagnan/src/test/resources/spirv/basic/array-of-vector1.spv.dis new file mode 100644 index 0000000000..4e868d6b22 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/array-of-vector1.spv.dis @@ -0,0 +1,31 @@ +; @Output: forall (%v3v[0][0]==0 and %v3v[1][0]==1 and %v3v[1][1]==2) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %func = OpTypeFunction %void + %uint = OpTypeInt 64 0 + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %v1uint = OpTypeVector %uint 1 + %v2uint = OpTypeArray %uint %c2 + %struct = OpTypeStruct %v1uint %v2uint + %ptr_struct = OpTypePointer Uniform %struct + %ptr_uint = OpTypePointer Uniform %uint + %v3v = OpVariable %ptr_struct Uniform + %main = OpFunction %void None %func + %label = OpLabel + %el0 = OpAccessChain %ptr_uint %v3v %c0 %c0 + %el1 = OpAccessChain %ptr_uint %v3v %c1 %c0 + %el2 = OpAccessChain %ptr_uint %v3v %c1 %c1 + OpStore %el0 %c0 + OpStore %el1 %c1 + OpStore %el2 %c2 + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/array.spv.dis b/dartagnan/src/test/resources/spirv/basic/array.spv.dis new file mode 100644 index 0000000000..1b940fe995 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/array.spv.dis @@ -0,0 +1,30 @@ +; @Output: forall (%v3v[0]==0 and %v3v[1]==1 and %v3v[2]==2) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %func = OpTypeFunction %void + %uint = OpTypeInt 64 0 + %c3 = OpConstant %uint 3 + %v3uint = OpTypeArray %uint %c3 + %ptr_v3uint = OpTypePointer Uniform %v3uint + %ptr_uint = OpTypePointer Uniform %uint + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %v3v = OpVariable %ptr_v3uint Uniform + %main = OpFunction %void None %func + %label = OpLabel + %el0 = OpAccessChain %ptr_uint %v3v %c0 + %el1 = OpAccessChain %ptr_uint %v3v %c1 + %el2 = OpAccessChain %ptr_uint %v3v %c2 + OpStore %el0 %c0 + OpStore %el1 %c1 + OpStore %el2 %c2 + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/branch-cond-bf.spv.dis b/dartagnan/src/test/resources/spirv/basic/branch-cond-bf.spv.dis new file mode 100644 index 0000000000..49a4cfd06d --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/branch-cond-bf.spv.dis @@ -0,0 +1,46 @@ +; @Input: %out = {0, 0} +; @Output: forall (%out[0]==2 and %out[1]==1) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + OpDecorate %ids BuiltIn GlobalInvocationId + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %v2uint = OpTypeVector %uint 2 + %ptr_uint = OpTypePointer Private %uint + %ptr_v3uint = OpTypePointer Input %v3uint + %ptr_v2uint = OpTypePointer Output %v2uint + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %ids = OpVariable %ptr_v3uint Input + %out = OpVariable %ptr_v2uint Output + %main = OpFunction %void None %func + + %label_1 = OpLabel + %id_ptr = OpAccessChain %ptr_uint %ids %c0 + %id = OpLoad %uint %id_ptr + %ptr_out = OpAccessChain %ptr_uint %out %id + OpBranch %label_2 + + %label_2 = OpLabel + %val = OpLoad %uint %ptr_out + %val_new = OpIAdd %uint %val %c1 + OpStore %ptr_out %val_new + %cond_ret = OpULessThanEqual %bool %val_new %c1 + OpBranchConditional %cond_ret %label_3 %label_4 + + %label_3 = OpLabel + %cond = OpIEqual %bool %id %c0 + OpBranchConditional %cond %label_2 %label_4 + + %label_4 = OpLabel + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/branch-cond-fb.spv.dis b/dartagnan/src/test/resources/spirv/basic/branch-cond-fb.spv.dis new file mode 100644 index 0000000000..73e3a83121 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/branch-cond-fb.spv.dis @@ -0,0 +1,46 @@ +; @Input: %out = {0, 0} +; @Output: forall (%out[0]==2 and %out[1]==1) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + OpDecorate %ids BuiltIn GlobalInvocationId + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %v2uint = OpTypeVector %uint 2 + %ptr_uint = OpTypePointer Private %uint + %ptr_v3uint = OpTypePointer Input %v3uint + %ptr_v2uint = OpTypePointer Output %v2uint + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %ids = OpVariable %ptr_v3uint Input + %out = OpVariable %ptr_v2uint Output + %main = OpFunction %void None %func + + %label_1 = OpLabel + %id_ptr = OpAccessChain %ptr_uint %ids %c0 + %id = OpLoad %uint %id_ptr + %ptr_out = OpAccessChain %ptr_uint %out %id + OpBranch %label_2 + + %label_2 = OpLabel + %val = OpLoad %uint %ptr_out + %val_new = OpIAdd %uint %val %c1 + OpStore %ptr_out %val_new + %cond_ret = OpUGreaterThan %bool %val_new %c1 + OpBranchConditional %cond_ret %label_4 %label_3 + + %label_3 = OpLabel + %cond = OpIEqual %bool %id %c0 + OpBranchConditional %cond %label_2 %label_4 + + %label_4 = OpLabel + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/branch-cond-ff-inverted.spv.dis b/dartagnan/src/test/resources/spirv/basic/branch-cond-ff-inverted.spv.dis new file mode 100644 index 0000000000..9aa15df295 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/branch-cond-ff-inverted.spv.dis @@ -0,0 +1,39 @@ +; @Input: %out = {0, 0} +; @Output: forall (%out[0]==2 and %out[1]==1) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + OpDecorate %ids BuiltIn GlobalInvocationId + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %v2uint = OpTypeVector %uint 2 + %ptr_uint = OpTypePointer Private %uint + %ptr_v3uint = OpTypePointer Input %v3uint + %ptr_v2uint = OpTypePointer Output %v2uint + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %ids = OpVariable %ptr_v3uint Input + %out = OpVariable %ptr_v2uint Output + %main = OpFunction %void None %func + %label_1 = OpLabel + %id_ptr = OpAccessChain %ptr_uint %ids %c0 + %id = OpLoad %uint %id_ptr + %ptr_out = OpAccessChain %ptr_uint %out %id + %cond = OpIEqual %bool %id %c0 + OpBranchConditional %cond %label_3 %label_2 + %label_2 = OpLabel + OpStore %ptr_out %c1 + OpReturn + %label_3 = OpLabel + OpStore %ptr_out %c2 + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/branch-cond-ff.spv.dis b/dartagnan/src/test/resources/spirv/basic/branch-cond-ff.spv.dis new file mode 100644 index 0000000000..2662f7d997 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/branch-cond-ff.spv.dis @@ -0,0 +1,39 @@ +; @Input: %out = {0, 0} +; @Output: forall (%out[0]==1 and %out[1]==2) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + OpDecorate %ids BuiltIn GlobalInvocationId + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %v2uint = OpTypeVector %uint 2 + %ptr_uint = OpTypePointer Private %uint + %ptr_v3uint = OpTypePointer Input %v3uint + %ptr_v2uint = OpTypePointer Output %v2uint + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %ids = OpVariable %ptr_v3uint Input + %out = OpVariable %ptr_v2uint Output + %main = OpFunction %void None %func + %label_1 = OpLabel + %id_ptr = OpAccessChain %ptr_uint %ids %c0 + %id = OpLoad %uint %id_ptr + %ptr_out = OpAccessChain %ptr_uint %out %id + %cond = OpIEqual %bool %id %c0 + OpBranchConditional %cond %label_2 %label_3 + %label_2 = OpLabel + OpStore %ptr_out %c1 + OpReturn + %label_3 = OpLabel + OpStore %ptr_out %c2 + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/branch-cond-struct-read-write.spv.dis b/dartagnan/src/test/resources/spirv/basic/branch-cond-struct-read-write.spv.dis new file mode 100644 index 0000000000..99ee9e0489 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/branch-cond-struct-read-write.spv.dis @@ -0,0 +1,45 @@ +; @Input: %out = {0, 0} +; @Output: forall (%out[0]==11 and %out[1]==22) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + OpDecorate %ids BuiltIn GlobalInvocationId + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %v2uint = OpTypeVector %uint 2 + %ptr_uint = OpTypePointer Private %uint + %ptr_v3uint = OpTypePointer Input %v3uint + %ptr_v2uint = OpTypePointer Output %v2uint + %c0 = OpConstant %uint 0 + %c11 = OpConstant %uint 11 + %c22 = OpConstant %uint 22 + %ids = OpVariable %ptr_v3uint Input + %out = OpVariable %ptr_v2uint Output + %main = OpFunction %void None %func + %label_1 = OpLabel + %id_ptr = OpAccessChain %ptr_uint %ids %c0 + %id = OpLoad %uint %id_ptr + %local = OpVariable %ptr_uint Private %c0 + %cond = OpUGreaterThan %bool %id %c0 + OpSelectionMerge %label_3 None + OpBranchConditional %cond %label_2 %label_3 + %label_2 = OpLabel + OpStore %local %c22 + OpBranch %label_4 + %label_3 = OpLabel + OpStore %local %c11 + OpBranch %label_4 + %label_4 = OpLabel + %value = OpLoad %uint %local + %ptr_out = OpAccessChain %ptr_uint %out %id + OpStore %ptr_out %value + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/branch-cond-struct.spv.dis b/dartagnan/src/test/resources/spirv/basic/branch-cond-struct.spv.dis new file mode 100644 index 0000000000..76c5f34f9e --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/branch-cond-struct.spv.dis @@ -0,0 +1,40 @@ +; @Input: %out = {0, 0} +; @Output: forall (%out[0]==11 and %out[1]==22) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + OpDecorate %ids BuiltIn GlobalInvocationId + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %v2uint = OpTypeVector %uint 2 + %ptr_uint = OpTypePointer Private %uint + %ptr_v3uint = OpTypePointer Input %v3uint + %ptr_v2uint = OpTypePointer Output %v2uint + %c0 = OpConstant %uint 0 + %c11 = OpConstant %uint 11 + %c22 = OpConstant %uint 22 + %ids = OpVariable %ptr_v3uint Input + %out = OpVariable %ptr_v2uint Output + %main = OpFunction %void None %func + %label = OpLabel + %id_ptr = OpAccessChain %ptr_uint %ids %c0 + %id = OpLoad %uint %id_ptr + %ptr_out = OpAccessChain %ptr_uint %out %id + %cond = OpUGreaterThan %bool %id %c0 + OpSelectionMerge %l_false None + OpBranchConditional %cond %l_true %l_false + %l_true = OpLabel + OpStore %ptr_out %c22 + OpReturn + %l_false = OpLabel + OpStore %ptr_out %c11 + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/branch-loop.spv.dis b/dartagnan/src/test/resources/spirv/basic/branch-loop.spv.dis new file mode 100644 index 0000000000..5b799532e2 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/branch-loop.spv.dis @@ -0,0 +1,34 @@ +; @Input: %out = 0 +; @Output: forall (%out==3) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + OpDecorate %ids BuiltIn GlobalInvocationId + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 64 0 + %v3uint = OpTypeVector %uint 3 + %ptr_uint = OpTypePointer Output %uint + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %out = OpVariable %ptr_uint Output + %main = OpFunction %void None %func + %label_1 = OpLabel + %val = OpLoad %uint %out + %val_new = OpIAdd %uint %val %c1 + OpStore %out %val_new + %cond = OpUGreaterThan %bool %val_new %c2 + OpSelectionMerge %label_3 None + OpBranchConditional %cond %label_2 %label_3 + %label_2 = OpLabel + OpReturn + %label_3 = OpLabel + OpBranch %label_1 + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/branch-race.spv.dis b/dartagnan/src/test/resources/spirv/basic/branch-race.spv.dis new file mode 100644 index 0000000000..52b1b40be9 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/branch-race.spv.dis @@ -0,0 +1,37 @@ +; @Input: %out = 0 +; @Output: forall (%out==11 or %out==22) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + OpDecorate %ids BuiltIn GlobalInvocationId + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %ptr_uint = OpTypePointer Output %uint + %ptr_v3uint = OpTypePointer Input %v3uint + %c0 = OpConstant %uint 0 + %c11 = OpConstant %uint 11 + %c22 = OpConstant %uint 22 + %ids = OpVariable %ptr_v3uint Input + %out = OpVariable %ptr_uint Output + %main = OpFunction %void None %func + %label = OpLabel + %id_ptr = OpAccessChain %ptr_uint %ids %c0 + %id = OpLoad %uint %id_ptr + %cond = OpUGreaterThan %bool %id %c0 + OpSelectionMerge %l_false None + OpBranchConditional %cond %l_true %l_false + %l_true = OpLabel + OpStore %out %c22 + OpReturn + %l_false = OpLabel + OpStore %out %c11 + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/builtin-all-123.spv.dis b/dartagnan/src/test/resources/spirv/basic/builtin-all-123.spv.dis new file mode 100644 index 0000000000..1f4759b2be --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/builtin-all-123.spv.dis @@ -0,0 +1,152 @@ +; @Output: forall (%out_SubgroupLocalInvocationId==0) + +; @Output: forall (%out_LocalInvocationId[0]>=0 and %out_LocalInvocationId[0]<=1) +; @Output: forall (%out_LocalInvocationId[1]==0) +; @Output: forall (%out_LocalInvocationId[2]==0) + +; @Output: forall (%out_LocalInvocationIndex>=0 and %out_LocalInvocationIndex<=1) + +; @Output: forall (%out_GlobalInvocationId[0]>=0 and %out_GlobalInvocationId[0]<=5) +; @Output: forall (%out_GlobalInvocationId[1]==0) +; @Output: forall (%out_GlobalInvocationId[2]==0) + +; @Output: forall (%out_DeviceIndex==0) + +; @Output: forall (%out_SubgroupId==0 or %out_SubgroupId==1) + +; @Output: forall (%out_WorkgroupId[0]>=0 and %out_WorkgroupId[0]<=2) +; @Output: forall (%out_WorkgroupId[1]==0) +; @Output: forall (%out_WorkgroupId[2]==0) + +; @Output: forall (%out_SubgroupSize==1) + +; @Output: forall (%out_WorkgroupSize[0]==2) +; @Output: forall (%out_WorkgroupSize[1]==1) +; @Output: forall (%out_WorkgroupSize[2]==1) + +; @Config: 1, 2, 3 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + OpDecorate %gl_SubgroupLocalInvocationId BuiltIn SubgroupLocalInvocationId + OpDecorate %gl_LocalInvocationId BuiltIn LocalInvocationId + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %gl_DeviceIndex BuiltIn DeviceIndex + OpDecorate %gl_SubgroupId BuiltIn SubgroupId + OpDecorate %gl_WorkgroupId BuiltIn WorkgroupId + OpDecorate %gl_SubgroupSize BuiltIn SubgroupSize + OpDecorate %gl_WorkgroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %func = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %ptr_uint = OpTypePointer Uniform %uint + %_ptr_Input_uint = OpTypePointer Input %uint + %_ptr_Output_uint = OpTypePointer Output %uint + %_ptr_Input_v3uint = OpTypePointer Input %v3uint + %_ptr_Output_v3uint = OpTypePointer Output %v3uint + + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %c64 = OpConstant %uint 64 + %init = OpConstant %uint 999 + %v3init = OpConstantComposite %v3uint %init %init %init + + %gl_SubgroupLocalInvocationId = OpVariable %_ptr_Input_uint Input + %gl_LocalInvocationId = OpVariable %_ptr_Input_v3uint Input + %gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input + %gl_GlobalInvocationId = OpVariable %_ptr_Input_v3uint Input + %gl_DeviceIndex = OpVariable %_ptr_Input_uint Input + %gl_SubgroupId = OpVariable %_ptr_Input_uint Input + %gl_WorkgroupId = OpVariable %_ptr_Input_v3uint Input + %gl_SubgroupSize = OpVariable %_ptr_Input_uint Input + %gl_WorkgroupSize = OpVariable %_ptr_Input_v3uint Input + +%out_SubgroupLocalInvocationId = OpVariable %_ptr_Output_uint Output %init + %out_LocalInvocationId = OpVariable %_ptr_Output_v3uint Output %v3init + %out_LocalInvocationIndex = OpVariable %_ptr_Output_uint Output %init + %out_GlobalInvocationId = OpVariable %_ptr_Output_v3uint Output %v3init + %out_DeviceIndex = OpVariable %_ptr_Output_uint Output %init + %out_SubgroupId = OpVariable %_ptr_Output_uint Output %init + %out_WorkgroupId = OpVariable %_ptr_Output_v3uint Output %v3init + %out_SubgroupSize = OpVariable %_ptr_Output_uint Output %init + %out_WorkgroupSize = OpVariable %_ptr_Output_v3uint Output %v3init + + %main = OpFunction %void None %func + %label = OpLabel + +%in_SubgroupLocalInvocationId = OpLoad %uint %gl_SubgroupLocalInvocationId + OpAtomicStore %out_SubgroupLocalInvocationId %c1 %c64 %in_SubgroupLocalInvocationId + + %in0_ptr_LocalInvocationId = OpAccessChain %ptr_uint %gl_LocalInvocationId %c0 + %in1_ptr_LocalInvocationId = OpAccessChain %ptr_uint %gl_LocalInvocationId %c1 + %in2_ptr_LocalInvocationId = OpAccessChain %ptr_uint %gl_LocalInvocationId %c2 + %v0_LocalInvocationId = OpLoad %uint %in0_ptr_LocalInvocationId + %v1_LocalInvocationId = OpLoad %uint %in1_ptr_LocalInvocationId + %v2_LocalInvocationId = OpLoad %uint %in2_ptr_LocalInvocationId + %out0_ptr_LocalInvocationId = OpAccessChain %ptr_uint %out_LocalInvocationId %c0 + %out1_ptr_LocalInvocationId = OpAccessChain %ptr_uint %out_LocalInvocationId %c1 + %out2_ptr_LocalInvocationId = OpAccessChain %ptr_uint %out_LocalInvocationId %c2 + OpAtomicStore %out0_ptr_LocalInvocationId %c1 %c64 %v0_LocalInvocationId + OpAtomicStore %out1_ptr_LocalInvocationId %c1 %c64 %v1_LocalInvocationId + OpAtomicStore %out2_ptr_LocalInvocationId %c1 %c64 %v2_LocalInvocationId + + %in_LocalInvocationIndex = OpLoad %uint %gl_LocalInvocationIndex + OpAtomicStore %out_LocalInvocationIndex %c1 %c64 %in_LocalInvocationIndex + + %in0_ptr_GlobalInvocationId = OpAccessChain %ptr_uint %gl_GlobalInvocationId %c0 + %in1_ptr_GlobalInvocationId = OpAccessChain %ptr_uint %gl_GlobalInvocationId %c1 + %in2_ptr_GlobalInvocationId = OpAccessChain %ptr_uint %gl_GlobalInvocationId %c2 + %v0_GlobalInvocationId = OpLoad %uint %in0_ptr_GlobalInvocationId + %v1_GlobalInvocationId = OpLoad %uint %in1_ptr_GlobalInvocationId + %v2_GlobalInvocationId = OpLoad %uint %in2_ptr_GlobalInvocationId + %out0_ptr_GlobalInvocationId = OpAccessChain %ptr_uint %out_GlobalInvocationId %c0 + %out1_ptr_GlobalInvocationId = OpAccessChain %ptr_uint %out_GlobalInvocationId %c1 + %out2_ptr_GlobalInvocationId = OpAccessChain %ptr_uint %out_GlobalInvocationId %c2 + OpAtomicStore %out0_ptr_GlobalInvocationId %c1 %c64 %v0_GlobalInvocationId + OpAtomicStore %out1_ptr_GlobalInvocationId %c1 %c64 %v1_GlobalInvocationId + OpAtomicStore %out2_ptr_GlobalInvocationId %c1 %c64 %v2_GlobalInvocationId + + %in_DeviceIndex = OpLoad %uint %gl_DeviceIndex + OpAtomicStore %out_DeviceIndex %c1 %c64 %in_DeviceIndex + + %in_SubgroupId = OpLoad %uint %gl_SubgroupId + OpAtomicStore %out_SubgroupId %c1 %c64 %in_SubgroupId + + %in0_ptr_WorkgroupId = OpAccessChain %ptr_uint %gl_WorkgroupId %c0 + %in1_ptr_WorkgroupId = OpAccessChain %ptr_uint %gl_WorkgroupId %c1 + %in2_ptr_WorkgroupId = OpAccessChain %ptr_uint %gl_WorkgroupId %c2 + %v0_WorkgroupId = OpLoad %uint %in0_ptr_WorkgroupId + %v1_WorkgroupId = OpLoad %uint %in1_ptr_WorkgroupId + %v2_WorkgroupId = OpLoad %uint %in2_ptr_WorkgroupId + %out0_ptr_WorkgroupId = OpAccessChain %ptr_uint %out_WorkgroupId %c0 + %out1_ptr_WorkgroupId = OpAccessChain %ptr_uint %out_WorkgroupId %c1 + %out2_ptr_WorkgroupId = OpAccessChain %ptr_uint %out_WorkgroupId %c2 + OpAtomicStore %out0_ptr_WorkgroupId %c1 %c64 %v0_WorkgroupId + OpAtomicStore %out1_ptr_WorkgroupId %c1 %c64 %v1_WorkgroupId + OpAtomicStore %out2_ptr_WorkgroupId %c1 %c64 %v2_WorkgroupId + + %in_SubgroupSize = OpLoad %uint %gl_SubgroupSize + OpAtomicStore %out_SubgroupSize %c1 %c64 %in_SubgroupSize + + %in0_ptr_WorkgroupSize = OpAccessChain %ptr_uint %gl_WorkgroupSize %c0 + %in1_ptr_WorkgroupSize = OpAccessChain %ptr_uint %gl_WorkgroupSize %c1 + %in2_ptr_WorkgroupSize = OpAccessChain %ptr_uint %gl_WorkgroupSize %c2 + %v0_WorkgroupSize = OpLoad %uint %in0_ptr_WorkgroupSize + %v1_WorkgroupSize = OpLoad %uint %in1_ptr_WorkgroupSize + %v2_WorkgroupSize = OpLoad %uint %in2_ptr_WorkgroupSize + %out0_ptr_WorkgroupSize = OpAccessChain %ptr_uint %out_WorkgroupSize %c0 + %out1_ptr_WorkgroupSize = OpAccessChain %ptr_uint %out_WorkgroupSize %c1 + %out2_ptr_WorkgroupSize = OpAccessChain %ptr_uint %out_WorkgroupSize %c2 + OpAtomicStore %out0_ptr_WorkgroupSize %c1 %c64 %v0_WorkgroupSize + OpAtomicStore %out1_ptr_WorkgroupSize %c1 %c64 %v1_WorkgroupSize + OpAtomicStore %out2_ptr_WorkgroupSize %c1 %c64 %v2_WorkgroupSize + + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/builtin-all-321.spv.dis b/dartagnan/src/test/resources/spirv/basic/builtin-all-321.spv.dis new file mode 100644 index 0000000000..f114f44024 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/builtin-all-321.spv.dis @@ -0,0 +1,152 @@ +; @Output: forall (%out_SubgroupLocalInvocationId>=0 and %out_SubgroupLocalInvocationId<=2) + +; @Output: forall (%out_LocalInvocationId[0]>=0 and %out_LocalInvocationId[0]<=5) +; @Output: forall (%out_LocalInvocationId[1]==0) +; @Output: forall (%out_LocalInvocationId[2]==0) + +; @Output: forall (%out_LocalInvocationIndex>=0 and %out_LocalInvocationIndex<=5) + +; @Output: forall (%out_GlobalInvocationId[0]>=0 and %out_GlobalInvocationId[0]<=5) +; @Output: forall (%out_GlobalInvocationId[1]==0) +; @Output: forall (%out_GlobalInvocationId[2]==0) + +; @Output: forall (%out_DeviceIndex==0) + +; @Output: forall (%out_SubgroupId==0 or %out_SubgroupId==1) + +; @Output: forall (%out_WorkgroupId[0]==0) +; @Output: forall (%out_WorkgroupId[1]==0) +; @Output: forall (%out_WorkgroupId[2]==0) + +; @Output: forall (%out_SubgroupSize==3) + +; @Output: forall (%out_WorkgroupSize[0]==6) +; @Output: forall (%out_WorkgroupSize[1]==1) +; @Output: forall (%out_WorkgroupSize[2]==1) + +; @Config: 3, 2, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + OpDecorate %gl_SubgroupLocalInvocationId BuiltIn SubgroupLocalInvocationId + OpDecorate %gl_LocalInvocationId BuiltIn LocalInvocationId + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %gl_DeviceIndex BuiltIn DeviceIndex + OpDecorate %gl_SubgroupId BuiltIn SubgroupId + OpDecorate %gl_WorkgroupId BuiltIn WorkgroupId + OpDecorate %gl_SubgroupSize BuiltIn SubgroupSize + OpDecorate %gl_WorkgroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %func = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %ptr_uint = OpTypePointer Uniform %uint + %_ptr_Input_uint = OpTypePointer Input %uint + %_ptr_Output_uint = OpTypePointer Output %uint + %_ptr_Input_v3uint = OpTypePointer Input %v3uint + %_ptr_Output_v3uint = OpTypePointer Output %v3uint + + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %c64 = OpConstant %uint 64 + %init = OpConstant %uint 999 + %v3init = OpConstantComposite %v3uint %init %init %init + + %gl_SubgroupLocalInvocationId = OpVariable %_ptr_Input_uint Input + %gl_LocalInvocationId = OpVariable %_ptr_Input_v3uint Input + %gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input + %gl_GlobalInvocationId = OpVariable %_ptr_Input_v3uint Input + %gl_DeviceIndex = OpVariable %_ptr_Input_uint Input + %gl_SubgroupId = OpVariable %_ptr_Input_uint Input + %gl_WorkgroupId = OpVariable %_ptr_Input_v3uint Input + %gl_SubgroupSize = OpVariable %_ptr_Input_uint Input + %gl_WorkgroupSize = OpVariable %_ptr_Input_v3uint Input + +%out_SubgroupLocalInvocationId = OpVariable %_ptr_Output_uint Output %init + %out_LocalInvocationId = OpVariable %_ptr_Output_v3uint Output %v3init + %out_LocalInvocationIndex = OpVariable %_ptr_Output_uint Output %init + %out_GlobalInvocationId = OpVariable %_ptr_Output_v3uint Output %v3init + %out_DeviceIndex = OpVariable %_ptr_Output_uint Output %init + %out_SubgroupId = OpVariable %_ptr_Output_uint Output %init + %out_WorkgroupId = OpVariable %_ptr_Output_v3uint Output %v3init + %out_SubgroupSize = OpVariable %_ptr_Output_uint Output %init + %out_WorkgroupSize = OpVariable %_ptr_Output_v3uint Output %v3init + + %main = OpFunction %void None %func + %label = OpLabel + +%in_SubgroupLocalInvocationId = OpLoad %uint %gl_SubgroupLocalInvocationId + OpAtomicStore %out_SubgroupLocalInvocationId %c1 %c64 %in_SubgroupLocalInvocationId + + %in0_ptr_LocalInvocationId = OpAccessChain %ptr_uint %gl_LocalInvocationId %c0 + %in1_ptr_LocalInvocationId = OpAccessChain %ptr_uint %gl_LocalInvocationId %c1 + %in2_ptr_LocalInvocationId = OpAccessChain %ptr_uint %gl_LocalInvocationId %c2 + %v0_LocalInvocationId = OpLoad %uint %in0_ptr_LocalInvocationId + %v1_LocalInvocationId = OpLoad %uint %in1_ptr_LocalInvocationId + %v2_LocalInvocationId = OpLoad %uint %in2_ptr_LocalInvocationId + %out0_ptr_LocalInvocationId = OpAccessChain %ptr_uint %out_LocalInvocationId %c0 + %out1_ptr_LocalInvocationId = OpAccessChain %ptr_uint %out_LocalInvocationId %c1 + %out2_ptr_LocalInvocationId = OpAccessChain %ptr_uint %out_LocalInvocationId %c2 + OpAtomicStore %out0_ptr_LocalInvocationId %c1 %c64 %v0_LocalInvocationId + OpAtomicStore %out1_ptr_LocalInvocationId %c1 %c64 %v1_LocalInvocationId + OpAtomicStore %out2_ptr_LocalInvocationId %c1 %c64 %v2_LocalInvocationId + + %in_LocalInvocationIndex = OpLoad %uint %gl_LocalInvocationIndex + OpAtomicStore %out_LocalInvocationIndex %c1 %c64 %in_LocalInvocationIndex + + %in0_ptr_GlobalInvocationId = OpAccessChain %ptr_uint %gl_GlobalInvocationId %c0 + %in1_ptr_GlobalInvocationId = OpAccessChain %ptr_uint %gl_GlobalInvocationId %c1 + %in2_ptr_GlobalInvocationId = OpAccessChain %ptr_uint %gl_GlobalInvocationId %c2 + %v0_GlobalInvocationId = OpLoad %uint %in0_ptr_GlobalInvocationId + %v1_GlobalInvocationId = OpLoad %uint %in1_ptr_GlobalInvocationId + %v2_GlobalInvocationId = OpLoad %uint %in2_ptr_GlobalInvocationId + %out0_ptr_GlobalInvocationId = OpAccessChain %ptr_uint %out_GlobalInvocationId %c0 + %out1_ptr_GlobalInvocationId = OpAccessChain %ptr_uint %out_GlobalInvocationId %c1 + %out2_ptr_GlobalInvocationId = OpAccessChain %ptr_uint %out_GlobalInvocationId %c2 + OpAtomicStore %out0_ptr_GlobalInvocationId %c1 %c64 %v0_GlobalInvocationId + OpAtomicStore %out1_ptr_GlobalInvocationId %c1 %c64 %v1_GlobalInvocationId + OpAtomicStore %out2_ptr_GlobalInvocationId %c1 %c64 %v2_GlobalInvocationId + + %in_DeviceIndex = OpLoad %uint %gl_DeviceIndex + OpAtomicStore %out_DeviceIndex %c1 %c64 %in_DeviceIndex + + %in_SubgroupId = OpLoad %uint %gl_SubgroupId + OpAtomicStore %out_SubgroupId %c1 %c64 %in_SubgroupId + + %in0_ptr_WorkgroupId = OpAccessChain %ptr_uint %gl_WorkgroupId %c0 + %in1_ptr_WorkgroupId = OpAccessChain %ptr_uint %gl_WorkgroupId %c1 + %in2_ptr_WorkgroupId = OpAccessChain %ptr_uint %gl_WorkgroupId %c2 + %v0_WorkgroupId = OpLoad %uint %in0_ptr_WorkgroupId + %v1_WorkgroupId = OpLoad %uint %in1_ptr_WorkgroupId + %v2_WorkgroupId = OpLoad %uint %in2_ptr_WorkgroupId + %out0_ptr_WorkgroupId = OpAccessChain %ptr_uint %out_WorkgroupId %c0 + %out1_ptr_WorkgroupId = OpAccessChain %ptr_uint %out_WorkgroupId %c1 + %out2_ptr_WorkgroupId = OpAccessChain %ptr_uint %out_WorkgroupId %c2 + OpAtomicStore %out0_ptr_WorkgroupId %c1 %c64 %v0_WorkgroupId + OpAtomicStore %out1_ptr_WorkgroupId %c1 %c64 %v1_WorkgroupId + OpAtomicStore %out2_ptr_WorkgroupId %c1 %c64 %v2_WorkgroupId + + %in_SubgroupSize = OpLoad %uint %gl_SubgroupSize + OpAtomicStore %out_SubgroupSize %c1 %c64 %in_SubgroupSize + + %in0_ptr_WorkgroupSize = OpAccessChain %ptr_uint %gl_WorkgroupSize %c0 + %in1_ptr_WorkgroupSize = OpAccessChain %ptr_uint %gl_WorkgroupSize %c1 + %in2_ptr_WorkgroupSize = OpAccessChain %ptr_uint %gl_WorkgroupSize %c2 + %v0_WorkgroupSize = OpLoad %uint %in0_ptr_WorkgroupSize + %v1_WorkgroupSize = OpLoad %uint %in1_ptr_WorkgroupSize + %v2_WorkgroupSize = OpLoad %uint %in2_ptr_WorkgroupSize + %out0_ptr_WorkgroupSize = OpAccessChain %ptr_uint %out_WorkgroupSize %c0 + %out1_ptr_WorkgroupSize = OpAccessChain %ptr_uint %out_WorkgroupSize %c1 + %out2_ptr_WorkgroupSize = OpAccessChain %ptr_uint %out_WorkgroupSize %c2 + OpAtomicStore %out0_ptr_WorkgroupSize %c1 %c64 %v0_WorkgroupSize + OpAtomicStore %out1_ptr_WorkgroupSize %c1 %c64 %v1_WorkgroupSize + OpAtomicStore %out2_ptr_WorkgroupSize %c1 %c64 %v2_WorkgroupSize + + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/builtin-constant.spv.dis b/dartagnan/src/test/resources/spirv/basic/builtin-constant.spv.dis new file mode 100644 index 0000000000..f10ac6ea61 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/builtin-constant.spv.dis @@ -0,0 +1,43 @@ +; @Input: %out = {0, 0, 0} +; @Output: forall (%out[0]==6 and %out[1]==1 and %out[2]==1) +; @Config: 3, 2, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %func = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %ptr_v3uint = OpTypePointer Uniform %v3uint + %ptr_uint = OpTypePointer Uniform %uint + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %c64 = OpConstant %uint 64 + %sc0 = OpSpecConstant %uint 0 + %gl_WorkGroupSize = OpSpecConstantComposite %v3uint %sc0 %sc0 %sc0 + %_ptr_Input_v3uint = OpTypePointer Input %v3uint + %_ptr_Output_v3uint = OpTypePointer Output %v3uint + %size = OpVariable %_ptr_Input_v3uint Input %gl_WorkGroupSize + %out = OpVariable %_ptr_Output_v3uint Output + %main = OpFunction %void None %func + %label = OpLabel + %in0_ptr = OpAccessChain %ptr_uint %size %c0 + %in1_ptr = OpAccessChain %ptr_uint %size %c1 + %in2_ptr = OpAccessChain %ptr_uint %size %c2 + %v0 = OpLoad %uint %in0_ptr + %v1 = OpLoad %uint %in1_ptr + %v2 = OpLoad %uint %in2_ptr + %out0_ptr = OpAccessChain %ptr_uint %out %c0 + %out1_ptr = OpAccessChain %ptr_uint %out %c1 + %out2_ptr = OpAccessChain %ptr_uint %out %c2 + OpAtomicStore %out0_ptr %c1 %c64 %v0 + OpAtomicStore %out1_ptr %c1 %c64 %v1 + OpAtomicStore %out2_ptr %c1 %c64 %v2 + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/builtin-default-config.spv.dis b/dartagnan/src/test/resources/spirv/basic/builtin-default-config.spv.dis new file mode 100644 index 0000000000..d3d5c069cd --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/builtin-default-config.spv.dis @@ -0,0 +1,42 @@ +; @Input: %out = {0, 0, 0} +; @Output: forall (%out[0]==1 and %out[1]==1 and %out[2]==1) +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %func = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %ptr_v3uint = OpTypePointer Uniform %v3uint + %ptr_uint = OpTypePointer Uniform %uint + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %c64 = OpConstant %uint 64 + %sc0 = OpSpecConstant %uint 0 + %gl_WorkGroupSize = OpSpecConstantComposite %v3uint %sc0 %sc0 %sc0 + %_ptr_Input_v3uint = OpTypePointer Input %v3uint + %_ptr_Output_v3uint = OpTypePointer Output %v3uint + %size = OpVariable %_ptr_Input_v3uint Input %gl_WorkGroupSize + %out = OpVariable %_ptr_Output_v3uint Output + %main = OpFunction %void None %func + %label = OpLabel + %in0_ptr = OpAccessChain %ptr_uint %size %c0 + %in1_ptr = OpAccessChain %ptr_uint %size %c1 + %in2_ptr = OpAccessChain %ptr_uint %size %c2 + %v0 = OpLoad %uint %in0_ptr + %v1 = OpLoad %uint %in1_ptr + %v2 = OpLoad %uint %in2_ptr + %out0_ptr = OpAccessChain %ptr_uint %out %c0 + %out1_ptr = OpAccessChain %ptr_uint %out %c1 + %out2_ptr = OpAccessChain %ptr_uint %out %c2 + OpAtomicStore %out0_ptr %c1 %c64 %v0 + OpAtomicStore %out1_ptr %c1 %c64 %v1 + OpAtomicStore %out2_ptr %c1 %c64 %v2 + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/builtin-variable.spv.dis b/dartagnan/src/test/resources/spirv/basic/builtin-variable.spv.dis new file mode 100644 index 0000000000..3d41f341bd --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/builtin-variable.spv.dis @@ -0,0 +1,44 @@ +; @Input: %out = {0, 0, 0} +; @Output: forall (%out[0]==6 and %out[1]==1 and %out[2]==1) +; @Config: 3, 2, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %func = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %ptr_v3uint = OpTypePointer Uniform %v3uint + %ptr_uint = OpTypePointer Uniform %uint + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %c64 = OpConstant %uint 64 + %_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Output_v3uint = OpTypePointer Output %v3uint + %gl_WorkGroupSize = OpVariable %_ptr_Input_v3uint Input + %out = OpVariable %_ptr_Output_v3uint Output + %main = OpFunction %void None %func + %label = OpLabel + %in0_ptr = OpAccessChain %ptr_uint %gl_WorkGroupSize %c0 + %in1_ptr = OpAccessChain %ptr_uint %gl_WorkGroupSize %c1 + %in2_ptr = OpAccessChain %ptr_uint %gl_WorkGroupSize %c2 + %v0 = OpLoad %uint %in0_ptr + %v1 = OpLoad %uint %in1_ptr + %v2 = OpLoad %uint %in2_ptr + %out0_ptr = OpAccessChain %ptr_uint %out %c0 + %out1_ptr = OpAccessChain %ptr_uint %out %c1 + %out2_ptr = OpAccessChain %ptr_uint %out %c2 + + ; TODO: What is the storage class here? Should be mapped from Output + + OpAtomicStore %out0_ptr %c1 %c64 %v0 + OpAtomicStore %out1_ptr %c1 %c64 %v1 + OpAtomicStore %out2_ptr %c1 %c64 %v2 + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/cmpxchg-const-const.spv.dis b/dartagnan/src/test/resources/spirv/basic/cmpxchg-const-const.spv.dis new file mode 100644 index 0000000000..dfc5ba84a5 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/cmpxchg-const-const.spv.dis @@ -0,0 +1,57 @@ +; @Input: %out1 = {0, 0, 0}, %out2 = {0, 0, 0} +; @Output: forall (%out1[0] == 1 and %out1[1] == 1 and %out1[2] == 3) +; @Output: forall (%out2[0] == 2 and %out2[1] == 1 and %out2[2] == 3) +; @Output: forall (%shared1 == 3 and %shared2 == 2) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 64 0 + %v3uint = OpTypeVector %uint 3 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_v3uint = OpTypePointer Output %v3uint + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %c66 = OpConstant %uint 66 + %c72 = OpConstant %uint 72 + + %cmp1 = OpConstant %uint 1 + %cmp2 = OpConstant %uint 1 + + %value1 = OpConstant %uint 3 + %value2 = OpConstant %uint 3 + + %shared1 = OpVariable %ptr_uint Uniform %c1 + %shared2 = OpVariable %ptr_uint Uniform %c2 + %out1 = OpVariable %ptr_v3uint Output + %out2 = OpVariable %ptr_v3uint Output + %main = OpFunction %void None %func + %label = OpLabel + + %result1 = OpAtomicCompareExchange %uint %shared1 %c1 %c72 %c66 %value1 %cmp1 + %result2 = OpAtomicCompareExchange %uint %shared2 %c1 %c72 %c66 %value2 %cmp2 + + %ptr_1_0 = OpAccessChain %ptr_uint %out1 %c0 + %ptr_1_1 = OpAccessChain %ptr_uint %out1 %c1 + %ptr_1_2 = OpAccessChain %ptr_uint %out1 %c2 + %ptr_2_0 = OpAccessChain %ptr_uint %out2 %c0 + %ptr_2_1 = OpAccessChain %ptr_uint %out2 %c1 + %ptr_2_2 = OpAccessChain %ptr_uint %out2 %c2 + + OpStore %ptr_1_0 %result1 + OpStore %ptr_1_1 %cmp1 + OpStore %ptr_1_2 %value2 + OpStore %ptr_2_0 %result2 + OpStore %ptr_2_1 %cmp2 + OpStore %ptr_2_2 %value2 + + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/cmpxchg-const-reg.spv.dis b/dartagnan/src/test/resources/spirv/basic/cmpxchg-const-reg.spv.dis new file mode 100644 index 0000000000..1a71c3221c --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/cmpxchg-const-reg.spv.dis @@ -0,0 +1,57 @@ +; @Input: %out1 = {0, 0, 0}, %out2 = {0, 0, 0} +; @Output: forall (%out1[0] == 1 and %out1[1] == 1 and %out1[2] == 3) +; @Output: forall (%out2[0] == 2 and %out2[1] == 1 and %out2[2] == 3) +; @Output: forall (%shared1 == 3 and %shared2 == 2) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 64 0 + %v3uint = OpTypeVector %uint 3 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_v3uint = OpTypePointer Output %v3uint + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %c66 = OpConstant %uint 66 + %c72 = OpConstant %uint 72 + + %cmp1 = OpConstant %uint 1 + %cmp2 = OpConstant %uint 1 + + %shared1 = OpVariable %ptr_uint Uniform %c1 + %shared2 = OpVariable %ptr_uint Uniform %c2 + %out1 = OpVariable %ptr_v3uint Output + %out2 = OpVariable %ptr_v3uint Output + %main = OpFunction %void None %func + %label = OpLabel + + %value1 = OpIAdd %uint %c1 %c2 + %value2 = OpIAdd %uint %c1 %c2 + + %result1 = OpAtomicCompareExchange %uint %shared1 %c1 %c72 %c66 %value1 %cmp1 + %result2 = OpAtomicCompareExchange %uint %shared2 %c1 %c72 %c66 %value2 %cmp2 + + %ptr_1_0 = OpAccessChain %ptr_uint %out1 %c0 + %ptr_1_1 = OpAccessChain %ptr_uint %out1 %c1 + %ptr_1_2 = OpAccessChain %ptr_uint %out1 %c2 + %ptr_2_0 = OpAccessChain %ptr_uint %out2 %c0 + %ptr_2_1 = OpAccessChain %ptr_uint %out2 %c1 + %ptr_2_2 = OpAccessChain %ptr_uint %out2 %c2 + + OpStore %ptr_1_0 %result1 + OpStore %ptr_1_1 %cmp1 + OpStore %ptr_1_2 %value2 + OpStore %ptr_2_0 %result2 + OpStore %ptr_2_1 %cmp2 + OpStore %ptr_2_2 %value2 + + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/cmpxchg-reg-const.spv.dis b/dartagnan/src/test/resources/spirv/basic/cmpxchg-reg-const.spv.dis new file mode 100644 index 0000000000..6fe0a7adc2 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/cmpxchg-reg-const.spv.dis @@ -0,0 +1,57 @@ +; @Input: %out1 = {0, 0, 0}, %out2 = {0, 0, 0} +; @Output: forall (%out1[0] == 1 and %out1[1] == 1 and %out1[2] == 3) +; @Output: forall (%out2[0] == 2 and %out2[1] == 1 and %out2[2] == 3) +; @Output: forall (%shared1 == 3 and %shared2 == 2) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 64 0 + %v3uint = OpTypeVector %uint 3 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_v3uint = OpTypePointer Output %v3uint + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %c66 = OpConstant %uint 66 + %c72 = OpConstant %uint 72 + + %value1 = OpConstant %uint 3 + %value2 = OpConstant %uint 3 + + %shared1 = OpVariable %ptr_uint Uniform %c1 + %shared2 = OpVariable %ptr_uint Uniform %c2 + %out1 = OpVariable %ptr_v3uint Output + %out2 = OpVariable %ptr_v3uint Output + %main = OpFunction %void None %func + %label = OpLabel + + %cmp1 = OpIAdd %uint %c0 %c1 + %cmp2 = OpIAdd %uint %c0 %c1 + + %result1 = OpAtomicCompareExchange %uint %shared1 %c1 %c72 %c66 %value1 %cmp1 + %result2 = OpAtomicCompareExchange %uint %shared2 %c1 %c72 %c66 %value2 %cmp2 + + %ptr_1_0 = OpAccessChain %ptr_uint %out1 %c0 + %ptr_1_1 = OpAccessChain %ptr_uint %out1 %c1 + %ptr_1_2 = OpAccessChain %ptr_uint %out1 %c2 + %ptr_2_0 = OpAccessChain %ptr_uint %out2 %c0 + %ptr_2_1 = OpAccessChain %ptr_uint %out2 %c1 + %ptr_2_2 = OpAccessChain %ptr_uint %out2 %c2 + + OpStore %ptr_1_0 %result1 + OpStore %ptr_1_1 %cmp1 + OpStore %ptr_1_2 %value2 + OpStore %ptr_2_0 %result2 + OpStore %ptr_2_1 %cmp2 + OpStore %ptr_2_2 %value2 + + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/cmpxchg-reg-reg.spv.dis b/dartagnan/src/test/resources/spirv/basic/cmpxchg-reg-reg.spv.dis new file mode 100644 index 0000000000..8c41d220a9 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/cmpxchg-reg-reg.spv.dis @@ -0,0 +1,57 @@ +; @Input: %out1 = {0, 0, 0}, %out2 = {0, 0, 0} +; @Output: forall (%out1[0] == 1 and %out1[1] == 1 and %out1[2] == 3) +; @Output: forall (%out2[0] == 2 and %out2[1] == 1 and %out2[2] == 3) +; @Output: forall (%shared1 == 3 and %shared2 == 2) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 64 0 + %v3uint = OpTypeVector %uint 3 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_v3uint = OpTypePointer Output %v3uint + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %c66 = OpConstant %uint 66 + %c72 = OpConstant %uint 72 + + %shared1 = OpVariable %ptr_uint Uniform %c1 + %shared2 = OpVariable %ptr_uint Uniform %c2 + %out1 = OpVariable %ptr_v3uint Output + %out2 = OpVariable %ptr_v3uint Output + %main = OpFunction %void None %func + %label = OpLabel + + %cmp1 = OpIAdd %uint %c0 %c1 + %cmp2 = OpIAdd %uint %c0 %c1 + + %value1 = OpIAdd %uint %c1 %c2 + %value2 = OpIAdd %uint %c1 %c2 + + %result1 = OpAtomicCompareExchange %uint %shared1 %c1 %c72 %c66 %value1 %cmp1 + %result2 = OpAtomicCompareExchange %uint %shared2 %c1 %c72 %c66 %value2 %cmp2 + + %ptr_1_0 = OpAccessChain %ptr_uint %out1 %c0 + %ptr_1_1 = OpAccessChain %ptr_uint %out1 %c1 + %ptr_1_2 = OpAccessChain %ptr_uint %out1 %c2 + %ptr_2_0 = OpAccessChain %ptr_uint %out2 %c0 + %ptr_2_1 = OpAccessChain %ptr_uint %out2 %c1 + %ptr_2_2 = OpAccessChain %ptr_uint %out2 %c2 + + OpStore %ptr_1_0 %result1 + OpStore %ptr_1_1 %cmp1 + OpStore %ptr_1_2 %value2 + OpStore %ptr_2_0 %result2 + OpStore %ptr_2_1 %cmp2 + OpStore %ptr_2_2 %value2 + + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/empty-exists-false.spv.dis b/dartagnan/src/test/resources/spirv/basic/empty-exists-false.spv.dis new file mode 100644 index 0000000000..23b3ba66af --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/empty-exists-false.spv.dis @@ -0,0 +1,15 @@ +; @Output: exists (0 == 1) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %func = OpTypeFunction %void + %main = OpFunction %void None %func + %label = OpLabel + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/empty-exists-true.spv.dis b/dartagnan/src/test/resources/spirv/basic/empty-exists-true.spv.dis new file mode 100644 index 0000000000..8c6d406555 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/empty-exists-true.spv.dis @@ -0,0 +1,15 @@ +; @Output: exists (1 == 1) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %func = OpTypeFunction %void + %main = OpFunction %void None %func + %label = OpLabel + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/empty-forall-false.spv.dis b/dartagnan/src/test/resources/spirv/basic/empty-forall-false.spv.dis new file mode 100644 index 0000000000..41fedcfe2c --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/empty-forall-false.spv.dis @@ -0,0 +1,15 @@ +; @Output: forall (0 == 1) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %func = OpTypeFunction %void + %main = OpFunction %void None %func + %label = OpLabel + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/empty-forall-true.spv.dis b/dartagnan/src/test/resources/spirv/basic/empty-forall-true.spv.dis new file mode 100644 index 0000000000..2471793eb7 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/empty-forall-true.spv.dis @@ -0,0 +1,15 @@ +; @Output: forall (1 == 1) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %func = OpTypeFunction %void + %main = OpFunction %void None %func + %label = OpLabel + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/empty-not-exists-false.spv.dis b/dartagnan/src/test/resources/spirv/basic/empty-not-exists-false.spv.dis new file mode 100644 index 0000000000..de03e04581 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/empty-not-exists-false.spv.dis @@ -0,0 +1,15 @@ +; @Output: not exists (0 == 1) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %func = OpTypeFunction %void + %main = OpFunction %void None %func + %label = OpLabel + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/empty-not-exists-true.spv.dis b/dartagnan/src/test/resources/spirv/basic/empty-not-exists-true.spv.dis new file mode 100644 index 0000000000..4c8ed11545 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/empty-not-exists-true.spv.dis @@ -0,0 +1,15 @@ +; @Output: not exists (1 == 1) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %func = OpTypeFunction %void + %main = OpFunction %void None %func + %label = OpLabel + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/ids.spv.dis b/dartagnan/src/test/resources/spirv/basic/ids.spv.dis new file mode 100644 index 0000000000..470adf2186 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/ids.spv.dis @@ -0,0 +1,57 @@ +; @Output: forall (%out[0]==0 and %out[1]==0 and %out[2]==0) +; @Output: forall (%out[3]==1 and %out[4]==0 and %out[5]==0) +; @Output: forall (%out[6]==0 and %out[7]==1 and %out[8]==0) +; @Output: forall (%out[9]==1 and %out[10]==1 and %out[11]==0) +; @Output: forall (%out[12]==0 and %out[13]==0 and %out[14]==1) +; @Output: forall (%out[15]==1 and %out[16]==0 and %out[17]==1) +; @Output: forall (%out[18]==0 and %out[19]==1 and %out[20]==1) +; @Output: forall (%out[21]==1 and %out[22]==1 and %out[23]==1) +; @Config: 2, 2, 2 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + OpDecorate %x_scalar BuiltIn SubgroupLocalInvocationId + OpDecorate %y_scalar BuiltIn SubgroupId + OpDecorate %z_arr BuiltIn WorkgroupId + %void = OpTypeVoid + %func = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %v24uint = OpTypeVector %uint 24 + %ptr_uint = OpTypePointer Input %uint + %ptr_v3uint = OpTypePointer Input %v3uint +%ptr_v24uint = OpTypePointer Output %v24uint + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %c3 = OpConstant %uint 3 + %c4 = OpConstant %uint 4 + %x_scalar = OpVariable %ptr_uint Input + %y_scalar = OpVariable %ptr_uint Input + %z_arr = OpVariable %ptr_v3uint Input + %out = OpVariable %ptr_v24uint Output + %main = OpFunction %void None %func + %label = OpLabel + %x_val = OpLoad %uint %x_scalar + %y_val = OpLoad %uint %y_scalar + %z_ptr = OpAccessChain %ptr_uint %z_arr %c0 + %z_val = OpLoad %uint %z_ptr + %1 = OpIMul %uint %z_val %c4 + %2 = OpIMul %uint %y_val %c2 + %3 = OpIAdd %uint %1 %2 + %4 = OpIAdd %uint %3 %x_val + %idx_x = OpIMul %uint %4 %c3 + %idx_y = OpIAdd %uint %idx_x %c1 + %idx_z = OpIAdd %uint %idx_x %c2 + %ptr_out_x = OpAccessChain %ptr_uint %out %idx_x + %ptr_out_y = OpAccessChain %ptr_uint %out %idx_y + %ptr_out_z = OpAccessChain %ptr_uint %out %idx_z + OpStore %ptr_out_x %x_val + OpStore %ptr_out_y %y_val + OpStore %ptr_out_z %z_val + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/init-forall-not-exists-fail.spv.dis b/dartagnan/src/test/resources/spirv/basic/init-forall-not-exists-fail.spv.dis new file mode 100644 index 0000000000..00da8c3946 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/init-forall-not-exists-fail.spv.dis @@ -0,0 +1,21 @@ +; @Input: %v1=7, %v2=123 +; @Output: not exists (%v1==7 and %v2==123 and %v3==0) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %uint = OpTypeInt 64 0 + %ptr_uint = OpTypePointer Uniform %uint + %func = OpTypeFunction %void + %v1 = OpVariable %ptr_uint Uniform + %v2 = OpVariable %ptr_uint Uniform + %v3 = OpVariable %ptr_uint Uniform + %main = OpFunction %void None %func + %label = OpLabel + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/init-forall-not-exists.spv.dis b/dartagnan/src/test/resources/spirv/basic/init-forall-not-exists.spv.dis new file mode 100644 index 0000000000..407a46ddab --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/init-forall-not-exists.spv.dis @@ -0,0 +1,21 @@ +; @Input: %v1=7, %v2=123, %v3=0 +; @Output: not exists (%v1!=7 or %v2!=123 or %v3!=0) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %uint = OpTypeInt 64 0 + %ptr_uint = OpTypePointer Uniform %uint + %func = OpTypeFunction %void + %v1 = OpVariable %ptr_uint Uniform + %v2 = OpVariable %ptr_uint Uniform + %v3 = OpVariable %ptr_uint Uniform + %main = OpFunction %void None %func + %label = OpLabel + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/init-forall-split.spv.dis b/dartagnan/src/test/resources/spirv/basic/init-forall-split.spv.dis new file mode 100644 index 0000000000..8da20dfd4f --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/init-forall-split.spv.dis @@ -0,0 +1,22 @@ +; @Input: %v1=7, %v2=123, %v3=0 +; @Output: forall (%v1==7 and %v2==123) +; @Output: forall (%v3==0) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %uint = OpTypeInt 64 0 + %ptr_uint = OpTypePointer Uniform %uint + %func = OpTypeFunction %void + %v1 = OpVariable %ptr_uint Uniform + %v2 = OpVariable %ptr_uint Uniform + %v3 = OpVariable %ptr_uint Uniform + %main = OpFunction %void None %func + %label = OpLabel + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/init-forall.spv.dis b/dartagnan/src/test/resources/spirv/basic/init-forall.spv.dis new file mode 100644 index 0000000000..e39569864f --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/init-forall.spv.dis @@ -0,0 +1,21 @@ +; @Input: %v1=7, %v2=123, %v3=0 +; @Output: forall (%v1==7 and %v2==123 and %v3==0) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %uint = OpTypeInt 64 0 + %ptr_uint = OpTypePointer Uniform %uint + %func = OpTypeFunction %void + %v1 = OpVariable %ptr_uint Uniform + %v2 = OpVariable %ptr_uint Uniform + %v3 = OpVariable %ptr_uint Uniform + %main = OpFunction %void None %func + %label = OpLabel + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/loop-struct-cond-nested.spv.dis b/dartagnan/src/test/resources/spirv/basic/loop-struct-cond-nested.spv.dis new file mode 100644 index 0000000000..b93f230bf9 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/loop-struct-cond-nested.spv.dis @@ -0,0 +1,59 @@ +; @Input: %var = 0 +; @Output: forall (%var==16275) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + OpDecorate %ids BuiltIn GlobalInvocationId + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 64 0 + %v3uint = OpTypeVector %uint 3 + %ptr_uint = OpTypePointer Uniform %uint + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %c5 = OpConstant %uint 5 + %var = OpVariable %ptr_uint Uniform + %count_1 = OpVariable %ptr_uint Uniform %c0 + %count_2 = OpVariable %ptr_uint Uniform %c0 + %main = OpFunction %void None %func + + ; loop 1 start + %label_1 = OpLabel + %val_1 = OpLoad %uint %var + %val_1_new = OpIAdd %uint %val_1 %c1 + OpStore %var %val_1_new + %val_count_1 = OpLoad %uint %count_1 + %val_count_1_new = OpIAdd %uint %val_count_1 %c1 + OpStore %count_1 %val_count_1_new + OpStore %count_2 %c0 + OpBranch %label_3 + + ; loop 2 starts + %label_3 = OpLabel + %val_2 = OpLoad %uint %var + %val_2_new = OpIMul %uint %val_2 %c5 + OpStore %var %val_2_new + %val_count_2 = OpLoad %uint %count_2 + %val_count_2_new = OpIAdd %uint %val_count_2 %c1 + OpStore %count_2 %val_count_2_new + %cond_2 = OpIEqual %bool %val_count_2 %c1 + OpLoopMerge %label_4 %label_3 None + OpBranchConditional %cond_2 %label_4 %label_3 + %label_4 = OpLabel + ; loop 2 end + + %cond_1 = OpIEqual %bool %val_count_1 %c2 + OpLoopMerge %label_2 %label_1 None + OpBranchConditional %cond_1 %label_2 %label_1 + %label_2 = OpLabel + ; loop 1 end + + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/loop-struct-cond-sequence.spv.dis b/dartagnan/src/test/resources/spirv/basic/loop-struct-cond-sequence.spv.dis new file mode 100644 index 0000000000..e7d5865466 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/loop-struct-cond-sequence.spv.dis @@ -0,0 +1,56 @@ +; @Input: %var = 0 +; @Output: forall (%var==75) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + OpDecorate %ids BuiltIn GlobalInvocationId + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 64 0 + %v3uint = OpTypeVector %uint 3 + %ptr_uint = OpTypePointer Uniform %uint + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %c5 = OpConstant %uint 5 + %var = OpVariable %ptr_uint Uniform + %count_1 = OpVariable %ptr_uint Uniform %c0 + %count_2 = OpVariable %ptr_uint Uniform %c0 + %main = OpFunction %void None %func + + ; loop 1 + %label_1 = OpLabel + %val_1 = OpLoad %uint %var + %val_1_new = OpIAdd %uint %val_1 %c1 + OpStore %var %val_1_new + %val_count_1 = OpLoad %uint %count_1 + %val_count_1_new = OpIAdd %uint %val_count_1 %c1 + OpStore %count_1 %val_count_1_new + %cond_1 = OpIEqual %bool %val_count_1 %c2 + OpLoopMerge %label_2 %label_1 None + OpBranchConditional %cond_1 %label_2 %label_1 + %label_2 = OpLabel + + OpBranch %label_3 + + ; loop 2 + %label_3 = OpLabel + %val_2 = OpLoad %uint %var + %val_2_new = OpIMul %uint %val_2 %c5 + OpStore %var %val_2_new + %val_count_2 = OpLoad %uint %count_2 + %val_count_2_new = OpIAdd %uint %val_count_2 %c1 + OpStore %count_2 %val_count_2_new + %cond_2 = OpIEqual %bool %val_count_2 %c1 + OpLoopMerge %label_4 %label_3 None + OpBranchConditional %cond_2 %label_4 %label_3 + %label_4 = OpLabel + + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/loop-struct-cond-suffix.spv.dis b/dartagnan/src/test/resources/spirv/basic/loop-struct-cond-suffix.spv.dis new file mode 100644 index 0000000000..1d50ad7d83 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/loop-struct-cond-suffix.spv.dis @@ -0,0 +1,34 @@ +; @Input: %var = 0 +; @Output: forall (%var==3) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + OpDecorate %ids BuiltIn GlobalInvocationId + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 64 0 + %v3uint = OpTypeVector %uint 3 + %ptr_uint = OpTypePointer Uniform %uint + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %var = OpVariable %ptr_uint Uniform + %main = OpFunction %void None %func + %label_1 = OpLabel + %val = OpLoad %uint %var + %val_new = OpIAdd %uint %val %c1 + OpStore %var %val_new + %cond = OpIEqual %bool %val_new %c2 + OpLoopMerge %label_2 %label_1 None + OpBranchConditional %cond %label_2 %label_1 + %label_2 = OpLabel + %val_suf = OpLoad %uint %var +%val_suf_new = OpIAdd %uint %val_suf %c1 + OpStore %var %val_suf_new + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/loop-struct-cond.spv.dis b/dartagnan/src/test/resources/spirv/basic/loop-struct-cond.spv.dis new file mode 100644 index 0000000000..84a0b3cf3e --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/loop-struct-cond.spv.dis @@ -0,0 +1,31 @@ +; @Input: %var = 0 +; @Output: forall (%var==2) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + OpDecorate %ids BuiltIn GlobalInvocationId + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 64 0 + %v3uint = OpTypeVector %uint 3 + %ptr_uint = OpTypePointer Uniform %uint + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %var = OpVariable %ptr_uint Uniform + %main = OpFunction %void None %func + %label_1 = OpLabel + %val = OpLoad %uint %var + %val_new = OpIAdd %uint %val %c1 + OpStore %var %val_new + %cond = OpIEqual %bool %val_new %c2 + OpLoopMerge %label_2 %label_1 None + OpBranchConditional %cond %label_2 %label_1 + %label_2 = OpLabel + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/memory-scopes.spv.dis b/dartagnan/src/test/resources/spirv/basic/memory-scopes.spv.dis new file mode 100644 index 0000000000..2896039c04 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/memory-scopes.spv.dis @@ -0,0 +1,69 @@ +; @Output: forall (%out_th[0]==1 and %out_th[1]==1 and %out_th[2]==1 and %out_th[3]==1) +; @Output: forall (%out_wg[0]==2 and %out_wg[1]==2 and %out_wg[2]==2 and %out_wg[3]==2) +; @Output: forall (%out_dv[0]==4 and %out_dv[1]==4 and %out_dv[2]==4 and %out_dv[3]==4) +; @Config: 2, 1, 2 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + OpDecorate %ids BuiltIn GlobalInvocationId + + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %v4uint = OpTypeVector %uint 4 + + %ptr_in = OpTypePointer Input %uint + %ptr_out = OpTypePointer Output %uint + %ptr_v3_in = OpTypePointer Input %v3uint + %ptr_v4_out = OpTypePointer Output %v4uint +%ptr_uint_th = OpTypePointer Private %uint +%ptr_uint_wg = OpTypePointer Workgroup %uint +%ptr_uint_dv = OpTypePointer Uniform %uint + + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %c4 = OpConstant %uint 4 + %c66 = OpConstant %uint 66 + %c72 = OpConstant %uint 72 + + %var_th = OpVariable %ptr_uint_th Private %c0 + %var_wg = OpVariable %ptr_uint_wg Workgroup %c0 + %var_dv = OpVariable %ptr_uint_dv Uniform %c0 + %out_th = OpVariable %ptr_v4_out Output + %out_wg = OpVariable %ptr_v4_out Output + %out_dv = OpVariable %ptr_v4_out Output + %ids = OpVariable %ptr_v3_in Input + + %main = OpFunction %void None %func + %label_1 = OpLabel + + %id_ptr = OpAccessChain %ptr_in %ids %c0 + %id = OpLoad %uint %id_ptr + +%var_th_orig = OpAtomicIIncrement %uint %var_th %c4 %c72 +%var_wg_orig = OpAtomicIIncrement %uint %var_wg %c2 %c72 +%var_dv_orig = OpAtomicIIncrement %uint %var_dv %c1 %c72 + + OpControlBarrier %c1 %c1 %c72 + + %th = OpAtomicLoad %uint %var_th %c4 %c66 + %wg = OpAtomicLoad %uint %var_wg %c2 %c66 + %dv = OpAtomicLoad %uint %var_dv %c1 %c66 + + %out_th_ptr = OpAccessChain %ptr_out %out_th %id + %out_wg_ptr = OpAccessChain %ptr_out %out_wg %id + %out_dv_ptr = OpAccessChain %ptr_out %out_dv %id + + OpStore %out_th_ptr %th + OpStore %out_wg_ptr %wg + OpStore %out_dv_ptr %dv + + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/mixed-size.spv.dis b/dartagnan/src/test/resources/spirv/basic/mixed-size.spv.dis new file mode 100644 index 0000000000..78efe25c52 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/mixed-size.spv.dis @@ -0,0 +1,35 @@ +; @Input: %v1={0, 1, 2} +; @Input: %v2={0, 1, 2, 3, 4, 5, 6, 7} +; @Output: forall (%v1[0]==0 and %v1[1]==1 and %v1[2]==2) +; @Output: forall (%v2[0]==0 and %v2[1]==1 and %v2[2]==2 and %v2[3]==3) +; @Output: forall (%v2[4]==4 and %v2[5]==5 and %v2[6]==6 and %v2[7]==7) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %uint = OpTypeInt 64 0 + %ptr_uint = OpTypePointer Uniform %uint + %func = OpTypeFunction %void + %uint8 = OpTypeInt 8 0 + %uint16 = OpTypeInt 16 0 + %uint24 = OpTypeInt 24 0 + %uint32 = OpTypeInt 32 0 + %uint40 = OpTypeInt 40 0 + %uint48 = OpTypeInt 48 0 + %uint56 = OpTypeInt 56 0 + %uint64 = OpTypeInt 64 0 + %struct1 = OpTypeStruct %uint16 %uint32 %uint64 + %struct2 = OpTypeStruct %uint8 %uint16 %uint24 %uint32 %uint40 %uint48 %uint56 %uint64 +%ptr_struct1 = OpTypePointer Uniform %struct1 +%ptr_struct2 = OpTypePointer Uniform %struct2 + %v1 = OpVariable %ptr_struct1 Uniform + %v2 = OpVariable %ptr_struct2 Uniform + %main = OpFunction %void None %func + %label = OpLabel + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/phi-unstruct-false.spv.dis b/dartagnan/src/test/resources/spirv/basic/phi-unstruct-false.spv.dis new file mode 100644 index 0000000000..772c41741d --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/phi-unstruct-false.spv.dis @@ -0,0 +1,37 @@ +; @Input: %out = 0 +; @Output: forall (%out==22) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + OpDecorate %ids BuiltIn GlobalInvocationId + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %v2uint = OpTypeVector %uint 2 + %ptr_uint = OpTypePointer Output %uint + %ptr_v3uint = OpTypePointer Input %v3uint + %c0 = OpConstant %uint 0 + %ids = OpVariable %ptr_v3uint Input + %out = OpVariable %ptr_uint Output + %main = OpFunction %void None %func + %label_1 = OpLabel + %id_ptr = OpAccessChain %ptr_uint %ids %c0 + %id = OpLoad %uint %id_ptr + %c11 = OpConstant %uint 11 + %cond = OpINotEqual %bool %id %c0 + OpBranchConditional %cond %label_3 %label_2 + %label_2 = OpLabel + %c22 = OpConstant %uint 22 + OpBranch %label_3 + %label_3 = OpLabel + %value = OpPhi %uint %c11 %label_1 %c22 %label_2 + OpStore %out %value + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/phi-unstruct-true.spv.dis b/dartagnan/src/test/resources/spirv/basic/phi-unstruct-true.spv.dis new file mode 100644 index 0000000000..4c1ab4eb1f --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/phi-unstruct-true.spv.dis @@ -0,0 +1,37 @@ +; @Input: %out = 0 +; @Output: forall (%out==11) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + OpDecorate %ids BuiltIn GlobalInvocationId + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %v2uint = OpTypeVector %uint 2 + %ptr_uint = OpTypePointer Output %uint + %ptr_v3uint = OpTypePointer Input %v3uint + %c0 = OpConstant %uint 0 + %ids = OpVariable %ptr_v3uint Input + %out = OpVariable %ptr_uint Output + %main = OpFunction %void None %func + %label_1 = OpLabel + %id_ptr = OpAccessChain %ptr_uint %ids %c0 + %id = OpLoad %uint %id_ptr + %c11 = OpConstant %uint 11 + %cond = OpIEqual %bool %id %c0 + OpBranchConditional %cond %label_3 %label_2 + %label_2 = OpLabel + %c22 = OpConstant %uint 22 + OpBranch %label_3 + %label_3 = OpLabel + %value = OpPhi %uint %c11 %label_1 %c22 %label_2 + OpStore %out %value + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/phi.spv.dis b/dartagnan/src/test/resources/spirv/basic/phi.spv.dis new file mode 100644 index 0000000000..65243dd999 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/phi.spv.dis @@ -0,0 +1,42 @@ +; @Input: %out = {0, 0} +; @Output: forall (%out[0]==11 and %out[1]==22) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + OpDecorate %ids BuiltIn GlobalInvocationId + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %v2uint = OpTypeVector %uint 2 + %ptr_uint = OpTypePointer Input %uint + %ptr_v3uint = OpTypePointer Input %v3uint + %ptr_v2uint = OpTypePointer Output %v2uint + %c0 = OpConstant %uint 0 + %ids = OpVariable %ptr_v3uint Input + %out = OpVariable %ptr_v2uint Output + %main = OpFunction %void None %func + %label_1 = OpLabel + %id_ptr = OpAccessChain %ptr_uint %ids %c0 + %id = OpLoad %uint %id_ptr + %cond = OpUGreaterThan %bool %id %c0 + OpSelectionMerge %label_3 None + OpBranchConditional %cond %label_2 %label_3 + %label_2 = OpLabel + %c22 = OpConstant %uint 22 + OpBranch %label_4 + %label_3 = OpLabel + %c11 = OpConstant %uint 11 + OpBranch %label_4 + %label_4 = OpLabel + %value = OpPhi %uint %c22 %label_2 %c11 %label_3 + %ptr_out = OpAccessChain %ptr_uint %out %id + OpStore %ptr_out %value + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/push-constant-mixed.spv.dis b/dartagnan/src/test/resources/spirv/basic/push-constant-mixed.spv.dis new file mode 100644 index 0000000000..8ddd7c15f3 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/push-constant-mixed.spv.dis @@ -0,0 +1,71 @@ +; @Input: %push = {{0, 0, 0}, {7}} +; @Input: %out = {{0, 0, 0, 0}} +; @Output: forall (%out[0][0] == 1 and %out[0][1] == 1 and %out[0][2] == 1) +; @Output: forall (%out[0][3] == 7) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %54 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %func "test" %out %push + OpSource OpenCL_C 200 + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_12 0 Offset 0 + OpMemberDecorate %_struct_12 1 Offset 16 + OpDecorate %_struct_12 Block + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %out DescriptorSet 0 + OpDecorate %out Binding 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint + %_struct_12 = OpTypeStruct %v3uint %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %void = OpTypeVoid + %void_func = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %push = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %out = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %func = OpFunction %void None %void_func + %label = OpLabel + %ptr_0 = OpAccessChain %_ptr_PushConstant_uint %push %uint_0 %uint_0 + %ptr_1 = OpAccessChain %_ptr_PushConstant_uint %push %uint_0 %uint_1 + %ptr_2 = OpAccessChain %_ptr_PushConstant_uint %push %uint_0 %uint_2 + %ptr_3 = OpAccessChain %_ptr_PushConstant_uint %push %uint_1 %uint_0 + %val_0 = OpLoad %uint %ptr_0 + %val_1 = OpLoad %uint %ptr_1 + %val_2 = OpLoad %uint %ptr_2 + %val_3 = OpLoad %uint %ptr_3 + %out_0 = OpAccessChain %_ptr_StorageBuffer_uint %out %uint_0 %uint_0 + %out_1 = OpAccessChain %_ptr_StorageBuffer_uint %out %uint_0 %uint_1 + %out_2 = OpAccessChain %_ptr_StorageBuffer_uint %out %uint_0 %uint_2 + %out_3 = OpAccessChain %_ptr_StorageBuffer_uint %out %uint_0 %uint_3 + OpStore %out_0 %val_0 + OpStore %out_1 %val_1 + OpStore %out_2 %val_2 + OpStore %out_3 %val_3 + OpReturn + OpFunctionEnd + %1 = OpExtInst %void %54 PushConstantGlobalSize %uint_0 %uint_12 + %2 = OpExtInst %void %54 Kernel %func %55 %uint_1 %uint_0 %56 + %3 = OpExtInst %void %54 ArgumentInfo %2 + %4 = OpExtInst %void %54 ArgumentPodPushConstant %58 %uint_3 %uint_16 %uint_4 %63 diff --git a/dartagnan/src/test/resources/spirv/basic/push-constants-pod.spv.dis b/dartagnan/src/test/resources/spirv/basic/push-constants-pod.spv.dis new file mode 100644 index 0000000000..d972c636ca --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/push-constants-pod.spv.dis @@ -0,0 +1,101 @@ +; @Input: %push = {{1, 2, 3}, {4, 5}, {6}, {7, 8}} +; @Input: %out = {{0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%out[0][0] == 1 and %out[0][1] == 2 and %out[0][2] == 3) +; @Output: forall (%out[0][3] == 4 and %out[0][4] == 5) +; @Output: forall (%out[0][5] == 6) +; @Output: forall (%out[0][6] == 7 and %out[0][7] == 8) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 155 +; Schema: 0 + OpCapability Shader + %ext = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %func "test" %out %push + OpSource OpenCL_C 200 + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 12 + OpMemberDecorate %_struct_3 2 Offset 20 + OpMemberDecorate %_struct_3 3 Offset 24 + OpDecorate %_struct_3 Block + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %out DescriptorSet 0 + OpDecorate %out Binding 0 + OpDecorate %out Coherent + %uint = OpTypeInt 32 0 + %v1uint = OpTypeVector %uint 1 + %v2uint = OpTypeVector %uint 2 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v2uint %v1uint %v2uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %void = OpTypeVoid + %void_func = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_5 = OpConstant %uint 5 + %uint_6 = OpConstant %uint 6 + %uint_7 = OpConstant %uint 7 + %uint_8 = OpConstant %uint 8 + %uint_12 = OpConstant %uint 12 + %uint_20 = OpConstant %uint 20 + %uint_24 = OpConstant %uint 24 + %push = OpVariable %_ptr_PushConstant__struct_3 PushConstant + %out = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %func = OpFunction %void None %void_func + %label = OpLabel + %ptr_0 = OpAccessChain %_ptr_PushConstant_uint %push %uint_0 %uint_0 + %ptr_1 = OpAccessChain %_ptr_PushConstant_uint %push %uint_0 %uint_1 + %ptr_2 = OpAccessChain %_ptr_PushConstant_uint %push %uint_0 %uint_2 + %ptr_3 = OpAccessChain %_ptr_PushConstant_uint %push %uint_1 %uint_0 + %ptr_4 = OpAccessChain %_ptr_PushConstant_uint %push %uint_1 %uint_1 + %ptr_5 = OpAccessChain %_ptr_PushConstant_uint %push %uint_2 %uint_0 + %ptr_6 = OpAccessChain %_ptr_PushConstant_uint %push %uint_3 %uint_0 + %ptr_7 = OpAccessChain %_ptr_PushConstant_uint %push %uint_3 %uint_1 + %val_0 = OpLoad %uint %ptr_0 + %val_1 = OpLoad %uint %ptr_1 + %val_2 = OpLoad %uint %ptr_2 + %val_3 = OpLoad %uint %ptr_3 + %val_4 = OpLoad %uint %ptr_4 + %val_5 = OpLoad %uint %ptr_5 + %val_6 = OpLoad %uint %ptr_6 + %val_7 = OpLoad %uint %ptr_7 + %out_0 = OpAccessChain %_ptr_StorageBuffer_uint %out %uint_0 %uint_0 + %out_1 = OpAccessChain %_ptr_StorageBuffer_uint %out %uint_0 %uint_1 + %out_2 = OpAccessChain %_ptr_StorageBuffer_uint %out %uint_0 %uint_2 + %out_3 = OpAccessChain %_ptr_StorageBuffer_uint %out %uint_0 %uint_3 + %out_4 = OpAccessChain %_ptr_StorageBuffer_uint %out %uint_0 %uint_4 + %out_5 = OpAccessChain %_ptr_StorageBuffer_uint %out %uint_0 %uint_5 + %out_6 = OpAccessChain %_ptr_StorageBuffer_uint %out %uint_0 %uint_6 + %out_7 = OpAccessChain %_ptr_StorageBuffer_uint %out %uint_0 %uint_7 + OpStore %out_0 %val_0 + OpStore %out_1 %val_1 + OpStore %out_2 %val_2 + OpStore %out_3 %val_3 + OpStore %out_4 %val_4 + OpStore %out_5 %val_5 + OpStore %out_6 %val_6 + OpStore %out_7 %val_7 + OpReturn + OpFunctionEnd + %1 = OpExtInst %void %ext ArgumentInfo %a + %2 = OpExtInst %void %ext ArgumentPodPushConstant %43 %uint_1 %uint_0 %uint_12 %1 + %3 = OpExtInst %void %ext ArgumentInfo %b + %4 = OpExtInst %void %ext ArgumentPodPushConstant %43 %uint_2 %uint_12 %uint_8 %3 + %5 = OpExtInst %void %ext ArgumentInfo %c + %6 = OpExtInst %void %ext ArgumentPodPushConstant %43 %uint_2 %uint_20 %uint_4 %5 + %7 = OpExtInst %void %ext ArgumentInfo %d + %8 = OpExtInst %void %ext ArgumentPodPushConstant %43 %uint_2 %uint_24 %uint_8 %7 \ No newline at end of file diff --git a/dartagnan/src/test/resources/spirv/basic/push-constants.spv.dis b/dartagnan/src/test/resources/spirv/basic/push-constants.spv.dis new file mode 100644 index 0000000000..7305c954dd --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/push-constants.spv.dis @@ -0,0 +1,65 @@ +; @Input: %out = {{0, 0, 0}} +; @Output: forall (%out[0][0] == 1 and %out[0][1] == 0 and %out[0][2] == 1) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 155 +; Schema: 0 + OpCapability Shader + %ext = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %func "test" %out %push + OpSource OpenCL_C 200 + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpDecorate %_struct_3 Block + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %out DescriptorSet 0 + OpDecorate %out Binding 0 + OpDecorate %out Coherent + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %void = OpTypeVoid + %void_func = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %push = OpVariable %_ptr_PushConstant__struct_3 PushConstant + %out = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %func = OpFunction %void None %void_func + %label = OpLabel + %ptr_0 = OpAccessChain %_ptr_PushConstant_uint %push %uint_0 %uint_0 + %ptr_1 = OpAccessChain %_ptr_PushConstant_uint %push %uint_1 %uint_0 + %ptr_2 = OpAccessChain %_ptr_PushConstant_uint %push %uint_2 %uint_0 + %val_0 = OpLoad %uint %ptr_0 + %val_1 = OpLoad %uint %ptr_1 + %val_2 = OpLoad %uint %ptr_2 + %out_0 = OpAccessChain %_ptr_StorageBuffer_uint %out %uint_0 %uint_0 + %out_1 = OpAccessChain %_ptr_StorageBuffer_uint %out %uint_0 %uint_1 + %out_2 = OpAccessChain %_ptr_StorageBuffer_uint %out %uint_0 %uint_2 + OpStore %out_0 %val_0 + OpStore %out_1 %val_1 + OpStore %out_2 %val_2 + OpReturn + OpFunctionEnd + %1 = OpExtInst %void %ext PushConstantGlobalSize %uint_0 %uint_12 + %2 = OpExtInst %void %ext PushConstantRegionOffset %uint_16 %uint_12 + %3 = OpExtInst %void %ext PushConstantNumWorkgroups %uint_32 %uint_12 + %4 = OpExtInst %void %ext Kernel %func %134 %uint_0 %uint_0 %135 \ No newline at end of file diff --git a/dartagnan/src/test/resources/spirv/basic/read-write.spv.dis b/dartagnan/src/test/resources/spirv/basic/read-write.spv.dis new file mode 100644 index 0000000000..c9ef064417 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/read-write.spv.dis @@ -0,0 +1,24 @@ +; @Input: %v1=1, %v2=2 +; @Output: forall (%v1==2 and %v2==1) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %func = OpTypeFunction %void + %uint = OpTypeInt 64 0 + %ptr_uint = OpTypePointer Uniform %uint + %v1 = OpVariable %ptr_uint Uniform + %v2 = OpVariable %ptr_uint Uniform + %main = OpFunction %void None %func + %label = OpLabel + %l1 = OpLoad %uint %v1 + %l2 = OpLoad %uint %v2 + OpStore %v1 %l2 + OpStore %v2 %l1 + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/rmw-extremum-false.spv.dis b/dartagnan/src/test/resources/spirv/basic/rmw-extremum-false.spv.dis new file mode 100644 index 0000000000..327849b21d --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/rmw-extremum-false.spv.dis @@ -0,0 +1,44 @@ +; @Input: %out_result = {0, 0} +; @Output: forall (%out_result[0]==2 and %out_result[1]==2) +; @Output: forall (%out_final[0]==-321 and %out_final[1]==2) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %int = OpTypeInt 64 0 + %v2int = OpTypeVector %int 2 + %ptr_int = OpTypePointer Uniform %int + %ptr_v2int = OpTypePointer Output %v2int + %c3_neg = OpConstant %int -3 + %c0 = OpConstant %int 0 + %c1 = OpConstant %int 1 + %c2 = OpConstant %int 2 + %c3 = OpConstant %int 3 + %c64 = OpConstant %int 64 + %var0 = OpVariable %ptr_int Uniform %c2 + %var1 = OpVariable %ptr_int Uniform %c2 + %out_result = OpVariable %ptr_v2int Output + %out_final = OpVariable %ptr_v2int Output + %main = OpFunction %void None %func + %label = OpLabel + %result0 = OpAtomicSMin %int %var0 %c1 %c64 %c3_neg + %result1 = OpAtomicSMax %int %var1 %c1 %c64 %c3_neg + %final0 = OpLoad %int %var0 + %final1 = OpLoad %int %var1 + %ptr_res_0 = OpAccessChain %ptr_int %out_result %c0 + %ptr_res_1 = OpAccessChain %ptr_int %out_result %c1 + OpStore %ptr_res_0 %result0 + OpStore %ptr_res_1 %result1 + %ptr_fin_0 = OpAccessChain %ptr_int %out_final %c0 + %ptr_fin_1 = OpAccessChain %ptr_int %out_final %c1 + OpStore %ptr_fin_0 %final0 + OpStore %ptr_fin_1 %final1 + OpReturn + OpFunctionEnd \ No newline at end of file diff --git a/dartagnan/src/test/resources/spirv/basic/rmw-extremum-true.spv.dis b/dartagnan/src/test/resources/spirv/basic/rmw-extremum-true.spv.dis new file mode 100644 index 0000000000..6a7e86dd82 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/rmw-extremum-true.spv.dis @@ -0,0 +1,44 @@ +; @Input: %out_result = {0, 0} +; @Output: forall (%out_result[0]==2 and %out_result[1]==2) +; @Output: forall (%out_final[0]==-3 and %out_final[1]==2) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %int = OpTypeInt 64 0 + %v2int = OpTypeVector %int 2 + %ptr_int = OpTypePointer Uniform %int + %ptr_v2int = OpTypePointer Output %v2int + %c3_neg = OpConstant %int -3 + %c0 = OpConstant %int 0 + %c1 = OpConstant %int 1 + %c2 = OpConstant %int 2 + %c3 = OpConstant %int 3 + %c64 = OpConstant %int 64 + %var0 = OpVariable %ptr_int Uniform %c2 + %var1 = OpVariable %ptr_int Uniform %c2 + %out_result = OpVariable %ptr_v2int Output + %out_final = OpVariable %ptr_v2int Output + %main = OpFunction %void None %func + %label = OpLabel + %result0 = OpAtomicSMin %int %var0 %c1 %c64 %c3_neg + %result1 = OpAtomicSMax %int %var1 %c1 %c64 %c3_neg + %final0 = OpLoad %int %var0 + %final1 = OpLoad %int %var1 + %ptr_res_0 = OpAccessChain %ptr_int %out_result %c0 + %ptr_res_1 = OpAccessChain %ptr_int %out_result %c1 + OpStore %ptr_res_0 %result0 + OpStore %ptr_res_1 %result1 + %ptr_fin_0 = OpAccessChain %ptr_int %out_final %c0 + %ptr_fin_1 = OpAccessChain %ptr_int %out_final %c1 + OpStore %ptr_fin_0 %final0 + OpStore %ptr_fin_1 %final1 + OpReturn + OpFunctionEnd \ No newline at end of file diff --git a/dartagnan/src/test/resources/spirv/basic/uninitialized-exists.spv.dis b/dartagnan/src/test/resources/spirv/basic/uninitialized-exists.spv.dis new file mode 100644 index 0000000000..4a98a2a267 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/uninitialized-exists.spv.dis @@ -0,0 +1,19 @@ +; @Output: exists (%v1 == %v2) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %func = OpTypeFunction %void + %v1 = OpVariable %ptr_uint Uniform + %v2 = OpVariable %ptr_uint Uniform + %main = OpFunction %void None %func + %label = OpLabel + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/uninitialized-forall.spv.dis b/dartagnan/src/test/resources/spirv/basic/uninitialized-forall.spv.dis new file mode 100644 index 0000000000..ba9261363a --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/uninitialized-forall.spv.dis @@ -0,0 +1,19 @@ +; @Output: forall (%v1 == %v2) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %func = OpTypeFunction %void + %v1 = OpVariable %ptr_uint Uniform + %v2 = OpVariable %ptr_uint Uniform + %main = OpFunction %void None %func + %label = OpLabel + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/uninitialized-private-exists.spv.dis b/dartagnan/src/test/resources/spirv/basic/uninitialized-private-exists.spv.dis new file mode 100644 index 0000000000..d7ccd76748 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/uninitialized-private-exists.spv.dis @@ -0,0 +1,33 @@ +; @Input: %out = {0, 0} +; @Output: exists (%out[0] == %out[1]) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + OpDecorate %ids BuiltIn GlobalInvocationId + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %v2uint = OpTypeVector %uint 2 + %ptr_uint = OpTypePointer Private %uint + %ptr_v3uint = OpTypePointer Input %v3uint + %ptr_v2uint = OpTypePointer Output %v2uint + %c0 = OpConstant %uint 0 + %ids = OpVariable %ptr_v3uint Input + %out = OpVariable %ptr_v2uint Output + %var = OpVariable %ptr_uint Private + %main = OpFunction %void None %func + %label = OpLabel + %id_ptr = OpAccessChain %ptr_uint %ids %c0 + %id = OpLoad %uint %id_ptr + %value = OpLoad %uint %var + %ptr_out = OpAccessChain %ptr_uint %out %id + OpStore %ptr_out %value + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/uninitialized-private-forall.spv.dis b/dartagnan/src/test/resources/spirv/basic/uninitialized-private-forall.spv.dis new file mode 100644 index 0000000000..08ae1cea40 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/uninitialized-private-forall.spv.dis @@ -0,0 +1,33 @@ +; @Input: %out = {0, 0} +; @Output: forall (%out[0] == %out[1]) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ids + OpSource GLSL 450 + OpDecorate %ids BuiltIn GlobalInvocationId + %void = OpTypeVoid + %bool = OpTypeBool + %func = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %v2uint = OpTypeVector %uint 2 + %ptr_uint = OpTypePointer Private %uint + %ptr_v3uint = OpTypePointer Input %v3uint + %ptr_v2uint = OpTypePointer Output %v2uint + %c0 = OpConstant %uint 0 + %ids = OpVariable %ptr_v3uint Input + %out = OpVariable %ptr_v2uint Output + %var = OpVariable %ptr_uint Private + %main = OpFunction %void None %func + %label = OpLabel + %id_ptr = OpAccessChain %ptr_uint %ids %c0 + %id = OpLoad %uint %id_ptr + %value = OpLoad %uint %var + %ptr_out = OpAccessChain %ptr_uint %out %id + OpStore %ptr_out %value + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/vector-init.spv.dis b/dartagnan/src/test/resources/spirv/basic/vector-init.spv.dis new file mode 100644 index 0000000000..7506f29efc --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/vector-init.spv.dis @@ -0,0 +1,24 @@ +; @Input: %v3v = {2, 1, 0} +; @Output: forall (%v3v[0]==2 and %v3v[1]==1 and %v3v[2]==0) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %func = OpTypeFunction %void + %uint = OpTypeInt 64 0 + %v3uint = OpTypeVector %uint 3 + %ptr_v3uint = OpTypePointer Uniform %v3uint + %ptr_uint = OpTypePointer Uniform %uint + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %v3v = OpVariable %ptr_v3uint Uniform + %main = OpFunction %void None %func + %label = OpLabel + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/vector-read-write.spv.dis b/dartagnan/src/test/resources/spirv/basic/vector-read-write.spv.dis new file mode 100644 index 0000000000..284f1d64a1 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/vector-read-write.spv.dis @@ -0,0 +1,35 @@ +; @Output: forall (%v3v[0]==2 and %v3v[1]==1 and %v3v[2]==0) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %func = OpTypeFunction %void + %uint = OpTypeInt 64 0 + %v3uint = OpTypeVector %uint 3 + %ptr_v3uint = OpTypePointer Uniform %v3uint + %ptr_uint = OpTypePointer Uniform %uint + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %v3v = OpVariable %ptr_v3uint Uniform + %main = OpFunction %void None %func + %label = OpLabel + %el0 = OpAccessChain %ptr_uint %v3v %c0 + %el1 = OpAccessChain %ptr_uint %v3v %c1 + %el2 = OpAccessChain %ptr_uint %v3v %c2 + OpStore %el0 %c0 + OpStore %el1 %c1 + OpStore %el2 %c2 + %v0 = OpLoad %uint %el0 + %v1 = OpLoad %uint %el1 + %v2 = OpLoad %uint %el2 + OpStore %el0 %v2 + OpStore %el1 %v1 + OpStore %el2 %v0 + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/basic/vector.spv.dis b/dartagnan/src/test/resources/spirv/basic/vector.spv.dis new file mode 100644 index 0000000000..bbc8078c5f --- /dev/null +++ b/dartagnan/src/test/resources/spirv/basic/vector.spv.dis @@ -0,0 +1,29 @@ +; @Output: forall (%v3v[0]==0 and %v3v[1]==1 and %v3v[2]==2) +; @Config: 1, 1, 1 +; SPIR-V +; Version: 1.0 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpSource GLSL 450 + %void = OpTypeVoid + %func = OpTypeFunction %void + %uint = OpTypeInt 64 0 + %v3uint = OpTypeVector %uint 3 + %ptr_v3uint = OpTypePointer Uniform %v3uint + %ptr_uint = OpTypePointer Uniform %uint + %c0 = OpConstant %uint 0 + %c1 = OpConstant %uint 1 + %c2 = OpConstant %uint 2 + %v3v = OpVariable %ptr_v3uint Uniform + %main = OpFunction %void None %func + %label = OpLabel + %el0 = OpAccessChain %ptr_uint %v3v %c0 + %el1 = OpAccessChain %ptr_uint %v3v %c1 + %el2 = OpAccessChain %ptr_uint %v3v %c2 + OpStore %el0 %c0 + OpStore %el1 %c1 + OpStore %el2 %c2 + OpReturn + OpFunctionEnd diff --git a/dartagnan/src/test/resources/spirv/benchmarks/CORR.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/CORR.spv.dis new file mode 100644 index 0000000000..78c0288a1f --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/CORR.spv.dis @@ -0,0 +1,155 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{0}} +; @Input: %20 = {{0}} +; @Input: %21 = {{0}} +; @Output: not exists (%18[0][0] == 2 and %19[0][0] == 1 and %20[0][0] == 1 and %21[0][0] == 2) +; @Config: 1, 1, 4 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 112 +; Schema: 0 + OpCapability Shader + %88 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "test" %gl_WorkGroupID %13 %17 %18 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %89 = OpString "test" + %90 = OpString " __kernel" + %93 = OpString "x" + %96 = OpString "r0" + %99 = OpString "r1" + %102 = OpString "r2" + %105 = OpString "r3" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 3 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 4 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %uint_64 = OpConstant %uint 64 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_5 = OpConstant %uint 5 + %uint_4 = OpConstant %uint 4 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %29 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + %30 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %uint_0 + %31 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %uint_0 + %32 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %uint_0 + %34 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %35 = OpLoad %uint %34 + %37 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %38 = OpLoad %uint %37 + %39 = OpISub %uint %uint_0 %38 + %41 = OpIEqual %bool %35 %39 + OpSelectionMerge %50 None + OpBranchConditional %41 %44 %50 + %44 = OpLabel + %47 = OpAtomicLoad %uint %28 %uint_1 %uint_64 + OpStore %29 %47 + %48 = OpAtomicLoad %uint %28 %uint_1 %uint_64 + OpStore %30 %48 + OpBranch %50 + %50 = OpLabel + %51 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %52 = OpLoad %uint %51 + %53 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %54 = OpLoad %uint %53 + %55 = OpIAdd %uint %54 %52 + %56 = OpIEqual %bool %55 %uint_1 + OpSelectionMerge %63 None + OpBranchConditional %56 %59 %63 + %59 = OpLabel + %60 = OpAtomicLoad %uint %28 %uint_1 %uint_64 + OpStore %31 %60 + %61 = OpAtomicLoad %uint %28 %uint_1 %uint_64 + OpStore %32 %61 + OpBranch %63 + %63 = OpLabel + %64 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %65 = OpLoad %uint %64 + %66 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %67 = OpLoad %uint %66 + %68 = OpIAdd %uint %67 %65 + %70 = OpIEqual %bool %68 %uint_2 + OpSelectionMerge %75 None + OpBranchConditional %70 %73 %75 + %73 = OpLabel + OpAtomicStore %28 %uint_1 %uint_64 %uint_2 + OpBranch %75 + %75 = OpLabel + %76 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %77 = OpLoad %uint %76 + %78 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %79 = OpLoad %uint %78 + %80 = OpIAdd %uint %79 %77 + %82 = OpIEqual %bool %80 %uint_3 + OpSelectionMerge %87 None + OpBranchConditional %82 %85 %87 + %85 = OpLabel + OpAtomicStore %28 %uint_1 %uint_64 %uint_1 + OpBranch %87 + %87 = OpLabel + OpReturn + OpFunctionEnd + %110 = OpExtInst %void %88 PushConstantRegionGroupOffset %uint_0 %uint_12 + %92 = OpExtInst %void %88 Kernel %24 %89 %uint_5 %uint_0 %90 + %94 = OpExtInst %void %88 ArgumentInfo %93 + %95 = OpExtInst %void %88 ArgumentStorageBuffer %92 %uint_0 %uint_0 %uint_0 %94 + %97 = OpExtInst %void %88 ArgumentInfo %96 + %98 = OpExtInst %void %88 ArgumentStorageBuffer %92 %uint_1 %uint_0 %uint_1 %97 + %100 = OpExtInst %void %88 ArgumentInfo %99 + %101 = OpExtInst %void %88 ArgumentStorageBuffer %92 %uint_2 %uint_0 %uint_2 %100 + %103 = OpExtInst %void %88 ArgumentInfo %102 + %104 = OpExtInst %void %88 ArgumentStorageBuffer %92 %uint_3 %uint_0 %uint_3 %103 + %106 = OpExtInst %void %88 ArgumentInfo %105 + %108 = OpExtInst %void %88 ArgumentStorageBuffer %92 %uint_4 %uint_0 %uint_4 %106 + %111 = OpExtInst %void %88 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/IRIW.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/IRIW.spv.dis new file mode 100644 index 0000000000..fd1c7d1179 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/IRIW.spv.dis @@ -0,0 +1,147 @@ +; @Input: %14 = {{0}} +; @Input: %15 = {{0}} +; @Input: %16 = {{0}} +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{0}} +; @Output: exists (%16[0][0] == 1 and %17[0][0] == 0 and %18[0][0] == 1 and %19[0][0] == 0) +; @Config: 4, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 103 +; Schema: 0 + OpCapability Shader + %77 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "test" %gl_LocalInvocationID %10 %14 %15 %16 %17 %18 %19 + OpSource OpenCL_C 200 + %78 = OpString "test" + %79 = OpString " __kernel" + %82 = OpString "x" + %85 = OpString "y" + %88 = OpString "r0" + %91 = OpString "r1" + %94 = OpString "r2" + %98 = OpString "r3" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_12 0 Offset 0 + OpDecorate %_struct_12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 1 + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 2 + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 3 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 4 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 5 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_12 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_12 = OpTypePointer StorageBuffer %_struct_12 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %uint_68 = OpConstant %uint 68 + %uint_2 = OpConstant %uint 2 + %uint_66 = OpConstant %uint 66 + %uint_3 = OpConstant %uint 3 + %uint_6 = OpConstant %uint 6 + %uint_4 = OpConstant %uint 4 + %uint_5 = OpConstant %uint 5 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %15 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %16 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %17 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + %26 = OpAccessChain %_ptr_StorageBuffer_uint %14 %uint_0 %uint_0 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %15 %uint_0 %uint_0 + %28 = OpAccessChain %_ptr_StorageBuffer_uint %16 %uint_0 %uint_0 + %29 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %30 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + %31 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %uint_0 + %33 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %34 = OpLoad %uint %33 + %36 = OpIEqual %bool %34 %uint_0 + OpSelectionMerge %45 None + OpBranchConditional %36 %39 %45 + %39 = OpLabel + OpAtomicStore %26 %uint_1 %uint_68 %uint_1 + %42 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %43 = OpLoad %uint %42 + OpBranch %45 + %45 = OpLabel + %46 = OpPhi %uint %34 %23 %43 %39 + %47 = OpIEqual %bool %46 %uint_1 + OpSelectionMerge %52 None + OpBranchConditional %47 %50 %52 + %50 = OpLabel + OpAtomicStore %27 %uint_1 %uint_68 %uint_1 + OpBranch %52 + %52 = OpLabel + %53 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %54 = OpLoad %uint %53 + %56 = OpIEqual %bool %54 %uint_2 + OpSelectionMerge %66 None + OpBranchConditional %56 %59 %66 + %59 = OpLabel + %61 = OpAtomicLoad %uint %26 %uint_1 %uint_66 + OpStore %28 %61 + %62 = OpAtomicLoad %uint %27 %uint_1 %uint_66 + OpStore %29 %62 + %63 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %64 = OpLoad %uint %63 + OpBranch %66 + %66 = OpLabel + %67 = OpPhi %uint %54 %52 %64 %59 + %69 = OpIEqual %bool %67 %uint_3 + OpSelectionMerge %76 None + OpBranchConditional %69 %72 %76 + %72 = OpLabel + %73 = OpAtomicLoad %uint %27 %uint_1 %uint_66 + OpStore %30 %73 + %74 = OpAtomicLoad %uint %26 %uint_1 %uint_66 + OpStore %31 %74 + OpBranch %76 + %76 = OpLabel + OpReturn + OpFunctionEnd + %81 = OpExtInst %void %77 Kernel %22 %78 %uint_6 %uint_0 %79 + %83 = OpExtInst %void %77 ArgumentInfo %82 + %84 = OpExtInst %void %77 ArgumentStorageBuffer %81 %uint_0 %uint_0 %uint_0 %83 + %86 = OpExtInst %void %77 ArgumentInfo %85 + %87 = OpExtInst %void %77 ArgumentStorageBuffer %81 %uint_1 %uint_0 %uint_1 %86 + %89 = OpExtInst %void %77 ArgumentInfo %88 + %90 = OpExtInst %void %77 ArgumentStorageBuffer %81 %uint_2 %uint_0 %uint_2 %89 + %92 = OpExtInst %void %77 ArgumentInfo %91 + %93 = OpExtInst %void %77 ArgumentStorageBuffer %81 %uint_3 %uint_0 %uint_3 %92 + %95 = OpExtInst %void %77 ArgumentInfo %94 + %97 = OpExtInst %void %77 ArgumentStorageBuffer %81 %uint_4 %uint_0 %uint_4 %95 + %99 = OpExtInst %void %77 ArgumentInfo %98 + %101 = OpExtInst %void %77 ArgumentStorageBuffer %81 %uint_5 %uint_0 %uint_5 %99 + %102 = OpExtInst %void %77 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/MP-acq2rx.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/MP-acq2rx.spv.dis new file mode 100644 index 0000000000..6a9d2bb60f --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/MP-acq2rx.spv.dis @@ -0,0 +1,118 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{0}} +; @Input: %20 = {{0}} +; @Output: forall (%19[0][0] != 1 or %20[0][0] == 1) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 80 +; Schema: 0 + OpCapability Shader + %58 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %23 "test" %gl_GlobalInvocationID %13 %17 %18 %19 %20 %5 + OpSource OpenCL_C 200 + %59 = OpString "test" + %60 = OpString " __kernel" + %63 = OpString "flag" + %66 = OpString "data" + %69 = OpString "r0" + %73 = OpString "r1" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 3 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %uint_64 = OpConstant %uint 64 + %uint_68 = OpConstant %uint 68 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %23 = OpFunction %void None %22 + %24 = OpLabel + %27 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %28 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + %29 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %uint_0 + %30 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %uint_0 + %32 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %33 = OpLoad %uint %32 + %35 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %36 = OpLoad %uint %35 + %37 = OpISub %uint %uint_0 %36 + %39 = OpINotEqual %bool %33 %37 + OpSelectionMerge %48 None + OpBranchConditional %39 %42 %48 + %42 = OpLabel + %45 = OpAtomicLoad %uint %27 %uint_1 %uint_64 + OpStore %29 %45 + %46 = OpLoad %uint %28 + OpStore %30 %46 + OpBranch %48 + %48 = OpLabel + %49 = OpPhi %bool %false %42 %true %24 + OpSelectionMerge %55 None + OpBranchConditional %49 %52 %55 + %52 = OpLabel + OpStore %28 %uint_1 + OpAtomicStore %27 %uint_1 %uint_68 %uint_1 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd + %78 = OpExtInst %void %58 PushConstantRegionOffset %uint_0 %uint_12 + %62 = OpExtInst %void %58 Kernel %23 %59 %uint_4 %uint_0 %60 + %64 = OpExtInst %void %58 ArgumentInfo %63 + %65 = OpExtInst %void %58 ArgumentStorageBuffer %62 %uint_0 %uint_0 %uint_0 %64 + %67 = OpExtInst %void %58 ArgumentInfo %66 + %68 = OpExtInst %void %58 ArgumentStorageBuffer %62 %uint_1 %uint_0 %uint_1 %67 + %70 = OpExtInst %void %58 ArgumentInfo %69 + %72 = OpExtInst %void %58 ArgumentStorageBuffer %62 %uint_2 %uint_0 %uint_2 %70 + %74 = OpExtInst %void %58 ArgumentInfo %73 + %76 = OpExtInst %void %58 ArgumentStorageBuffer %62 %uint_3 %uint_0 %uint_3 %74 + %79 = OpExtInst %void %58 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/MP-rel2rx.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/MP-rel2rx.spv.dis new file mode 100644 index 0000000000..27c43873e4 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/MP-rel2rx.spv.dis @@ -0,0 +1,118 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{0}} +; @Input: %20 = {{0}} +; @Output: forall (%19[0][0] != 1 or %20[0][0] == 1) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 80 +; Schema: 0 + OpCapability Shader + %58 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %23 "test" %gl_GlobalInvocationID %13 %17 %18 %19 %20 %5 + OpSource OpenCL_C 200 + %59 = OpString "test" + %60 = OpString " __kernel" + %63 = OpString "flag" + %66 = OpString "data" + %69 = OpString "r0" + %73 = OpString "r1" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 3 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %uint_66 = OpConstant %uint 66 + %uint_64 = OpConstant %uint 64 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %23 = OpFunction %void None %22 + %24 = OpLabel + %27 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %28 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + %29 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %uint_0 + %30 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %uint_0 + %32 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %33 = OpLoad %uint %32 + %35 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %36 = OpLoad %uint %35 + %37 = OpISub %uint %uint_0 %36 + %39 = OpINotEqual %bool %33 %37 + OpSelectionMerge %48 None + OpBranchConditional %39 %42 %48 + %42 = OpLabel + %45 = OpAtomicLoad %uint %27 %uint_1 %uint_66 + OpStore %29 %45 + %46 = OpLoad %uint %28 + OpStore %30 %46 + OpBranch %48 + %48 = OpLabel + %49 = OpPhi %bool %false %42 %true %24 + OpSelectionMerge %55 None + OpBranchConditional %49 %52 %55 + %52 = OpLabel + OpStore %28 %uint_1 + OpAtomicStore %27 %uint_1 %uint_64 %uint_1 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd + %78 = OpExtInst %void %58 PushConstantRegionOffset %uint_0 %uint_12 + %62 = OpExtInst %void %58 Kernel %23 %59 %uint_4 %uint_0 %60 + %64 = OpExtInst %void %58 ArgumentInfo %63 + %65 = OpExtInst %void %58 ArgumentStorageBuffer %62 %uint_0 %uint_0 %uint_0 %64 + %67 = OpExtInst %void %58 ArgumentInfo %66 + %68 = OpExtInst %void %58 ArgumentStorageBuffer %62 %uint_1 %uint_0 %uint_1 %67 + %70 = OpExtInst %void %58 ArgumentInfo %69 + %72 = OpExtInst %void %58 ArgumentStorageBuffer %62 %uint_2 %uint_0 %uint_2 %70 + %74 = OpExtInst %void %58 ArgumentInfo %73 + %76 = OpExtInst %void %58 ArgumentStorageBuffer %62 %uint_3 %uint_0 %uint_3 %74 + %79 = OpExtInst %void %58 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/MP.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/MP.spv.dis new file mode 100644 index 0000000000..5f4f64c44c --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/MP.spv.dis @@ -0,0 +1,118 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{0}} +; @Input: %20 = {{0}} +; @Output: forall (%19[0][0] != 1 or %20[0][0] == 1) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 80 +; Schema: 0 + OpCapability Shader + %58 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %23 "test" %gl_GlobalInvocationID %13 %17 %18 %19 %20 %5 + OpSource OpenCL_C 200 + %59 = OpString "test" + %60 = OpString " __kernel" + %63 = OpString "flag" + %66 = OpString "data" + %69 = OpString "r0" + %73 = OpString "r1" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 3 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %uint_66 = OpConstant %uint 66 + %uint_68 = OpConstant %uint 68 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %23 = OpFunction %void None %22 + %24 = OpLabel + %27 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %28 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + %29 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %uint_0 + %30 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %uint_0 + %32 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %33 = OpLoad %uint %32 + %35 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %36 = OpLoad %uint %35 + %37 = OpISub %uint %uint_0 %36 + %39 = OpINotEqual %bool %33 %37 + OpSelectionMerge %48 None + OpBranchConditional %39 %42 %48 + %42 = OpLabel + %45 = OpAtomicLoad %uint %27 %uint_1 %uint_66 + OpStore %29 %45 + %46 = OpLoad %uint %28 + OpStore %30 %46 + OpBranch %48 + %48 = OpLabel + %49 = OpPhi %bool %false %42 %true %24 + OpSelectionMerge %55 None + OpBranchConditional %49 %52 %55 + %52 = OpLabel + OpStore %28 %uint_1 + OpAtomicStore %27 %uint_1 %uint_68 %uint_1 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd + %78 = OpExtInst %void %58 PushConstantRegionOffset %uint_0 %uint_12 + %62 = OpExtInst %void %58 Kernel %23 %59 %uint_4 %uint_0 %60 + %64 = OpExtInst %void %58 ArgumentInfo %63 + %65 = OpExtInst %void %58 ArgumentStorageBuffer %62 %uint_0 %uint_0 %uint_0 %64 + %67 = OpExtInst %void %58 ArgumentInfo %66 + %68 = OpExtInst %void %58 ArgumentStorageBuffer %62 %uint_1 %uint_0 %uint_1 %67 + %70 = OpExtInst %void %58 ArgumentInfo %69 + %72 = OpExtInst %void %58 ArgumentStorageBuffer %62 %uint_2 %uint_0 %uint_2 %70 + %74 = OpExtInst %void %58 ArgumentInfo %73 + %76 = OpExtInst %void %58 ArgumentStorageBuffer %62 %uint_3 %uint_0 %uint_3 %74 + %79 = OpExtInst %void %58 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/SB.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/SB.spv.dis new file mode 100644 index 0000000000..4954ef8a1e --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/SB.spv.dis @@ -0,0 +1,107 @@ +; @Input: %14 = {{0}} +; @Input: %15 = {{0}} +; @Input: %16 = {{0}} +; @Input: %17 = {{0}} +; @Output: exists (%16[0][0] == 0 and %17[0][0] == 0) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %51 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %20 "test" %gl_LocalInvocationID %10 %14 %15 %16 %17 + OpSource OpenCL_C 200 + %52 = OpString "test" + %53 = OpString " __kernel" + %56 = OpString "x" + %59 = OpString "y" + %62 = OpString "r0" + %66 = OpString "r1" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_12 0 Offset 0 + OpDecorate %_struct_12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 1 + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 2 + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_12 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_12 = OpTypePointer StorageBuffer %_struct_12 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %uint_68 = OpConstant %uint 68 + %uint_66 = OpConstant %uint 66 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %15 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %16 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %17 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %20 = OpFunction %void None %19 + %21 = OpLabel + %24 = OpAccessChain %_ptr_StorageBuffer_uint %14 %uint_0 %uint_0 + %25 = OpAccessChain %_ptr_StorageBuffer_uint %15 %uint_0 %uint_0 + %26 = OpAccessChain %_ptr_StorageBuffer_uint %16 %uint_0 %uint_0 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %29 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %30 = OpLoad %uint %29 + %32 = OpINotEqual %bool %30 %uint_0 + OpSelectionMerge %41 None + OpBranchConditional %32 %35 %41 + %35 = OpLabel + OpAtomicStore %25 %uint_1 %uint_68 %uint_1 + %39 = OpAtomicLoad %uint %24 %uint_1 %uint_66 + OpStore %27 %39 + OpBranch %41 + %41 = OpLabel + %42 = OpPhi %bool %false %35 %true %21 + OpSelectionMerge %48 None + OpBranchConditional %42 %45 %48 + %45 = OpLabel + OpAtomicStore %24 %uint_1 %uint_68 %uint_1 + %46 = OpAtomicLoad %uint %25 %uint_1 %uint_66 + OpStore %26 %46 + OpBranch %48 + %48 = OpLabel + OpReturn + OpFunctionEnd + %55 = OpExtInst %void %51 Kernel %20 %52 %uint_4 %uint_0 %53 + %57 = OpExtInst %void %51 ArgumentInfo %56 + %58 = OpExtInst %void %51 ArgumentStorageBuffer %55 %uint_0 %uint_0 %uint_0 %57 + %60 = OpExtInst %void %51 ArgumentInfo %59 + %61 = OpExtInst %void %51 ArgumentStorageBuffer %55 %uint_1 %uint_0 %uint_1 %60 + %63 = OpExtInst %void %51 ArgumentInfo %62 + %65 = OpExtInst %void %51 ArgumentStorageBuffer %55 %uint_2 %uint_0 %uint_2 %63 + %67 = OpExtInst %void %51 ArgumentInfo %66 + %69 = OpExtInst %void %51 ArgumentStorageBuffer %55 %uint_3 %uint_0 %uint_3 %67 + %70 = OpExtInst %void %51 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/caslock-1.1.2.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/caslock-1.1.2.spv.dis new file mode 100644 index 0000000000..f8c57d51b2 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/caslock-1.1.2.spv.dis @@ -0,0 +1,101 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{-1, -1}} +; @Output: forall (%19[0][0] == -1 or %19[0][1] == -1 or %19[0][0] != %19[0][1]) +; @Config: 1, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + %49 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "mutex_test" %gl_GlobalInvocationID %13 %17 %18 %19 %5 + OpSource OpenCL_C 200 + %50 = OpString "mutex_test" + %51 = OpString " __kernel" + %54 = OpString "l" + %57 = OpString "x" + %60 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_66 = OpConstant %uint 66 + %bool = OpTypeBool + %uint_68 = OpConstant %uint 68 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + %26 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + OpBranch %29 + %29 = OpLabel + %32 = OpAtomicCompareExchange %uint %26 %uint_1 %uint_66 %uint_66 %uint_1 %uint_0 + %34 = OpIEqual %bool %32 %uint_0 + OpLoopMerge %37 %29 None + OpBranchConditional %34 %37 %29 + %37 = OpLabel + %38 = OpLoad %uint %27 + %39 = OpIAdd %uint %38 %uint_1 + OpStore %27 %39 + OpAtomicStore %26 %uint_1 %uint_68 %uint_0 + %42 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %43 = OpLoad %uint %42 + %45 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %46 = OpLoad %uint %45 + %47 = OpIAdd %uint %43 %46 + %48 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %47 + OpStore %48 %38 + OpReturn + OpFunctionEnd + %65 = OpExtInst %void %49 PushConstantRegionOffset %uint_0 %uint_12 + %53 = OpExtInst %void %49 Kernel %22 %50 %uint_3 %uint_0 %51 + %55 = OpExtInst %void %49 ArgumentInfo %54 + %56 = OpExtInst %void %49 ArgumentStorageBuffer %53 %uint_0 %uint_0 %uint_0 %55 + %58 = OpExtInst %void %49 ArgumentInfo %57 + %59 = OpExtInst %void %49 ArgumentStorageBuffer %53 %uint_1 %uint_0 %uint_1 %58 + %61 = OpExtInst %void %49 ArgumentInfo %60 + %63 = OpExtInst %void %49 ArgumentStorageBuffer %53 %uint_2 %uint_0 %uint_2 %61 + %66 = OpExtInst %void %49 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/caslock-2.1.1.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/caslock-2.1.1.spv.dis new file mode 100644 index 0000000000..88895b1212 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/caslock-2.1.1.spv.dis @@ -0,0 +1,101 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{-1, -1}} +; @Output: forall (%19[0][0] == -1 or %19[0][1] == -1 or %19[0][0] != %19[0][1]) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + %49 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "mutex_test" %gl_GlobalInvocationID %13 %17 %18 %19 %5 + OpSource OpenCL_C 200 + %50 = OpString "mutex_test" + %51 = OpString " __kernel" + %54 = OpString "l" + %57 = OpString "x" + %60 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_66 = OpConstant %uint 66 + %bool = OpTypeBool + %uint_68 = OpConstant %uint 68 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + %26 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + OpBranch %29 + %29 = OpLabel + %32 = OpAtomicCompareExchange %uint %26 %uint_1 %uint_66 %uint_66 %uint_1 %uint_0 + %34 = OpIEqual %bool %32 %uint_0 + OpLoopMerge %37 %29 None + OpBranchConditional %34 %37 %29 + %37 = OpLabel + %38 = OpLoad %uint %27 + %39 = OpIAdd %uint %38 %uint_1 + OpStore %27 %39 + OpAtomicStore %26 %uint_1 %uint_68 %uint_0 + %42 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %43 = OpLoad %uint %42 + %45 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %46 = OpLoad %uint %45 + %47 = OpIAdd %uint %43 %46 + %48 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %47 + OpStore %48 %38 + OpReturn + OpFunctionEnd + %65 = OpExtInst %void %49 PushConstantRegionOffset %uint_0 %uint_12 + %53 = OpExtInst %void %49 Kernel %22 %50 %uint_3 %uint_0 %51 + %55 = OpExtInst %void %49 ArgumentInfo %54 + %56 = OpExtInst %void %49 ArgumentStorageBuffer %53 %uint_0 %uint_0 %uint_0 %55 + %58 = OpExtInst %void %49 ArgumentInfo %57 + %59 = OpExtInst %void %49 ArgumentStorageBuffer %53 %uint_1 %uint_0 %uint_1 %58 + %61 = OpExtInst %void %49 ArgumentInfo %60 + %63 = OpExtInst %void %49 ArgumentStorageBuffer %53 %uint_2 %uint_0 %uint_2 %61 + %66 = OpExtInst %void %49 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/caslock-acq2rx.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/caslock-acq2rx.spv.dis new file mode 100644 index 0000000000..7e0bedc896 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/caslock-acq2rx.spv.dis @@ -0,0 +1,90 @@ +; @Input: %14 = {{0}} +; @Input: %15 = {{0}} +; @Input: %16 = {{-1, -1}} +; @Output: forall (%16[0][0] == -1 or %16[0][1] == -1 or %16[0][0] != %16[0][1]) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + %42 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %19 "mutex_test" %gl_LocalInvocationID %10 %14 %15 %16 + OpSource OpenCL_C 200 + %43 = OpString "mutex_test" + %44 = OpString " __kernel" + %47 = OpString "l" + %50 = OpString "x" + %53 = OpString "A" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_12 0 Offset 0 + OpDecorate %_struct_12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 1 + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 2 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_12 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_12 = OpTypePointer StorageBuffer %_struct_12 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_64 = OpConstant %uint 64 + %bool = OpTypeBool + %uint_68 = OpConstant %uint 68 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %15 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %16 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %19 = OpFunction %void None %18 + %20 = OpLabel + %23 = OpAccessChain %_ptr_StorageBuffer_uint %14 %uint_0 %uint_0 + %24 = OpAccessChain %_ptr_StorageBuffer_uint %15 %uint_0 %uint_0 + OpBranch %26 + %26 = OpLabel + %29 = OpAtomicCompareExchange %uint %23 %uint_1 %uint_64 %uint_64 %uint_1 %uint_0 + %31 = OpIEqual %bool %29 %uint_0 + OpLoopMerge %34 %26 None + OpBranchConditional %31 %34 %26 + %34 = OpLabel + %35 = OpLoad %uint %24 + %36 = OpIAdd %uint %35 %uint_1 + OpStore %24 %36 + OpAtomicStore %23 %uint_1 %uint_68 %uint_0 + %39 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %40 = OpLoad %uint %39 + %41 = OpAccessChain %_ptr_StorageBuffer_uint %16 %uint_0 %40 + OpStore %41 %35 + OpReturn + OpFunctionEnd + %46 = OpExtInst %void %42 Kernel %19 %43 %uint_3 %uint_0 %44 + %48 = OpExtInst %void %42 ArgumentInfo %47 + %49 = OpExtInst %void %42 ArgumentStorageBuffer %46 %uint_0 %uint_0 %uint_0 %48 + %51 = OpExtInst %void %42 ArgumentInfo %50 + %52 = OpExtInst %void %42 ArgumentStorageBuffer %46 %uint_1 %uint_0 %uint_1 %51 + %54 = OpExtInst %void %42 ArgumentInfo %53 + %56 = OpExtInst %void %42 ArgumentStorageBuffer %46 %uint_2 %uint_0 %uint_2 %54 + %57 = OpExtInst %void %42 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/caslock-dv2wg-1.1.2.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/caslock-dv2wg-1.1.2.spv.dis new file mode 100644 index 0000000000..fe6a66a564 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/caslock-dv2wg-1.1.2.spv.dis @@ -0,0 +1,101 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{-1, -1}} +; @Output: forall (%19[0][0] == -1 or %19[0][1] == -1 or %19[0][0] != %19[0][1]) +; @Config: 1, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + %50 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "mutex_test" %gl_GlobalInvocationID %13 %17 %18 %19 %5 + OpSource OpenCL_C 200 + %51 = OpString "mutex_test" + %52 = OpString " __kernel" + %55 = OpString "l" + %58 = OpString "x" + %61 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %uint_66 = OpConstant %uint 66 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_68 = OpConstant %uint 68 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + %26 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + OpBranch %29 + %29 = OpLabel + %33 = OpAtomicCompareExchange %uint %26 %uint_2 %uint_66 %uint_66 %uint_1 %uint_0 + %35 = OpIEqual %bool %33 %uint_0 + OpLoopMerge %38 %29 None + OpBranchConditional %35 %38 %29 + %38 = OpLabel + %39 = OpLoad %uint %27 + %40 = OpIAdd %uint %39 %uint_1 + OpStore %27 %40 + OpAtomicStore %26 %uint_2 %uint_68 %uint_0 + %43 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %44 = OpLoad %uint %43 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %48 = OpIAdd %uint %44 %47 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %48 + OpStore %49 %39 + OpReturn + OpFunctionEnd + %65 = OpExtInst %void %50 PushConstantRegionOffset %uint_0 %uint_12 + %54 = OpExtInst %void %50 Kernel %22 %51 %uint_3 %uint_0 %52 + %56 = OpExtInst %void %50 ArgumentInfo %55 + %57 = OpExtInst %void %50 ArgumentStorageBuffer %54 %uint_0 %uint_0 %uint_0 %56 + %59 = OpExtInst %void %50 ArgumentInfo %58 + %60 = OpExtInst %void %50 ArgumentStorageBuffer %54 %uint_1 %uint_0 %uint_1 %59 + %62 = OpExtInst %void %50 ArgumentInfo %61 + %63 = OpExtInst %void %50 ArgumentStorageBuffer %54 %uint_2 %uint_0 %uint_2 %62 + %66 = OpExtInst %void %50 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/caslock-dv2wg-2.1.1.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/caslock-dv2wg-2.1.1.spv.dis new file mode 100644 index 0000000000..995b5489f3 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/caslock-dv2wg-2.1.1.spv.dis @@ -0,0 +1,101 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{-1, -1}} +; @Output: forall (%19[0][0] == -1 or %19[0][1] == -1 or %19[0][0] != %19[0][1]) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + %50 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "mutex_test" %gl_GlobalInvocationID %13 %17 %18 %19 %5 + OpSource OpenCL_C 200 + %51 = OpString "mutex_test" + %52 = OpString " __kernel" + %55 = OpString "l" + %58 = OpString "x" + %61 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %uint_66 = OpConstant %uint 66 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_68 = OpConstant %uint 68 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + %26 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + OpBranch %29 + %29 = OpLabel + %33 = OpAtomicCompareExchange %uint %26 %uint_2 %uint_66 %uint_66 %uint_1 %uint_0 + %35 = OpIEqual %bool %33 %uint_0 + OpLoopMerge %38 %29 None + OpBranchConditional %35 %38 %29 + %38 = OpLabel + %39 = OpLoad %uint %27 + %40 = OpIAdd %uint %39 %uint_1 + OpStore %27 %40 + OpAtomicStore %26 %uint_2 %uint_68 %uint_0 + %43 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %44 = OpLoad %uint %43 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %48 = OpIAdd %uint %44 %47 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %48 + OpStore %49 %39 + OpReturn + OpFunctionEnd + %65 = OpExtInst %void %50 PushConstantRegionOffset %uint_0 %uint_12 + %54 = OpExtInst %void %50 Kernel %22 %51 %uint_3 %uint_0 %52 + %56 = OpExtInst %void %50 ArgumentInfo %55 + %57 = OpExtInst %void %50 ArgumentStorageBuffer %54 %uint_0 %uint_0 %uint_0 %56 + %59 = OpExtInst %void %50 ArgumentInfo %58 + %60 = OpExtInst %void %50 ArgumentStorageBuffer %54 %uint_1 %uint_0 %uint_1 %59 + %62 = OpExtInst %void %50 ArgumentInfo %61 + %63 = OpExtInst %void %50 ArgumentStorageBuffer %54 %uint_2 %uint_0 %uint_2 %62 + %66 = OpExtInst %void %50 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/caslock-dv2wg-2.2.1.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/caslock-dv2wg-2.2.1.spv.dis new file mode 100644 index 0000000000..5e94fce420 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/caslock-dv2wg-2.2.1.spv.dis @@ -0,0 +1,100 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{-1, -1, -1, -1}} +; @Config: 2, 2, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + %50 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "mutex_test" %gl_GlobalInvocationID %13 %17 %18 %19 %5 + OpSource OpenCL_C 200 + %51 = OpString "mutex_test" + %52 = OpString " __kernel" + %55 = OpString "l" + %58 = OpString "x" + %61 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %uint_66 = OpConstant %uint 66 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_68 = OpConstant %uint 68 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + %26 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + OpBranch %29 + %29 = OpLabel + %33 = OpAtomicCompareExchange %uint %26 %uint_2 %uint_66 %uint_66 %uint_1 %uint_0 + %35 = OpIEqual %bool %33 %uint_0 + OpLoopMerge %38 %29 None + OpBranchConditional %35 %38 %29 + %38 = OpLabel + %39 = OpLoad %uint %27 + %40 = OpIAdd %uint %39 %uint_1 + OpStore %27 %40 + OpAtomicStore %26 %uint_2 %uint_68 %uint_0 + %43 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %44 = OpLoad %uint %43 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %48 = OpIAdd %uint %44 %47 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %48 + OpStore %49 %39 + OpReturn + OpFunctionEnd + %65 = OpExtInst %void %50 PushConstantRegionOffset %uint_0 %uint_12 + %54 = OpExtInst %void %50 Kernel %22 %51 %uint_3 %uint_0 %52 + %56 = OpExtInst %void %50 ArgumentInfo %55 + %57 = OpExtInst %void %50 ArgumentStorageBuffer %54 %uint_0 %uint_0 %uint_0 %56 + %59 = OpExtInst %void %50 ArgumentInfo %58 + %60 = OpExtInst %void %50 ArgumentStorageBuffer %54 %uint_1 %uint_0 %uint_1 %59 + %62 = OpExtInst %void %50 ArgumentInfo %61 + %63 = OpExtInst %void %50 ArgumentStorageBuffer %54 %uint_2 %uint_0 %uint_2 %62 + %66 = OpExtInst %void %50 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/caslock-dv2wg-2.2.2.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/caslock-dv2wg-2.2.2.spv.dis new file mode 100644 index 0000000000..2370207795 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/caslock-dv2wg-2.2.2.spv.dis @@ -0,0 +1,100 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{-1, -1, -1, -1, -1, -1, -1, -1}} +; @Config: 2, 2, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + %50 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "mutex_test" %gl_GlobalInvocationID %13 %17 %18 %19 %5 + OpSource OpenCL_C 200 + %51 = OpString "mutex_test" + %52 = OpString " __kernel" + %55 = OpString "l" + %58 = OpString "x" + %61 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %uint_66 = OpConstant %uint 66 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_68 = OpConstant %uint 68 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + %26 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + OpBranch %29 + %29 = OpLabel + %33 = OpAtomicCompareExchange %uint %26 %uint_2 %uint_66 %uint_66 %uint_1 %uint_0 + %35 = OpIEqual %bool %33 %uint_0 + OpLoopMerge %38 %29 None + OpBranchConditional %35 %38 %29 + %38 = OpLabel + %39 = OpLoad %uint %27 + %40 = OpIAdd %uint %39 %uint_1 + OpStore %27 %40 + OpAtomicStore %26 %uint_2 %uint_68 %uint_0 + %43 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %44 = OpLoad %uint %43 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %48 = OpIAdd %uint %44 %47 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %48 + OpStore %49 %39 + OpReturn + OpFunctionEnd + %65 = OpExtInst %void %50 PushConstantRegionOffset %uint_0 %uint_12 + %54 = OpExtInst %void %50 Kernel %22 %51 %uint_3 %uint_0 %52 + %56 = OpExtInst %void %50 ArgumentInfo %55 + %57 = OpExtInst %void %50 ArgumentStorageBuffer %54 %uint_0 %uint_0 %uint_0 %56 + %59 = OpExtInst %void %50 ArgumentInfo %58 + %60 = OpExtInst %void %50 ArgumentStorageBuffer %54 %uint_1 %uint_0 %uint_1 %59 + %62 = OpExtInst %void %50 ArgumentInfo %61 + %63 = OpExtInst %void %50 ArgumentStorageBuffer %54 %uint_2 %uint_0 %uint_2 %62 + %66 = OpExtInst %void %50 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/caslock-rel2rx.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/caslock-rel2rx.spv.dis new file mode 100644 index 0000000000..6c18c46040 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/caslock-rel2rx.spv.dis @@ -0,0 +1,90 @@ +; @Input: %14 = {{0}} +; @Input: %15 = {{0}} +; @Input: %16 = {{-1, -1}} +; @Output: forall (%16[0][0] == -1 or %16[0][1] == -1 or %16[0][0] != %16[0][1]) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + %42 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %19 "mutex_test" %gl_LocalInvocationID %10 %14 %15 %16 + OpSource OpenCL_C 200 + %43 = OpString "mutex_test" + %44 = OpString " __kernel" + %47 = OpString "l" + %50 = OpString "x" + %53 = OpString "A" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_12 0 Offset 0 + OpDecorate %_struct_12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 1 + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 2 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_12 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_12 = OpTypePointer StorageBuffer %_struct_12 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_66 = OpConstant %uint 66 + %bool = OpTypeBool + %uint_64 = OpConstant %uint 64 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %15 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %16 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %19 = OpFunction %void None %18 + %20 = OpLabel + %23 = OpAccessChain %_ptr_StorageBuffer_uint %14 %uint_0 %uint_0 + %24 = OpAccessChain %_ptr_StorageBuffer_uint %15 %uint_0 %uint_0 + OpBranch %26 + %26 = OpLabel + %29 = OpAtomicCompareExchange %uint %23 %uint_1 %uint_66 %uint_66 %uint_1 %uint_0 + %31 = OpIEqual %bool %29 %uint_0 + OpLoopMerge %34 %26 None + OpBranchConditional %31 %34 %26 + %34 = OpLabel + %35 = OpLoad %uint %24 + %36 = OpIAdd %uint %35 %uint_1 + OpStore %24 %36 + OpAtomicStore %23 %uint_1 %uint_64 %uint_0 + %39 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %40 = OpLoad %uint %39 + %41 = OpAccessChain %_ptr_StorageBuffer_uint %16 %uint_0 %40 + OpStore %41 %35 + OpReturn + OpFunctionEnd + %46 = OpExtInst %void %42 Kernel %19 %43 %uint_3 %uint_0 %44 + %48 = OpExtInst %void %42 ArgumentInfo %47 + %49 = OpExtInst %void %42 ArgumentStorageBuffer %46 %uint_0 %uint_0 %uint_0 %48 + %51 = OpExtInst %void %42 ArgumentInfo %50 + %52 = OpExtInst %void %42 ArgumentStorageBuffer %46 %uint_1 %uint_0 %uint_1 %51 + %54 = OpExtInst %void %42 ArgumentInfo %53 + %56 = OpExtInst %void %42 ArgumentStorageBuffer %46 %uint_2 %uint_0 %uint_2 %54 + %57 = OpExtInst %void %42 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-1.1.2.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-1.1.2.spv.dis new file mode 100644 index 0000000000..21b61b7f6e --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-1.1.2.spv.dis @@ -0,0 +1,114 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{0}} +; @Input: %20 = {{-1, -1}} +; @Output: forall (%20[0][0] == -1 or %20[0][1] == -1 or %20[0][0] != %20[0][1]) +; @Config: 1, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 77 +; Schema: 0 + OpCapability Shader + %55 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %23 "mutex_test" %gl_GlobalInvocationID %13 %17 %18 %19 %20 %5 + OpSource OpenCL_C 200 + %56 = OpString "mutex_test" + %57 = OpString " __kernel" + %60 = OpString "owner" + %63 = OpString "next" + %66 = OpString "x" + %70 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 3 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_64 = OpConstant %uint 64 + %uint_66 = OpConstant %uint 66 + %bool = OpTypeBool + %uint_68 = OpConstant %uint 68 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %23 = OpFunction %void None %22 + %24 = OpLabel + %27 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %28 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + %29 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %uint_0 + %32 = OpAtomicIAdd %uint %28 %uint_1 %uint_64 %uint_1 + OpBranch %34 + %34 = OpLabel + %36 = OpAtomicLoad %uint %27 %uint_1 %uint_66 + %38 = OpIEqual %bool %36 %32 + OpLoopMerge %41 %34 None + OpBranchConditional %38 %41 %34 + %41 = OpLabel + %42 = OpLoad %uint %29 + %43 = OpIAdd %uint %42 %uint_1 + OpStore %29 %43 + %44 = OpAtomicLoad %uint %27 %uint_1 %uint_64 + %45 = OpIAdd %uint %44 %uint_1 + OpAtomicStore %27 %uint_1 %uint_68 %45 + %48 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %49 = OpLoad %uint %48 + %51 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %52 = OpLoad %uint %51 + %53 = OpIAdd %uint %49 %52 + %54 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %53 + OpStore %54 %42 + OpReturn + OpFunctionEnd + %75 = OpExtInst %void %55 PushConstantRegionOffset %uint_0 %uint_12 + %59 = OpExtInst %void %55 Kernel %23 %56 %uint_4 %uint_0 %57 + %61 = OpExtInst %void %55 ArgumentInfo %60 + %62 = OpExtInst %void %55 ArgumentStorageBuffer %59 %uint_0 %uint_0 %uint_0 %61 + %64 = OpExtInst %void %55 ArgumentInfo %63 + %65 = OpExtInst %void %55 ArgumentStorageBuffer %59 %uint_1 %uint_0 %uint_1 %64 + %67 = OpExtInst %void %55 ArgumentInfo %66 + %69 = OpExtInst %void %55 ArgumentStorageBuffer %59 %uint_2 %uint_0 %uint_2 %67 + %71 = OpExtInst %void %55 ArgumentInfo %70 + %73 = OpExtInst %void %55 ArgumentStorageBuffer %59 %uint_3 %uint_0 %uint_3 %71 + %76 = OpExtInst %void %55 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-2.1.1.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-2.1.1.spv.dis new file mode 100644 index 0000000000..ab4222b4aa --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-2.1.1.spv.dis @@ -0,0 +1,114 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{0}} +; @Input: %20 = {{-1, -1}} +; @Output: forall (%20[0][0] == -1 or %20[0][1] == -1 or %20[0][0] != %20[0][1]) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 77 +; Schema: 0 + OpCapability Shader + %55 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %23 "mutex_test" %gl_GlobalInvocationID %13 %17 %18 %19 %20 %5 + OpSource OpenCL_C 200 + %56 = OpString "mutex_test" + %57 = OpString " __kernel" + %60 = OpString "owner" + %63 = OpString "next" + %66 = OpString "x" + %70 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 3 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_64 = OpConstant %uint 64 + %uint_66 = OpConstant %uint 66 + %bool = OpTypeBool + %uint_68 = OpConstant %uint 68 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %23 = OpFunction %void None %22 + %24 = OpLabel + %27 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %28 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + %29 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %uint_0 + %32 = OpAtomicIAdd %uint %28 %uint_1 %uint_64 %uint_1 + OpBranch %34 + %34 = OpLabel + %36 = OpAtomicLoad %uint %27 %uint_1 %uint_66 + %38 = OpIEqual %bool %36 %32 + OpLoopMerge %41 %34 None + OpBranchConditional %38 %41 %34 + %41 = OpLabel + %42 = OpLoad %uint %29 + %43 = OpIAdd %uint %42 %uint_1 + OpStore %29 %43 + %44 = OpAtomicLoad %uint %27 %uint_1 %uint_64 + %45 = OpIAdd %uint %44 %uint_1 + OpAtomicStore %27 %uint_1 %uint_68 %45 + %48 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %49 = OpLoad %uint %48 + %51 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %52 = OpLoad %uint %51 + %53 = OpIAdd %uint %49 %52 + %54 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %53 + OpStore %54 %42 + OpReturn + OpFunctionEnd + %75 = OpExtInst %void %55 PushConstantRegionOffset %uint_0 %uint_12 + %59 = OpExtInst %void %55 Kernel %23 %56 %uint_4 %uint_0 %57 + %61 = OpExtInst %void %55 ArgumentInfo %60 + %62 = OpExtInst %void %55 ArgumentStorageBuffer %59 %uint_0 %uint_0 %uint_0 %61 + %64 = OpExtInst %void %55 ArgumentInfo %63 + %65 = OpExtInst %void %55 ArgumentStorageBuffer %59 %uint_1 %uint_0 %uint_1 %64 + %67 = OpExtInst %void %55 ArgumentInfo %66 + %69 = OpExtInst %void %55 ArgumentStorageBuffer %59 %uint_2 %uint_0 %uint_2 %67 + %71 = OpExtInst %void %55 ArgumentInfo %70 + %73 = OpExtInst %void %55 ArgumentStorageBuffer %59 %uint_3 %uint_0 %uint_3 %71 + %76 = OpExtInst %void %55 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-acq2rx.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-acq2rx.spv.dis new file mode 100644 index 0000000000..20b7f1bd25 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-acq2rx.spv.dis @@ -0,0 +1,102 @@ +; @Input: %14 = {{0}} +; @Input: %15 = {{0}} +; @Input: %16 = {{0}} +; @Input: %17 = {{-1, -1}} +; @Output: forall (%17[0][0] == -1 or %17[0][1] == -1 or %17[0][0] != %17[0][1]) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + %47 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %20 "mutex_test" %gl_LocalInvocationID %10 %14 %15 %16 %17 + OpSource OpenCL_C 200 + %48 = OpString "mutex_test" + %49 = OpString " __kernel" + %52 = OpString "owner" + %55 = OpString "next" + %58 = OpString "x" + %62 = OpString "A" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_12 0 Offset 0 + OpDecorate %_struct_12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 1 + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 2 + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_12 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_12 = OpTypePointer StorageBuffer %_struct_12 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_64 = OpConstant %uint 64 + %bool = OpTypeBool + %uint_68 = OpConstant %uint 68 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %15 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %16 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %17 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %20 = OpFunction %void None %19 + %21 = OpLabel + %24 = OpAccessChain %_ptr_StorageBuffer_uint %14 %uint_0 %uint_0 + %25 = OpAccessChain %_ptr_StorageBuffer_uint %15 %uint_0 %uint_0 + %26 = OpAccessChain %_ptr_StorageBuffer_uint %16 %uint_0 %uint_0 + %29 = OpAtomicIAdd %uint %25 %uint_1 %uint_64 %uint_1 + OpBranch %31 + %31 = OpLabel + %32 = OpAtomicLoad %uint %24 %uint_1 %uint_64 + %34 = OpIEqual %bool %32 %29 + OpLoopMerge %37 %31 None + OpBranchConditional %34 %37 %31 + %37 = OpLabel + %38 = OpLoad %uint %26 + %39 = OpIAdd %uint %38 %uint_1 + OpStore %26 %39 + %40 = OpAtomicLoad %uint %24 %uint_1 %uint_64 + %41 = OpIAdd %uint %40 %uint_1 + OpAtomicStore %24 %uint_1 %uint_68 %41 + %44 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %45 = OpLoad %uint %44 + %46 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %45 + OpStore %46 %38 + OpReturn + OpFunctionEnd + %51 = OpExtInst %void %47 Kernel %20 %48 %uint_4 %uint_0 %49 + %53 = OpExtInst %void %47 ArgumentInfo %52 + %54 = OpExtInst %void %47 ArgumentStorageBuffer %51 %uint_0 %uint_0 %uint_0 %53 + %56 = OpExtInst %void %47 ArgumentInfo %55 + %57 = OpExtInst %void %47 ArgumentStorageBuffer %51 %uint_1 %uint_0 %uint_1 %56 + %59 = OpExtInst %void %47 ArgumentInfo %58 + %61 = OpExtInst %void %47 ArgumentStorageBuffer %51 %uint_2 %uint_0 %uint_2 %59 + %63 = OpExtInst %void %47 ArgumentInfo %62 + %65 = OpExtInst %void %47 ArgumentStorageBuffer %51 %uint_3 %uint_0 %uint_3 %63 + %66 = OpExtInst %void %47 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-dv2wg-1.1.2.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-dv2wg-1.1.2.spv.dis new file mode 100644 index 0000000000..0b139d43b6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-dv2wg-1.1.2.spv.dis @@ -0,0 +1,114 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{0}} +; @Input: %20 = {{-1, -1}} +; @Output: forall (%20[0][0] == -1 or %20[0][1] == -1 or %20[0][0] != %20[0][1]) +; @Config: 1, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 77 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %23 "mutex_test" %gl_GlobalInvocationID %13 %17 %18 %19 %20 %5 + OpSource OpenCL_C 200 + %57 = OpString "mutex_test" + %58 = OpString " __kernel" + %61 = OpString "owner" + %64 = OpString "next" + %67 = OpString "x" + %70 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 3 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 + %uint_66 = OpConstant %uint 66 + %bool = OpTypeBool + %uint_68 = OpConstant %uint 68 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_4 = OpConstant %uint 4 + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %23 = OpFunction %void None %22 + %24 = OpLabel + %27 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %28 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + %29 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %uint_0 + %33 = OpAtomicIAdd %uint %28 %uint_2 %uint_64 %uint_1 + OpBranch %35 + %35 = OpLabel + %37 = OpAtomicLoad %uint %27 %uint_2 %uint_66 + %39 = OpIEqual %bool %37 %33 + OpLoopMerge %42 %35 None + OpBranchConditional %39 %42 %35 + %42 = OpLabel + %43 = OpLoad %uint %29 + %44 = OpIAdd %uint %43 %uint_1 + OpStore %29 %44 + %45 = OpAtomicLoad %uint %27 %uint_2 %uint_64 + %46 = OpIAdd %uint %45 %uint_1 + OpAtomicStore %27 %uint_2 %uint_68 %46 + %49 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %50 = OpLoad %uint %49 + %52 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %53 = OpLoad %uint %52 + %54 = OpIAdd %uint %50 %53 + %55 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %54 + OpStore %55 %43 + OpReturn + OpFunctionEnd + %75 = OpExtInst %void %56 PushConstantRegionOffset %uint_0 %uint_12 + %60 = OpExtInst %void %56 Kernel %23 %57 %uint_4 %uint_0 %58 + %62 = OpExtInst %void %56 ArgumentInfo %61 + %63 = OpExtInst %void %56 ArgumentStorageBuffer %60 %uint_0 %uint_0 %uint_0 %62 + %65 = OpExtInst %void %56 ArgumentInfo %64 + %66 = OpExtInst %void %56 ArgumentStorageBuffer %60 %uint_1 %uint_0 %uint_1 %65 + %68 = OpExtInst %void %56 ArgumentInfo %67 + %69 = OpExtInst %void %56 ArgumentStorageBuffer %60 %uint_2 %uint_0 %uint_2 %68 + %71 = OpExtInst %void %56 ArgumentInfo %70 + %73 = OpExtInst %void %56 ArgumentStorageBuffer %60 %uint_3 %uint_0 %uint_3 %71 + %76 = OpExtInst %void %56 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-dv2wg-2.1.1.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-dv2wg-2.1.1.spv.dis new file mode 100644 index 0000000000..5ab51f12ca --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-dv2wg-2.1.1.spv.dis @@ -0,0 +1,114 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{0}} +; @Input: %20 = {{-1, -1}} +; @Output: forall (%20[0][0] == -1 or %20[0][1] == -1 or %20[0][0] != %20[0][1]) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 77 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %23 "mutex_test" %gl_GlobalInvocationID %13 %17 %18 %19 %20 %5 + OpSource OpenCL_C 200 + %57 = OpString "mutex_test" + %58 = OpString " __kernel" + %61 = OpString "owner" + %64 = OpString "next" + %67 = OpString "x" + %70 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 3 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 + %uint_66 = OpConstant %uint 66 + %bool = OpTypeBool + %uint_68 = OpConstant %uint 68 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_4 = OpConstant %uint 4 + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %23 = OpFunction %void None %22 + %24 = OpLabel + %27 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %28 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + %29 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %uint_0 + %33 = OpAtomicIAdd %uint %28 %uint_2 %uint_64 %uint_1 + OpBranch %35 + %35 = OpLabel + %37 = OpAtomicLoad %uint %27 %uint_2 %uint_66 + %39 = OpIEqual %bool %37 %33 + OpLoopMerge %42 %35 None + OpBranchConditional %39 %42 %35 + %42 = OpLabel + %43 = OpLoad %uint %29 + %44 = OpIAdd %uint %43 %uint_1 + OpStore %29 %44 + %45 = OpAtomicLoad %uint %27 %uint_2 %uint_64 + %46 = OpIAdd %uint %45 %uint_1 + OpAtomicStore %27 %uint_2 %uint_68 %46 + %49 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %50 = OpLoad %uint %49 + %52 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %53 = OpLoad %uint %52 + %54 = OpIAdd %uint %50 %53 + %55 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %54 + OpStore %55 %43 + OpReturn + OpFunctionEnd + %75 = OpExtInst %void %56 PushConstantRegionOffset %uint_0 %uint_12 + %60 = OpExtInst %void %56 Kernel %23 %57 %uint_4 %uint_0 %58 + %62 = OpExtInst %void %56 ArgumentInfo %61 + %63 = OpExtInst %void %56 ArgumentStorageBuffer %60 %uint_0 %uint_0 %uint_0 %62 + %65 = OpExtInst %void %56 ArgumentInfo %64 + %66 = OpExtInst %void %56 ArgumentStorageBuffer %60 %uint_1 %uint_0 %uint_1 %65 + %68 = OpExtInst %void %56 ArgumentInfo %67 + %69 = OpExtInst %void %56 ArgumentStorageBuffer %60 %uint_2 %uint_0 %uint_2 %68 + %71 = OpExtInst %void %56 ArgumentInfo %70 + %73 = OpExtInst %void %56 ArgumentStorageBuffer %60 %uint_3 %uint_0 %uint_3 %71 + %76 = OpExtInst %void %56 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-dv2wg-2.2.1.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-dv2wg-2.2.1.spv.dis new file mode 100644 index 0000000000..eefbd6145b --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-dv2wg-2.2.1.spv.dis @@ -0,0 +1,113 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{0}} +; @Input: %20 = {{-1, -1, -1, -1}} +; @Config: 2, 2, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 77 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %23 "mutex_test" %gl_GlobalInvocationID %13 %17 %18 %19 %20 %5 + OpSource OpenCL_C 200 + %57 = OpString "mutex_test" + %58 = OpString " __kernel" + %61 = OpString "owner" + %64 = OpString "next" + %67 = OpString "x" + %70 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 3 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 + %uint_66 = OpConstant %uint 66 + %bool = OpTypeBool + %uint_68 = OpConstant %uint 68 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_4 = OpConstant %uint 4 + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %23 = OpFunction %void None %22 + %24 = OpLabel + %27 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %28 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + %29 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %uint_0 + %33 = OpAtomicIAdd %uint %28 %uint_2 %uint_64 %uint_1 + OpBranch %35 + %35 = OpLabel + %37 = OpAtomicLoad %uint %27 %uint_2 %uint_66 + %39 = OpIEqual %bool %37 %33 + OpLoopMerge %42 %35 None + OpBranchConditional %39 %42 %35 + %42 = OpLabel + %43 = OpLoad %uint %29 + %44 = OpIAdd %uint %43 %uint_1 + OpStore %29 %44 + %45 = OpAtomicLoad %uint %27 %uint_2 %uint_64 + %46 = OpIAdd %uint %45 %uint_1 + OpAtomicStore %27 %uint_2 %uint_68 %46 + %49 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %50 = OpLoad %uint %49 + %52 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %53 = OpLoad %uint %52 + %54 = OpIAdd %uint %50 %53 + %55 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %54 + OpStore %55 %43 + OpReturn + OpFunctionEnd + %75 = OpExtInst %void %56 PushConstantRegionOffset %uint_0 %uint_12 + %60 = OpExtInst %void %56 Kernel %23 %57 %uint_4 %uint_0 %58 + %62 = OpExtInst %void %56 ArgumentInfo %61 + %63 = OpExtInst %void %56 ArgumentStorageBuffer %60 %uint_0 %uint_0 %uint_0 %62 + %65 = OpExtInst %void %56 ArgumentInfo %64 + %66 = OpExtInst %void %56 ArgumentStorageBuffer %60 %uint_1 %uint_0 %uint_1 %65 + %68 = OpExtInst %void %56 ArgumentInfo %67 + %69 = OpExtInst %void %56 ArgumentStorageBuffer %60 %uint_2 %uint_0 %uint_2 %68 + %71 = OpExtInst %void %56 ArgumentInfo %70 + %73 = OpExtInst %void %56 ArgumentStorageBuffer %60 %uint_3 %uint_0 %uint_3 %71 + %76 = OpExtInst %void %56 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-dv2wg-2.2.2.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-dv2wg-2.2.2.spv.dis new file mode 100644 index 0000000000..96860dd07e --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-dv2wg-2.2.2.spv.dis @@ -0,0 +1,113 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{0}} +; @Input: %20 = {{-1, -1, -1, -1, -1, -1, -1, -1}} +; @Config: 2, 2, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 77 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %23 "mutex_test" %gl_GlobalInvocationID %13 %17 %18 %19 %20 %5 + OpSource OpenCL_C 200 + %57 = OpString "mutex_test" + %58 = OpString " __kernel" + %61 = OpString "owner" + %64 = OpString "next" + %67 = OpString "x" + %70 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 3 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 + %uint_66 = OpConstant %uint 66 + %bool = OpTypeBool + %uint_68 = OpConstant %uint 68 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_4 = OpConstant %uint 4 + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %23 = OpFunction %void None %22 + %24 = OpLabel + %27 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %28 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + %29 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %uint_0 + %33 = OpAtomicIAdd %uint %28 %uint_2 %uint_64 %uint_1 + OpBranch %35 + %35 = OpLabel + %37 = OpAtomicLoad %uint %27 %uint_2 %uint_66 + %39 = OpIEqual %bool %37 %33 + OpLoopMerge %42 %35 None + OpBranchConditional %39 %42 %35 + %42 = OpLabel + %43 = OpLoad %uint %29 + %44 = OpIAdd %uint %43 %uint_1 + OpStore %29 %44 + %45 = OpAtomicLoad %uint %27 %uint_2 %uint_64 + %46 = OpIAdd %uint %45 %uint_1 + OpAtomicStore %27 %uint_2 %uint_68 %46 + %49 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %50 = OpLoad %uint %49 + %52 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %53 = OpLoad %uint %52 + %54 = OpIAdd %uint %50 %53 + %55 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %54 + OpStore %55 %43 + OpReturn + OpFunctionEnd + %75 = OpExtInst %void %56 PushConstantRegionOffset %uint_0 %uint_12 + %60 = OpExtInst %void %56 Kernel %23 %57 %uint_4 %uint_0 %58 + %62 = OpExtInst %void %56 ArgumentInfo %61 + %63 = OpExtInst %void %56 ArgumentStorageBuffer %60 %uint_0 %uint_0 %uint_0 %62 + %65 = OpExtInst %void %56 ArgumentInfo %64 + %66 = OpExtInst %void %56 ArgumentStorageBuffer %60 %uint_1 %uint_0 %uint_1 %65 + %68 = OpExtInst %void %56 ArgumentInfo %67 + %69 = OpExtInst %void %56 ArgumentStorageBuffer %60 %uint_2 %uint_0 %uint_2 %68 + %71 = OpExtInst %void %56 ArgumentInfo %70 + %73 = OpExtInst %void %56 ArgumentStorageBuffer %60 %uint_3 %uint_0 %uint_3 %71 + %76 = OpExtInst %void %56 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-rel2rx.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-rel2rx.spv.dis new file mode 100644 index 0000000000..3878314c9f --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/ticketlock-rel2rx.spv.dis @@ -0,0 +1,102 @@ +; @Input: %14 = {{0}} +; @Input: %15 = {{0}} +; @Input: %16 = {{0}} +; @Input: %17 = {{-1, -1}} +; @Output: forall (%17[0][0] == -1 or %17[0][1] == -1 or %17[0][0] != %17[0][1]) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + %47 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %20 "mutex_test" %gl_LocalInvocationID %10 %14 %15 %16 %17 + OpSource OpenCL_C 200 + %48 = OpString "mutex_test" + %49 = OpString " __kernel" + %52 = OpString "owner" + %55 = OpString "next" + %58 = OpString "x" + %62 = OpString "A" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_12 0 Offset 0 + OpDecorate %_struct_12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 1 + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 2 + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_12 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_12 = OpTypePointer StorageBuffer %_struct_12 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_64 = OpConstant %uint 64 + %uint_66 = OpConstant %uint 66 + %bool = OpTypeBool +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %15 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %16 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %17 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %20 = OpFunction %void None %19 + %21 = OpLabel + %24 = OpAccessChain %_ptr_StorageBuffer_uint %14 %uint_0 %uint_0 + %25 = OpAccessChain %_ptr_StorageBuffer_uint %15 %uint_0 %uint_0 + %26 = OpAccessChain %_ptr_StorageBuffer_uint %16 %uint_0 %uint_0 + %29 = OpAtomicIAdd %uint %25 %uint_1 %uint_64 %uint_1 + OpBranch %31 + %31 = OpLabel + %33 = OpAtomicLoad %uint %24 %uint_1 %uint_66 + %35 = OpIEqual %bool %33 %29 + OpLoopMerge %38 %31 None + OpBranchConditional %35 %38 %31 + %38 = OpLabel + %39 = OpLoad %uint %26 + %40 = OpIAdd %uint %39 %uint_1 + OpStore %26 %40 + %41 = OpAtomicLoad %uint %24 %uint_1 %uint_64 + %42 = OpIAdd %uint %41 %uint_1 + OpAtomicStore %24 %uint_1 %uint_64 %42 + %44 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %45 = OpLoad %uint %44 + %46 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %45 + OpStore %46 %39 + OpReturn + OpFunctionEnd + %51 = OpExtInst %void %47 Kernel %20 %48 %uint_4 %uint_0 %49 + %53 = OpExtInst %void %47 ArgumentInfo %52 + %54 = OpExtInst %void %47 ArgumentStorageBuffer %51 %uint_0 %uint_0 %uint_0 %53 + %56 = OpExtInst %void %47 ArgumentInfo %55 + %57 = OpExtInst %void %47 ArgumentStorageBuffer %51 %uint_1 %uint_0 %uint_1 %56 + %59 = OpExtInst %void %47 ArgumentInfo %58 + %61 = OpExtInst %void %47 ArgumentStorageBuffer %51 %uint_2 %uint_0 %uint_2 %59 + %63 = OpExtInst %void %47 ArgumentInfo %62 + %65 = OpExtInst %void %47 ArgumentStorageBuffer %51 %uint_3 %uint_0 %uint_3 %63 + %66 = OpExtInst %void %47 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-1.1.2.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-1.1.2.spv.dis new file mode 100644 index 0000000000..0976b01146 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-1.1.2.spv.dis @@ -0,0 +1,119 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{-1, -1}} +; @Output: forall (%19[0][0] == -1 or %19[0][1] == -1 or %19[0][0] != %19[0][1]) +; @Config: 1, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 85 +; Schema: 0 + OpCapability Shader + %67 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "mutex_test" %gl_GlobalInvocationID %13 %17 %18 %19 %5 + OpSource OpenCL_C 200 + %68 = OpString "mutex_test" + %69 = OpString " __kernel" + %72 = OpString "l" + %75 = OpString "x" + %78 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_64 = OpConstant %uint 64 + %bool = OpTypeBool + %uint_66 = OpConstant %uint 66 + %uint_68 = OpConstant %uint 68 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + %26 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + OpBranch %29 + %29 = OpLabel + %32 = OpAtomicLoad %uint %26 %uint_1 %uint_64 + %34 = OpIEqual %bool %32 %uint_0 + OpLoopMerge %53 %50 None + OpBranch %37 + %37 = OpLabel + OpSelectionMerge %45 None + OpBranchConditional %34 %40 %45 + %40 = OpLabel + %42 = OpAtomicExchange %uint %26 %uint_1 %uint_66 %uint_1 + %43 = OpINotEqual %bool %42 %uint_0 + OpBranch %45 + %45 = OpLabel + %46 = OpPhi %bool %43 %40 %true %37 + OpBranchConditional %46 %48 %50 + %48 = OpLabel + OpBranch %50 + %50 = OpLabel + %51 = OpPhi %bool %false %48 %true %45 + OpBranchConditional %51 %53 %29 + %53 = OpLabel + %54 = OpLoad %uint %27 + %55 = OpIAdd %uint %54 %uint_1 + OpStore %27 %55 + OpAtomicStore %26 %uint_1 %uint_68 %uint_0 + %58 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %59 = OpLoad %uint %58 + %61 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %62 = OpLoad %uint %61 + %63 = OpIAdd %uint %59 %62 + %64 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %63 + OpStore %64 %54 + OpReturn + OpFunctionEnd + %83 = OpExtInst %void %67 PushConstantRegionOffset %uint_0 %uint_12 + %71 = OpExtInst %void %67 Kernel %22 %68 %uint_3 %uint_0 %69 + %73 = OpExtInst %void %67 ArgumentInfo %72 + %74 = OpExtInst %void %67 ArgumentStorageBuffer %71 %uint_0 %uint_0 %uint_0 %73 + %76 = OpExtInst %void %67 ArgumentInfo %75 + %77 = OpExtInst %void %67 ArgumentStorageBuffer %71 %uint_1 %uint_0 %uint_1 %76 + %79 = OpExtInst %void %67 ArgumentInfo %78 + %81 = OpExtInst %void %67 ArgumentStorageBuffer %71 %uint_2 %uint_0 %uint_2 %79 + %84 = OpExtInst %void %67 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-2.1.1.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-2.1.1.spv.dis new file mode 100644 index 0000000000..dc93a6416b --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-2.1.1.spv.dis @@ -0,0 +1,119 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{-1, -1}} +; @Output: forall (%19[0][0] == -1 or %19[0][1] == -1 or %19[0][0] != %19[0][1]) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 85 +; Schema: 0 + OpCapability Shader + %67 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "mutex_test" %gl_GlobalInvocationID %13 %17 %18 %19 %5 + OpSource OpenCL_C 200 + %68 = OpString "mutex_test" + %69 = OpString " __kernel" + %72 = OpString "l" + %75 = OpString "x" + %78 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_64 = OpConstant %uint 64 + %bool = OpTypeBool + %uint_66 = OpConstant %uint 66 + %uint_68 = OpConstant %uint 68 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + %26 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + OpBranch %29 + %29 = OpLabel + %32 = OpAtomicLoad %uint %26 %uint_1 %uint_64 + %34 = OpIEqual %bool %32 %uint_0 + OpLoopMerge %53 %50 None + OpBranch %37 + %37 = OpLabel + OpSelectionMerge %45 None + OpBranchConditional %34 %40 %45 + %40 = OpLabel + %42 = OpAtomicExchange %uint %26 %uint_1 %uint_66 %uint_1 + %43 = OpINotEqual %bool %42 %uint_0 + OpBranch %45 + %45 = OpLabel + %46 = OpPhi %bool %43 %40 %true %37 + OpBranchConditional %46 %48 %50 + %48 = OpLabel + OpBranch %50 + %50 = OpLabel + %51 = OpPhi %bool %false %48 %true %45 + OpBranchConditional %51 %53 %29 + %53 = OpLabel + %54 = OpLoad %uint %27 + %55 = OpIAdd %uint %54 %uint_1 + OpStore %27 %55 + OpAtomicStore %26 %uint_1 %uint_68 %uint_0 + %58 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %59 = OpLoad %uint %58 + %61 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %62 = OpLoad %uint %61 + %63 = OpIAdd %uint %59 %62 + %64 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %63 + OpStore %64 %54 + OpReturn + OpFunctionEnd + %83 = OpExtInst %void %67 PushConstantRegionOffset %uint_0 %uint_12 + %71 = OpExtInst %void %67 Kernel %22 %68 %uint_3 %uint_0 %69 + %73 = OpExtInst %void %67 ArgumentInfo %72 + %74 = OpExtInst %void %67 ArgumentStorageBuffer %71 %uint_0 %uint_0 %uint_0 %73 + %76 = OpExtInst %void %67 ArgumentInfo %75 + %77 = OpExtInst %void %67 ArgumentStorageBuffer %71 %uint_1 %uint_0 %uint_1 %76 + %79 = OpExtInst %void %67 ArgumentInfo %78 + %81 = OpExtInst %void %67 ArgumentStorageBuffer %71 %uint_2 %uint_0 %uint_2 %79 + %84 = OpExtInst %void %67 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-acq2rx.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-acq2rx.spv.dis new file mode 100644 index 0000000000..5b69439b50 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-acq2rx.spv.dis @@ -0,0 +1,107 @@ +; @Input: %14 = {{0}} +; @Input: %15 = {{0}} +; @Input: %16 = {{-1, -1}} +; @Output: forall (%16[0][0] == -1 or %16[0][1] == -1 or %16[0][0] != %16[0][1]) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 75 +; Schema: 0 + OpCapability Shader + %59 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %19 "mutex_test" %gl_LocalInvocationID %10 %14 %15 %16 + OpSource OpenCL_C 200 + %60 = OpString "mutex_test" + %61 = OpString " __kernel" + %64 = OpString "l" + %67 = OpString "x" + %70 = OpString "A" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_12 0 Offset 0 + OpDecorate %_struct_12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 1 + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 2 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_12 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_12 = OpTypePointer StorageBuffer %_struct_12 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_64 = OpConstant %uint 64 + %bool = OpTypeBool + %uint_68 = OpConstant %uint 68 +%_ptr_Input_uint = OpTypePointer Input %uint + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %15 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %16 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %19 = OpFunction %void None %18 + %20 = OpLabel + %23 = OpAccessChain %_ptr_StorageBuffer_uint %14 %uint_0 %uint_0 + %24 = OpAccessChain %_ptr_StorageBuffer_uint %15 %uint_0 %uint_0 + OpBranch %26 + %26 = OpLabel + %29 = OpAtomicLoad %uint %23 %uint_1 %uint_64 + %31 = OpIEqual %bool %29 %uint_0 + OpLoopMerge %49 %46 None + OpBranch %34 + %34 = OpLabel + OpSelectionMerge %41 None + OpBranchConditional %31 %37 %41 + %37 = OpLabel + %38 = OpAtomicExchange %uint %23 %uint_1 %uint_64 %uint_1 + %39 = OpINotEqual %bool %38 %uint_0 + OpBranch %41 + %41 = OpLabel + %42 = OpPhi %bool %39 %37 %true %34 + OpBranchConditional %42 %44 %46 + %44 = OpLabel + OpBranch %46 + %46 = OpLabel + %47 = OpPhi %bool %false %44 %true %41 + OpBranchConditional %47 %49 %26 + %49 = OpLabel + %50 = OpLoad %uint %24 + %51 = OpIAdd %uint %50 %uint_1 + OpStore %24 %51 + OpAtomicStore %23 %uint_1 %uint_68 %uint_0 + %54 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %55 = OpLoad %uint %54 + %56 = OpAccessChain %_ptr_StorageBuffer_uint %16 %uint_0 %55 + OpStore %56 %50 + OpReturn + OpFunctionEnd + %63 = OpExtInst %void %59 Kernel %19 %60 %uint_3 %uint_0 %61 + %65 = OpExtInst %void %59 ArgumentInfo %64 + %66 = OpExtInst %void %59 ArgumentStorageBuffer %63 %uint_0 %uint_0 %uint_0 %65 + %68 = OpExtInst %void %59 ArgumentInfo %67 + %69 = OpExtInst %void %59 ArgumentStorageBuffer %63 %uint_1 %uint_0 %uint_1 %68 + %71 = OpExtInst %void %59 ArgumentInfo %70 + %73 = OpExtInst %void %59 ArgumentStorageBuffer %63 %uint_2 %uint_0 %uint_2 %71 + %74 = OpExtInst %void %59 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-dv2wg-1.1.2.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-dv2wg-1.1.2.spv.dis new file mode 100644 index 0000000000..0c4efe90df --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-dv2wg-1.1.2.spv.dis @@ -0,0 +1,119 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{-1, -1}} +; @Output: forall (%19[0][0] == -1 or %19[0][1] == -1 or %19[0][0] != %19[0][1]) +; @Config: 1, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 85 +; Schema: 0 + OpCapability Shader + %68 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "mutex_test" %gl_GlobalInvocationID %13 %17 %18 %19 %5 + OpSource OpenCL_C 200 + %69 = OpString "mutex_test" + %70 = OpString " __kernel" + %73 = OpString "l" + %76 = OpString "x" + %79 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %uint_64 = OpConstant %uint 64 + %bool = OpTypeBool + %uint_66 = OpConstant %uint 66 + %uint_1 = OpConstant %uint 1 + %uint_68 = OpConstant %uint 68 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + %26 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + OpBranch %29 + %29 = OpLabel + %32 = OpAtomicLoad %uint %26 %uint_2 %uint_64 + %34 = OpIEqual %bool %32 %uint_0 + OpLoopMerge %54 %51 None + OpBranch %37 + %37 = OpLabel + OpSelectionMerge %46 None + OpBranchConditional %34 %40 %46 + %40 = OpLabel + %43 = OpAtomicExchange %uint %26 %uint_2 %uint_66 %uint_1 + %44 = OpINotEqual %bool %43 %uint_0 + OpBranch %46 + %46 = OpLabel + %47 = OpPhi %bool %44 %40 %true %37 + OpBranchConditional %47 %49 %51 + %49 = OpLabel + OpBranch %51 + %51 = OpLabel + %52 = OpPhi %bool %false %49 %true %46 + OpBranchConditional %52 %54 %29 + %54 = OpLabel + %55 = OpLoad %uint %27 + %56 = OpIAdd %uint %55 %uint_1 + OpStore %27 %56 + OpAtomicStore %26 %uint_2 %uint_68 %uint_0 + %59 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %60 = OpLoad %uint %59 + %62 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %63 = OpLoad %uint %62 + %64 = OpIAdd %uint %60 %63 + %65 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %64 + OpStore %65 %55 + OpReturn + OpFunctionEnd + %83 = OpExtInst %void %68 PushConstantRegionOffset %uint_0 %uint_12 + %72 = OpExtInst %void %68 Kernel %22 %69 %uint_3 %uint_0 %70 + %74 = OpExtInst %void %68 ArgumentInfo %73 + %75 = OpExtInst %void %68 ArgumentStorageBuffer %72 %uint_0 %uint_0 %uint_0 %74 + %77 = OpExtInst %void %68 ArgumentInfo %76 + %78 = OpExtInst %void %68 ArgumentStorageBuffer %72 %uint_1 %uint_0 %uint_1 %77 + %80 = OpExtInst %void %68 ArgumentInfo %79 + %81 = OpExtInst %void %68 ArgumentStorageBuffer %72 %uint_2 %uint_0 %uint_2 %80 + %84 = OpExtInst %void %68 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-dv2wg-2.1.1.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-dv2wg-2.1.1.spv.dis new file mode 100644 index 0000000000..b2fa3118ed --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-dv2wg-2.1.1.spv.dis @@ -0,0 +1,119 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{-1, -1}} +; @Output: forall (%19[0][0] == -1 or %19[0][1] == -1 or %19[0][0] != %19[0][1]) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 85 +; Schema: 0 + OpCapability Shader + %68 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "mutex_test" %gl_GlobalInvocationID %13 %17 %18 %19 %5 + OpSource OpenCL_C 200 + %69 = OpString "mutex_test" + %70 = OpString " __kernel" + %73 = OpString "l" + %76 = OpString "x" + %79 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %uint_64 = OpConstant %uint 64 + %bool = OpTypeBool + %uint_66 = OpConstant %uint 66 + %uint_1 = OpConstant %uint 1 + %uint_68 = OpConstant %uint 68 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + %26 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + OpBranch %29 + %29 = OpLabel + %32 = OpAtomicLoad %uint %26 %uint_2 %uint_64 + %34 = OpIEqual %bool %32 %uint_0 + OpLoopMerge %54 %51 None + OpBranch %37 + %37 = OpLabel + OpSelectionMerge %46 None + OpBranchConditional %34 %40 %46 + %40 = OpLabel + %43 = OpAtomicExchange %uint %26 %uint_2 %uint_66 %uint_1 + %44 = OpINotEqual %bool %43 %uint_0 + OpBranch %46 + %46 = OpLabel + %47 = OpPhi %bool %44 %40 %true %37 + OpBranchConditional %47 %49 %51 + %49 = OpLabel + OpBranch %51 + %51 = OpLabel + %52 = OpPhi %bool %false %49 %true %46 + OpBranchConditional %52 %54 %29 + %54 = OpLabel + %55 = OpLoad %uint %27 + %56 = OpIAdd %uint %55 %uint_1 + OpStore %27 %56 + OpAtomicStore %26 %uint_2 %uint_68 %uint_0 + %59 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %60 = OpLoad %uint %59 + %62 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %63 = OpLoad %uint %62 + %64 = OpIAdd %uint %60 %63 + %65 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %64 + OpStore %65 %55 + OpReturn + OpFunctionEnd + %83 = OpExtInst %void %68 PushConstantRegionOffset %uint_0 %uint_12 + %72 = OpExtInst %void %68 Kernel %22 %69 %uint_3 %uint_0 %70 + %74 = OpExtInst %void %68 ArgumentInfo %73 + %75 = OpExtInst %void %68 ArgumentStorageBuffer %72 %uint_0 %uint_0 %uint_0 %74 + %77 = OpExtInst %void %68 ArgumentInfo %76 + %78 = OpExtInst %void %68 ArgumentStorageBuffer %72 %uint_1 %uint_0 %uint_1 %77 + %80 = OpExtInst %void %68 ArgumentInfo %79 + %81 = OpExtInst %void %68 ArgumentStorageBuffer %72 %uint_2 %uint_0 %uint_2 %80 + %84 = OpExtInst %void %68 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-dv2wg-2.2.1.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-dv2wg-2.2.1.spv.dis new file mode 100644 index 0000000000..d89a502907 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-dv2wg-2.2.1.spv.dis @@ -0,0 +1,118 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{-1, -1, -1, -1}} +; @Config: 2, 2, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 85 +; Schema: 0 + OpCapability Shader + %68 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "mutex_test" %gl_GlobalInvocationID %13 %17 %18 %19 %5 + OpSource OpenCL_C 200 + %69 = OpString "mutex_test" + %70 = OpString " __kernel" + %73 = OpString "l" + %76 = OpString "x" + %79 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %uint_64 = OpConstant %uint 64 + %bool = OpTypeBool + %uint_66 = OpConstant %uint 66 + %uint_1 = OpConstant %uint 1 + %uint_68 = OpConstant %uint 68 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + %26 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + OpBranch %29 + %29 = OpLabel + %32 = OpAtomicLoad %uint %26 %uint_2 %uint_64 + %34 = OpIEqual %bool %32 %uint_0 + OpLoopMerge %54 %51 None + OpBranch %37 + %37 = OpLabel + OpSelectionMerge %46 None + OpBranchConditional %34 %40 %46 + %40 = OpLabel + %43 = OpAtomicExchange %uint %26 %uint_2 %uint_66 %uint_1 + %44 = OpINotEqual %bool %43 %uint_0 + OpBranch %46 + %46 = OpLabel + %47 = OpPhi %bool %44 %40 %true %37 + OpBranchConditional %47 %49 %51 + %49 = OpLabel + OpBranch %51 + %51 = OpLabel + %52 = OpPhi %bool %false %49 %true %46 + OpBranchConditional %52 %54 %29 + %54 = OpLabel + %55 = OpLoad %uint %27 + %56 = OpIAdd %uint %55 %uint_1 + OpStore %27 %56 + OpAtomicStore %26 %uint_2 %uint_68 %uint_0 + %59 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %60 = OpLoad %uint %59 + %62 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %63 = OpLoad %uint %62 + %64 = OpIAdd %uint %60 %63 + %65 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %64 + OpStore %65 %55 + OpReturn + OpFunctionEnd + %83 = OpExtInst %void %68 PushConstantRegionOffset %uint_0 %uint_12 + %72 = OpExtInst %void %68 Kernel %22 %69 %uint_3 %uint_0 %70 + %74 = OpExtInst %void %68 ArgumentInfo %73 + %75 = OpExtInst %void %68 ArgumentStorageBuffer %72 %uint_0 %uint_0 %uint_0 %74 + %77 = OpExtInst %void %68 ArgumentInfo %76 + %78 = OpExtInst %void %68 ArgumentStorageBuffer %72 %uint_1 %uint_0 %uint_1 %77 + %80 = OpExtInst %void %68 ArgumentInfo %79 + %81 = OpExtInst %void %68 ArgumentStorageBuffer %72 %uint_2 %uint_0 %uint_2 %80 + %84 = OpExtInst %void %68 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-dv2wg-2.2.2.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-dv2wg-2.2.2.spv.dis new file mode 100644 index 0000000000..009caae32c --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-dv2wg-2.2.2.spv.dis @@ -0,0 +1,118 @@ +; @Input: %17 = {{0}} +; @Input: %18 = {{0}} +; @Input: %19 = {{-1, -1, -1, -1, -1, -1, -1, -1}} +; @Config: 2, 2, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 85 +; Schema: 0 + OpCapability Shader + %68 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "mutex_test" %gl_GlobalInvocationID %13 %17 %18 %19 %5 + OpSource OpenCL_C 200 + %69 = OpString "mutex_test" + %70 = OpString " __kernel" + %73 = OpString "l" + %76 = OpString "x" + %79 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 2 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %uint_64 = OpConstant %uint 64 + %bool = OpTypeBool + %uint_66 = OpConstant %uint 66 + %uint_1 = OpConstant %uint 1 + %uint_68 = OpConstant %uint 68 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + %26 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + OpBranch %29 + %29 = OpLabel + %32 = OpAtomicLoad %uint %26 %uint_2 %uint_64 + %34 = OpIEqual %bool %32 %uint_0 + OpLoopMerge %54 %51 None + OpBranch %37 + %37 = OpLabel + OpSelectionMerge %46 None + OpBranchConditional %34 %40 %46 + %40 = OpLabel + %43 = OpAtomicExchange %uint %26 %uint_2 %uint_66 %uint_1 + %44 = OpINotEqual %bool %43 %uint_0 + OpBranch %46 + %46 = OpLabel + %47 = OpPhi %bool %44 %40 %true %37 + OpBranchConditional %47 %49 %51 + %49 = OpLabel + OpBranch %51 + %51 = OpLabel + %52 = OpPhi %bool %false %49 %true %46 + OpBranchConditional %52 %54 %29 + %54 = OpLabel + %55 = OpLoad %uint %27 + %56 = OpIAdd %uint %55 %uint_1 + OpStore %27 %56 + OpAtomicStore %26 %uint_2 %uint_68 %uint_0 + %59 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %60 = OpLoad %uint %59 + %62 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %63 = OpLoad %uint %62 + %64 = OpIAdd %uint %60 %63 + %65 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %64 + OpStore %65 %55 + OpReturn + OpFunctionEnd + %83 = OpExtInst %void %68 PushConstantRegionOffset %uint_0 %uint_12 + %72 = OpExtInst %void %68 Kernel %22 %69 %uint_3 %uint_0 %70 + %74 = OpExtInst %void %68 ArgumentInfo %73 + %75 = OpExtInst %void %68 ArgumentStorageBuffer %72 %uint_0 %uint_0 %uint_0 %74 + %77 = OpExtInst %void %68 ArgumentInfo %76 + %78 = OpExtInst %void %68 ArgumentStorageBuffer %72 %uint_1 %uint_0 %uint_1 %77 + %80 = OpExtInst %void %68 ArgumentInfo %79 + %81 = OpExtInst %void %68 ArgumentStorageBuffer %72 %uint_2 %uint_0 %uint_2 %80 + %84 = OpExtInst %void %68 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-rel2rx.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-rel2rx.spv.dis new file mode 100644 index 0000000000..4bf494e61a --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/ttaslock-rel2rx.spv.dis @@ -0,0 +1,107 @@ +; @Input: %14 = {{0}} +; @Input: %15 = {{0}} +; @Input: %16 = {{-1, -1}} +; @Output: forall (%16[0][0] == -1 or %16[0][1] == -1 or %16[0][0] != %16[0][1]) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 75 +; Schema: 0 + OpCapability Shader + %59 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %19 "mutex_test" %gl_LocalInvocationID %10 %14 %15 %16 + OpSource OpenCL_C 200 + %60 = OpString "mutex_test" + %61 = OpString " __kernel" + %64 = OpString "l" + %67 = OpString "x" + %70 = OpString "A" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_12 0 Offset 0 + OpDecorate %_struct_12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 1 + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 2 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_12 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_12 = OpTypePointer StorageBuffer %_struct_12 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_64 = OpConstant %uint 64 + %bool = OpTypeBool + %uint_66 = OpConstant %uint 66 +%_ptr_Input_uint = OpTypePointer Input %uint + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %15 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %16 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %19 = OpFunction %void None %18 + %20 = OpLabel + %23 = OpAccessChain %_ptr_StorageBuffer_uint %14 %uint_0 %uint_0 + %24 = OpAccessChain %_ptr_StorageBuffer_uint %15 %uint_0 %uint_0 + OpBranch %26 + %26 = OpLabel + %29 = OpAtomicLoad %uint %23 %uint_1 %uint_64 + %31 = OpIEqual %bool %29 %uint_0 + OpLoopMerge %50 %47 None + OpBranch %34 + %34 = OpLabel + OpSelectionMerge %42 None + OpBranchConditional %31 %37 %42 + %37 = OpLabel + %39 = OpAtomicExchange %uint %23 %uint_1 %uint_66 %uint_1 + %40 = OpINotEqual %bool %39 %uint_0 + OpBranch %42 + %42 = OpLabel + %43 = OpPhi %bool %40 %37 %true %34 + OpBranchConditional %43 %45 %47 + %45 = OpLabel + OpBranch %47 + %47 = OpLabel + %48 = OpPhi %bool %false %45 %true %42 + OpBranchConditional %48 %50 %26 + %50 = OpLabel + %51 = OpLoad %uint %24 + %52 = OpIAdd %uint %51 %uint_1 + OpStore %24 %52 + OpAtomicStore %23 %uint_1 %uint_64 %uint_0 + %54 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %55 = OpLoad %uint %54 + %56 = OpAccessChain %_ptr_StorageBuffer_uint %16 %uint_0 %55 + OpStore %56 %51 + OpReturn + OpFunctionEnd + %63 = OpExtInst %void %59 Kernel %19 %60 %uint_3 %uint_0 %61 + %65 = OpExtInst %void %59 ArgumentInfo %64 + %66 = OpExtInst %void %59 ArgumentStorageBuffer %63 %uint_0 %uint_0 %uint_0 %65 + %68 = OpExtInst %void %59 ArgumentInfo %67 + %69 = OpExtInst %void %59 ArgumentStorageBuffer %63 %uint_1 %uint_0 %uint_1 %68 + %71 = OpExtInst %void %59 ArgumentInfo %70 + %73 = OpExtInst %void %59 ArgumentStorageBuffer %63 %uint_2 %uint_0 %uint_2 %71 + %74 = OpExtInst %void %59 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-1.1.2.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-1.1.2.spv.dis new file mode 100644 index 0000000000..f461f92413 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-1.1.2.spv.dis @@ -0,0 +1,203 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 2 and %21[0][1] == 2) +; @Config: 1, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 155 +; Schema: 0 + OpCapability Shader + %133 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %134 = OpString "xf_barrier" + %135 = OpString " __kernel" + %137 = OpString "flag" + %140 = OpString "in" + %143 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %19 Coherent + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %20 Coherent + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %21 Coherent + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_72 = OpConstant %uint 72 + %uint_68 = OpConstant %uint 68 + %uint_66 = OpConstant %uint 66 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_68 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_66 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %106 None + OpBranchConditional %76 %79 %106 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %95 None + OpBranchConditional %81 %84 %95 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %89 = OpAtomicLoad %uint %86 %uint_1 %uint_66 + %90 = OpINotEqual %bool %89 %uint_0 + OpLoopMerge %93 %88 None + OpBranchConditional %90 %93 %88 + %93 = OpLabel + OpBranch %95 + %95 = OpLabel + OpBranch %97 + %97 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpSelectionMerge %104 None + OpBranchConditional %81 %100 %104 + %100 = OpLabel + %101 = OpIAdd %uint %36 %uint_1 + %102 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %101 + OpAtomicStore %102 %uint_1 %uint_68 %uint_0 + OpBranch %104 + %104 = OpLabel + OpBranch %106 + %106 = OpLabel + OpBranch %108 + %108 = OpLabel + %109 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %128 None + OpBranchConditional %109 %112 %128 + %112 = OpLabel + %113 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %114 = OpLoad %uint %113 + OpBranch %116 + %116 = OpLabel + %117 = OpPhi %uint %121 %116 %114 %112 + %118 = OpPhi %uint %122 %116 %uint_0 %112 + %119 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %118 + %120 = OpLoad %uint %119 + %121 = OpIAdd %uint %117 %120 + OpStore %113 %121 + %122 = OpIAdd %uint %118 %uint_1 + %123 = OpUGreaterThanEqual %bool %122 %47 + OpLoopMerge %126 %116 None + OpBranchConditional %123 %126 %116 + %126 = OpLabel + OpBranch %128 + %128 = OpLabel + OpBranch %130 + %130 = OpLabel + OpReturn + OpFunctionEnd + %147 = OpExtInst %void %133 PushConstantGlobalSize %uint_0 %uint_12 + %149 = OpExtInst %void %133 PushConstantRegionOffset %uint_16 %uint_12 + %151 = OpExtInst %void %133 PushConstantNumWorkgroups %uint_32 %uint_12 + %153 = OpExtInst %void %133 PushConstantRegionGroupOffset %uint_48 %uint_12 + %136 = OpExtInst %void %133 Kernel %24 %134 %uint_3 %uint_0 %135 + %138 = OpExtInst %void %133 ArgumentInfo %137 + %139 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_0 %uint_0 %uint_0 %138 + %141 = OpExtInst %void %133 ArgumentInfo %140 + %142 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_1 %uint_0 %uint_1 %141 + %144 = OpExtInst %void %133 ArgumentInfo %143 + %145 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_2 %uint_0 %uint_2 %144 + %154 = OpExtInst %void %133 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-2.1.1.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-2.1.1.spv.dis new file mode 100644 index 0000000000..88615fd5a8 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-2.1.1.spv.dis @@ -0,0 +1,203 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 2 and %21[0][1] == 2) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 155 +; Schema: 0 + OpCapability Shader + %133 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %134 = OpString "xf_barrier" + %135 = OpString " __kernel" + %137 = OpString "flag" + %140 = OpString "in" + %143 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %19 Coherent + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %20 Coherent + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %21 Coherent + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_72 = OpConstant %uint 72 + %uint_68 = OpConstant %uint 68 + %uint_66 = OpConstant %uint 66 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_68 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_66 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %106 None + OpBranchConditional %76 %79 %106 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %95 None + OpBranchConditional %81 %84 %95 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %89 = OpAtomicLoad %uint %86 %uint_1 %uint_66 + %90 = OpINotEqual %bool %89 %uint_0 + OpLoopMerge %93 %88 None + OpBranchConditional %90 %93 %88 + %93 = OpLabel + OpBranch %95 + %95 = OpLabel + OpBranch %97 + %97 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpSelectionMerge %104 None + OpBranchConditional %81 %100 %104 + %100 = OpLabel + %101 = OpIAdd %uint %36 %uint_1 + %102 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %101 + OpAtomicStore %102 %uint_1 %uint_68 %uint_0 + OpBranch %104 + %104 = OpLabel + OpBranch %106 + %106 = OpLabel + OpBranch %108 + %108 = OpLabel + %109 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %128 None + OpBranchConditional %109 %112 %128 + %112 = OpLabel + %113 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %114 = OpLoad %uint %113 + OpBranch %116 + %116 = OpLabel + %117 = OpPhi %uint %121 %116 %114 %112 + %118 = OpPhi %uint %122 %116 %uint_0 %112 + %119 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %118 + %120 = OpLoad %uint %119 + %121 = OpIAdd %uint %117 %120 + OpStore %113 %121 + %122 = OpIAdd %uint %118 %uint_1 + %123 = OpUGreaterThanEqual %bool %122 %47 + OpLoopMerge %126 %116 None + OpBranchConditional %123 %126 %116 + %126 = OpLabel + OpBranch %128 + %128 = OpLabel + OpBranch %130 + %130 = OpLabel + OpReturn + OpFunctionEnd + %147 = OpExtInst %void %133 PushConstantGlobalSize %uint_0 %uint_12 + %149 = OpExtInst %void %133 PushConstantRegionOffset %uint_16 %uint_12 + %151 = OpExtInst %void %133 PushConstantNumWorkgroups %uint_32 %uint_12 + %153 = OpExtInst %void %133 PushConstantRegionGroupOffset %uint_48 %uint_12 + %136 = OpExtInst %void %133 Kernel %24 %134 %uint_3 %uint_0 %135 + %138 = OpExtInst %void %133 ArgumentInfo %137 + %139 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_0 %uint_0 %uint_0 %138 + %141 = OpExtInst %void %133 ArgumentInfo %140 + %142 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_1 %uint_0 %uint_1 %141 + %144 = OpExtInst %void %133 ArgumentInfo %143 + %145 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_2 %uint_0 %uint_2 %144 + %154 = OpExtInst %void %133 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-2.1.2.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-2.1.2.spv.dis new file mode 100644 index 0000000000..e14e48bfcc --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-2.1.2.spv.dis @@ -0,0 +1,203 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 4 and %21[0][1] == 4 and %21[0][2] == 4 and %21[0][3] == 4) +; @Config: 2, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 155 +; Schema: 0 + OpCapability Shader + %133 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %134 = OpString "xf_barrier" + %135 = OpString " __kernel" + %137 = OpString "flag" + %140 = OpString "in" + %143 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %19 Coherent + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %20 Coherent + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %21 Coherent + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_72 = OpConstant %uint 72 + %uint_68 = OpConstant %uint 68 + %uint_66 = OpConstant %uint 66 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_68 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_66 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %106 None + OpBranchConditional %76 %79 %106 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %95 None + OpBranchConditional %81 %84 %95 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %89 = OpAtomicLoad %uint %86 %uint_1 %uint_66 + %90 = OpINotEqual %bool %89 %uint_0 + OpLoopMerge %93 %88 None + OpBranchConditional %90 %93 %88 + %93 = OpLabel + OpBranch %95 + %95 = OpLabel + OpBranch %97 + %97 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpSelectionMerge %104 None + OpBranchConditional %81 %100 %104 + %100 = OpLabel + %101 = OpIAdd %uint %36 %uint_1 + %102 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %101 + OpAtomicStore %102 %uint_1 %uint_68 %uint_0 + OpBranch %104 + %104 = OpLabel + OpBranch %106 + %106 = OpLabel + OpBranch %108 + %108 = OpLabel + %109 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %128 None + OpBranchConditional %109 %112 %128 + %112 = OpLabel + %113 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %114 = OpLoad %uint %113 + OpBranch %116 + %116 = OpLabel + %117 = OpPhi %uint %121 %116 %114 %112 + %118 = OpPhi %uint %122 %116 %uint_0 %112 + %119 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %118 + %120 = OpLoad %uint %119 + %121 = OpIAdd %uint %117 %120 + OpStore %113 %121 + %122 = OpIAdd %uint %118 %uint_1 + %123 = OpUGreaterThanEqual %bool %122 %47 + OpLoopMerge %126 %116 None + OpBranchConditional %123 %126 %116 + %126 = OpLabel + OpBranch %128 + %128 = OpLabel + OpBranch %130 + %130 = OpLabel + OpReturn + OpFunctionEnd + %147 = OpExtInst %void %133 PushConstantGlobalSize %uint_0 %uint_12 + %149 = OpExtInst %void %133 PushConstantRegionOffset %uint_16 %uint_12 + %151 = OpExtInst %void %133 PushConstantNumWorkgroups %uint_32 %uint_12 + %153 = OpExtInst %void %133 PushConstantRegionGroupOffset %uint_48 %uint_12 + %136 = OpExtInst %void %133 Kernel %24 %134 %uint_3 %uint_0 %135 + %138 = OpExtInst %void %133 ArgumentInfo %137 + %139 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_0 %uint_0 %uint_0 %138 + %141 = OpExtInst %void %133 ArgumentInfo %140 + %142 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_1 %uint_0 %uint_1 %141 + %144 = OpExtInst %void %133 ArgumentInfo %143 + %145 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_2 %uint_0 %uint_2 %144 + %154 = OpExtInst %void %133 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-3.1.3.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-3.1.3.spv.dis new file mode 100644 index 0000000000..63642dde10 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-3.1.3.spv.dis @@ -0,0 +1,205 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 9 and %21[0][1] == 9 and %21[0][2] == 9) +; @Output: forall (%21[0][3] == 9 and %21[0][4] == 9 and %21[0][5] == 9) +; @Output: forall (%21[0][6] == 9 and %21[0][7] == 9 and %21[0][8] == 9) +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 155 +; Schema: 0 + OpCapability Shader + %133 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %134 = OpString "xf_barrier" + %135 = OpString " __kernel" + %137 = OpString "flag" + %140 = OpString "in" + %143 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %19 Coherent + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %20 Coherent + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %21 Coherent + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_72 = OpConstant %uint 72 + %uint_68 = OpConstant %uint 68 + %uint_66 = OpConstant %uint 66 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_68 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_66 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %106 None + OpBranchConditional %76 %79 %106 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %95 None + OpBranchConditional %81 %84 %95 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %89 = OpAtomicLoad %uint %86 %uint_1 %uint_66 + %90 = OpINotEqual %bool %89 %uint_0 + OpLoopMerge %93 %88 None + OpBranchConditional %90 %93 %88 + %93 = OpLabel + OpBranch %95 + %95 = OpLabel + OpBranch %97 + %97 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpSelectionMerge %104 None + OpBranchConditional %81 %100 %104 + %100 = OpLabel + %101 = OpIAdd %uint %36 %uint_1 + %102 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %101 + OpAtomicStore %102 %uint_1 %uint_68 %uint_0 + OpBranch %104 + %104 = OpLabel + OpBranch %106 + %106 = OpLabel + OpBranch %108 + %108 = OpLabel + %109 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %128 None + OpBranchConditional %109 %112 %128 + %112 = OpLabel + %113 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %114 = OpLoad %uint %113 + OpBranch %116 + %116 = OpLabel + %117 = OpPhi %uint %121 %116 %114 %112 + %118 = OpPhi %uint %122 %116 %uint_0 %112 + %119 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %118 + %120 = OpLoad %uint %119 + %121 = OpIAdd %uint %117 %120 + OpStore %113 %121 + %122 = OpIAdd %uint %118 %uint_1 + %123 = OpUGreaterThanEqual %bool %122 %47 + OpLoopMerge %126 %116 None + OpBranchConditional %123 %126 %116 + %126 = OpLabel + OpBranch %128 + %128 = OpLabel + OpBranch %130 + %130 = OpLabel + OpReturn + OpFunctionEnd + %147 = OpExtInst %void %133 PushConstantGlobalSize %uint_0 %uint_12 + %149 = OpExtInst %void %133 PushConstantRegionOffset %uint_16 %uint_12 + %151 = OpExtInst %void %133 PushConstantNumWorkgroups %uint_32 %uint_12 + %153 = OpExtInst %void %133 PushConstantRegionGroupOffset %uint_48 %uint_12 + %136 = OpExtInst %void %133 Kernel %24 %134 %uint_3 %uint_0 %135 + %138 = OpExtInst %void %133 ArgumentInfo %137 + %139 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_0 %uint_0 %uint_0 %138 + %141 = OpExtInst %void %133 ArgumentInfo %140 + %142 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_1 %uint_0 %uint_1 %141 + %144 = OpExtInst %void %133 ArgumentInfo %143 + %145 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_2 %uint_0 %uint_2 %144 + %154 = OpExtInst %void %133 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-fail1.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-fail1.spv.dis new file mode 100644 index 0000000000..fecaba0fc7 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-fail1.spv.dis @@ -0,0 +1,204 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 4 and %21[0][1] == 4 and %21[0][2] == 4 and %21[0][3] == 4) +; @Config: 2, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 156 +; Schema: 0 + OpCapability Shader + %134 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %135 = OpString "xf_barrier" + %136 = OpString " __kernel" + %138 = OpString "flag" + %141 = OpString "in" + %144 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %19 Coherent + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %20 Coherent + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %21 Coherent + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_72 = OpConstant %uint 72 + %uint_68 = OpConstant %uint 68 + %uint_66 = OpConstant %uint 66 + %uint_64 = OpConstant %uint 64 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_68 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_66 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %107 None + OpBranchConditional %76 %79 %107 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %96 None + OpBranchConditional %81 %84 %96 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %90 = OpAtomicLoad %uint %86 %uint_1 %uint_64 + %91 = OpINotEqual %bool %90 %uint_0 + OpLoopMerge %94 %88 None + OpBranchConditional %91 %94 %88 + %94 = OpLabel + OpBranch %96 + %96 = OpLabel + OpBranch %98 + %98 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpSelectionMerge %105 None + OpBranchConditional %81 %101 %105 + %101 = OpLabel + %102 = OpIAdd %uint %36 %uint_1 + %103 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %102 + OpAtomicStore %103 %uint_1 %uint_68 %uint_0 + OpBranch %105 + %105 = OpLabel + OpBranch %107 + %107 = OpLabel + OpBranch %109 + %109 = OpLabel + %110 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %129 None + OpBranchConditional %110 %113 %129 + %113 = OpLabel + %114 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %115 = OpLoad %uint %114 + OpBranch %117 + %117 = OpLabel + %118 = OpPhi %uint %122 %117 %115 %113 + %119 = OpPhi %uint %123 %117 %uint_0 %113 + %120 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %119 + %121 = OpLoad %uint %120 + %122 = OpIAdd %uint %118 %121 + OpStore %114 %122 + %123 = OpIAdd %uint %119 %uint_1 + %124 = OpUGreaterThanEqual %bool %123 %47 + OpLoopMerge %127 %117 None + OpBranchConditional %124 %127 %117 + %127 = OpLabel + OpBranch %129 + %129 = OpLabel + OpBranch %131 + %131 = OpLabel + OpReturn + OpFunctionEnd + %148 = OpExtInst %void %134 PushConstantGlobalSize %uint_0 %uint_12 + %150 = OpExtInst %void %134 PushConstantRegionOffset %uint_16 %uint_12 + %152 = OpExtInst %void %134 PushConstantNumWorkgroups %uint_32 %uint_12 + %154 = OpExtInst %void %134 PushConstantRegionGroupOffset %uint_48 %uint_12 + %137 = OpExtInst %void %134 Kernel %24 %135 %uint_3 %uint_0 %136 + %139 = OpExtInst %void %134 ArgumentInfo %138 + %140 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_0 %uint_0 %uint_0 %139 + %142 = OpExtInst %void %134 ArgumentInfo %141 + %143 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_1 %uint_0 %uint_1 %142 + %145 = OpExtInst %void %134 ArgumentInfo %144 + %146 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_2 %uint_0 %uint_2 %145 + %155 = OpExtInst %void %134 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-fail2.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-fail2.spv.dis new file mode 100644 index 0000000000..fd323ea311 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-fail2.spv.dis @@ -0,0 +1,204 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 4 and %21[0][1] == 4 and %21[0][2] == 4 and %21[0][3] == 4) +; @Config: 2, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 156 +; Schema: 0 + OpCapability Shader + %134 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %135 = OpString "xf_barrier" + %136 = OpString " __kernel" + %138 = OpString "flag" + %141 = OpString "in" + %144 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %19 Coherent + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %20 Coherent + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %21 Coherent + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_72 = OpConstant %uint 72 + %uint_68 = OpConstant %uint 68 + %uint_66 = OpConstant %uint 66 + %uint_64 = OpConstant %uint 64 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_68 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_66 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %107 None + OpBranchConditional %76 %79 %107 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %95 None + OpBranchConditional %81 %84 %95 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %89 = OpAtomicLoad %uint %86 %uint_1 %uint_66 + %90 = OpINotEqual %bool %89 %uint_0 + OpLoopMerge %93 %88 None + OpBranchConditional %90 %93 %88 + %93 = OpLabel + OpBranch %95 + %95 = OpLabel + OpBranch %97 + %97 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpSelectionMerge %105 None + OpBranchConditional %81 %100 %105 + %100 = OpLabel + %101 = OpIAdd %uint %36 %uint_1 + %102 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %101 + OpAtomicStore %102 %uint_1 %uint_64 %uint_0 + OpBranch %105 + %105 = OpLabel + OpBranch %107 + %107 = OpLabel + OpBranch %109 + %109 = OpLabel + %110 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %129 None + OpBranchConditional %110 %113 %129 + %113 = OpLabel + %114 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %115 = OpLoad %uint %114 + OpBranch %117 + %117 = OpLabel + %118 = OpPhi %uint %122 %117 %115 %113 + %119 = OpPhi %uint %123 %117 %uint_0 %113 + %120 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %119 + %121 = OpLoad %uint %120 + %122 = OpIAdd %uint %118 %121 + OpStore %114 %122 + %123 = OpIAdd %uint %119 %uint_1 + %124 = OpUGreaterThanEqual %bool %123 %47 + OpLoopMerge %127 %117 None + OpBranchConditional %124 %127 %117 + %127 = OpLabel + OpBranch %129 + %129 = OpLabel + OpBranch %131 + %131 = OpLabel + OpReturn + OpFunctionEnd + %148 = OpExtInst %void %134 PushConstantGlobalSize %uint_0 %uint_12 + %150 = OpExtInst %void %134 PushConstantRegionOffset %uint_16 %uint_12 + %152 = OpExtInst %void %134 PushConstantNumWorkgroups %uint_32 %uint_12 + %154 = OpExtInst %void %134 PushConstantRegionGroupOffset %uint_48 %uint_12 + %137 = OpExtInst %void %134 Kernel %24 %135 %uint_3 %uint_0 %136 + %139 = OpExtInst %void %134 ArgumentInfo %138 + %140 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_0 %uint_0 %uint_0 %139 + %142 = OpExtInst %void %134 ArgumentInfo %141 + %143 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_1 %uint_0 %uint_1 %142 + %145 = OpExtInst %void %134 ArgumentInfo %144 + %146 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_2 %uint_0 %uint_2 %145 + %155 = OpExtInst %void %134 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-fail3.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-fail3.spv.dis new file mode 100644 index 0000000000..96f851fe65 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-fail3.spv.dis @@ -0,0 +1,204 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 4 and %21[0][1] == 4 and %21[0][2] == 4 and %21[0][3] == 4) +; @Config: 2, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 156 +; Schema: 0 + OpCapability Shader + %134 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %135 = OpString "xf_barrier" + %136 = OpString " __kernel" + %138 = OpString "flag" + %141 = OpString "in" + %144 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %19 Coherent + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %20 Coherent + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %21 Coherent + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_72 = OpConstant %uint 72 + %uint_64 = OpConstant %uint 64 + %uint_66 = OpConstant %uint 66 + %uint_68 = OpConstant %uint 68 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_64 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_66 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %107 None + OpBranchConditional %76 %79 %107 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %95 None + OpBranchConditional %81 %84 %95 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %89 = OpAtomicLoad %uint %86 %uint_1 %uint_66 + %90 = OpINotEqual %bool %89 %uint_0 + OpLoopMerge %93 %88 None + OpBranchConditional %90 %93 %88 + %93 = OpLabel + OpBranch %95 + %95 = OpLabel + OpBranch %97 + %97 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpSelectionMerge %105 None + OpBranchConditional %81 %100 %105 + %100 = OpLabel + %101 = OpIAdd %uint %36 %uint_1 + %102 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %101 + OpAtomicStore %102 %uint_1 %uint_68 %uint_0 + OpBranch %105 + %105 = OpLabel + OpBranch %107 + %107 = OpLabel + OpBranch %109 + %109 = OpLabel + %110 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %129 None + OpBranchConditional %110 %113 %129 + %113 = OpLabel + %114 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %115 = OpLoad %uint %114 + OpBranch %117 + %117 = OpLabel + %118 = OpPhi %uint %122 %117 %115 %113 + %119 = OpPhi %uint %123 %117 %uint_0 %113 + %120 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %119 + %121 = OpLoad %uint %120 + %122 = OpIAdd %uint %118 %121 + OpStore %114 %122 + %123 = OpIAdd %uint %119 %uint_1 + %124 = OpUGreaterThanEqual %bool %123 %47 + OpLoopMerge %127 %117 None + OpBranchConditional %124 %127 %117 + %127 = OpLabel + OpBranch %129 + %129 = OpLabel + OpBranch %131 + %131 = OpLabel + OpReturn + OpFunctionEnd + %148 = OpExtInst %void %134 PushConstantGlobalSize %uint_0 %uint_12 + %150 = OpExtInst %void %134 PushConstantRegionOffset %uint_16 %uint_12 + %152 = OpExtInst %void %134 PushConstantNumWorkgroups %uint_32 %uint_12 + %154 = OpExtInst %void %134 PushConstantRegionGroupOffset %uint_48 %uint_12 + %137 = OpExtInst %void %134 Kernel %24 %135 %uint_3 %uint_0 %136 + %139 = OpExtInst %void %134 ArgumentInfo %138 + %140 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_0 %uint_0 %uint_0 %139 + %142 = OpExtInst %void %134 ArgumentInfo %141 + %143 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_1 %uint_0 %uint_1 %142 + %145 = OpExtInst %void %134 ArgumentInfo %144 + %146 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_2 %uint_0 %uint_2 %145 + %155 = OpExtInst %void %134 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-fail4.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-fail4.spv.dis new file mode 100644 index 0000000000..52ba1e94e1 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-fail4.spv.dis @@ -0,0 +1,204 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 4 and %21[0][1] == 4 and %21[0][2] == 4 and %21[0][3] == 4) +; @Config: 2, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 156 +; Schema: 0 + OpCapability Shader + %134 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %135 = OpString "xf_barrier" + %136 = OpString " __kernel" + %138 = OpString "flag" + %141 = OpString "in" + %144 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %19 Coherent + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %20 Coherent + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %21 Coherent + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_72 = OpConstant %uint 72 + %uint_68 = OpConstant %uint 68 + %uint_64 = OpConstant %uint 64 + %uint_66 = OpConstant %uint 66 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_68 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_64 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %107 None + OpBranchConditional %76 %79 %107 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %96 None + OpBranchConditional %81 %84 %96 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %90 = OpAtomicLoad %uint %86 %uint_1 %uint_66 + %91 = OpINotEqual %bool %90 %uint_0 + OpLoopMerge %94 %88 None + OpBranchConditional %91 %94 %88 + %94 = OpLabel + OpBranch %96 + %96 = OpLabel + OpBranch %98 + %98 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpSelectionMerge %105 None + OpBranchConditional %81 %101 %105 + %101 = OpLabel + %102 = OpIAdd %uint %36 %uint_1 + %103 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %102 + OpAtomicStore %103 %uint_1 %uint_68 %uint_0 + OpBranch %105 + %105 = OpLabel + OpBranch %107 + %107 = OpLabel + OpBranch %109 + %109 = OpLabel + %110 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %129 None + OpBranchConditional %110 %113 %129 + %113 = OpLabel + %114 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %115 = OpLoad %uint %114 + OpBranch %117 + %117 = OpLabel + %118 = OpPhi %uint %122 %117 %115 %113 + %119 = OpPhi %uint %123 %117 %uint_0 %113 + %120 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %119 + %121 = OpLoad %uint %120 + %122 = OpIAdd %uint %118 %121 + OpStore %114 %122 + %123 = OpIAdd %uint %119 %uint_1 + %124 = OpUGreaterThanEqual %bool %123 %47 + OpLoopMerge %127 %117 None + OpBranchConditional %124 %127 %117 + %127 = OpLabel + OpBranch %129 + %129 = OpLabel + OpBranch %131 + %131 = OpLabel + OpReturn + OpFunctionEnd + %148 = OpExtInst %void %134 PushConstantGlobalSize %uint_0 %uint_12 + %150 = OpExtInst %void %134 PushConstantRegionOffset %uint_16 %uint_12 + %152 = OpExtInst %void %134 PushConstantNumWorkgroups %uint_32 %uint_12 + %154 = OpExtInst %void %134 PushConstantRegionGroupOffset %uint_48 %uint_12 + %137 = OpExtInst %void %134 Kernel %24 %135 %uint_3 %uint_0 %136 + %139 = OpExtInst %void %134 ArgumentInfo %138 + %140 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_0 %uint_0 %uint_0 %139 + %142 = OpExtInst %void %134 ArgumentInfo %141 + %143 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_1 %uint_0 %uint_1 %142 + %145 = OpExtInst %void %134 ArgumentInfo %144 + %146 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_2 %uint_0 %uint_2 %145 + %155 = OpExtInst %void %134 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-1.1.2.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-1.1.2.spv.dis new file mode 100644 index 0000000000..6893f61e39 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-1.1.2.spv.dis @@ -0,0 +1,200 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 2 and %21[0][1] == 2) +; @Config: 1, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 155 +; Schema: 0 + OpCapability Shader + %133 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %134 = OpString "xf_barrier" + %135 = OpString " __kernel" + %137 = OpString "flag" + %140 = OpString "in" + %143 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_264 = OpConstant %uint 264 + %uint_68 = OpConstant %uint 68 + %uint_66 = OpConstant %uint 66 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_68 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_66 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %106 None + OpBranchConditional %76 %79 %106 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %95 None + OpBranchConditional %81 %84 %95 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %89 = OpAtomicLoad %uint %86 %uint_1 %uint_66 + %90 = OpINotEqual %bool %89 %uint_0 + OpLoopMerge %93 %88 None + OpBranchConditional %90 %93 %88 + %93 = OpLabel + OpBranch %95 + %95 = OpLabel + OpBranch %97 + %97 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpSelectionMerge %104 None + OpBranchConditional %81 %100 %104 + %100 = OpLabel + %101 = OpIAdd %uint %36 %uint_1 + %102 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %101 + OpAtomicStore %102 %uint_1 %uint_68 %uint_0 + OpBranch %104 + %104 = OpLabel + OpBranch %106 + %106 = OpLabel + OpBranch %108 + %108 = OpLabel + %109 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %128 None + OpBranchConditional %109 %112 %128 + %112 = OpLabel + %113 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %114 = OpLoad %uint %113 + OpBranch %116 + %116 = OpLabel + %117 = OpPhi %uint %121 %116 %114 %112 + %118 = OpPhi %uint %122 %116 %uint_0 %112 + %119 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %118 + %120 = OpLoad %uint %119 + %121 = OpIAdd %uint %117 %120 + OpStore %113 %121 + %122 = OpIAdd %uint %118 %uint_1 + %123 = OpUGreaterThanEqual %bool %122 %47 + OpLoopMerge %126 %116 None + OpBranchConditional %123 %126 %116 + %126 = OpLabel + OpBranch %128 + %128 = OpLabel + OpBranch %130 + %130 = OpLabel + OpReturn + OpFunctionEnd + %147 = OpExtInst %void %133 PushConstantGlobalSize %uint_0 %uint_12 + %149 = OpExtInst %void %133 PushConstantRegionOffset %uint_16 %uint_12 + %151 = OpExtInst %void %133 PushConstantNumWorkgroups %uint_32 %uint_12 + %153 = OpExtInst %void %133 PushConstantRegionGroupOffset %uint_48 %uint_12 + %136 = OpExtInst %void %133 Kernel %24 %134 %uint_3 %uint_0 %135 + %138 = OpExtInst %void %133 ArgumentInfo %137 + %139 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_0 %uint_0 %uint_0 %138 + %141 = OpExtInst %void %133 ArgumentInfo %140 + %142 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_1 %uint_0 %uint_1 %141 + %144 = OpExtInst %void %133 ArgumentInfo %143 + %145 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_2 %uint_0 %uint_2 %144 + %154 = OpExtInst %void %133 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-2.1.1.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-2.1.1.spv.dis new file mode 100644 index 0000000000..0b3f6da23d --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-2.1.1.spv.dis @@ -0,0 +1,200 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 2 and %21[0][1] == 2) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 155 +; Schema: 0 + OpCapability Shader + %133 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %134 = OpString "xf_barrier" + %135 = OpString " __kernel" + %137 = OpString "flag" + %140 = OpString "in" + %143 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_264 = OpConstant %uint 264 + %uint_68 = OpConstant %uint 68 + %uint_66 = OpConstant %uint 66 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_68 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_66 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %106 None + OpBranchConditional %76 %79 %106 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %95 None + OpBranchConditional %81 %84 %95 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %89 = OpAtomicLoad %uint %86 %uint_1 %uint_66 + %90 = OpINotEqual %bool %89 %uint_0 + OpLoopMerge %93 %88 None + OpBranchConditional %90 %93 %88 + %93 = OpLabel + OpBranch %95 + %95 = OpLabel + OpBranch %97 + %97 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpSelectionMerge %104 None + OpBranchConditional %81 %100 %104 + %100 = OpLabel + %101 = OpIAdd %uint %36 %uint_1 + %102 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %101 + OpAtomicStore %102 %uint_1 %uint_68 %uint_0 + OpBranch %104 + %104 = OpLabel + OpBranch %106 + %106 = OpLabel + OpBranch %108 + %108 = OpLabel + %109 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %128 None + OpBranchConditional %109 %112 %128 + %112 = OpLabel + %113 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %114 = OpLoad %uint %113 + OpBranch %116 + %116 = OpLabel + %117 = OpPhi %uint %121 %116 %114 %112 + %118 = OpPhi %uint %122 %116 %uint_0 %112 + %119 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %118 + %120 = OpLoad %uint %119 + %121 = OpIAdd %uint %117 %120 + OpStore %113 %121 + %122 = OpIAdd %uint %118 %uint_1 + %123 = OpUGreaterThanEqual %bool %122 %47 + OpLoopMerge %126 %116 None + OpBranchConditional %123 %126 %116 + %126 = OpLabel + OpBranch %128 + %128 = OpLabel + OpBranch %130 + %130 = OpLabel + OpReturn + OpFunctionEnd + %147 = OpExtInst %void %133 PushConstantGlobalSize %uint_0 %uint_12 + %149 = OpExtInst %void %133 PushConstantRegionOffset %uint_16 %uint_12 + %151 = OpExtInst %void %133 PushConstantNumWorkgroups %uint_32 %uint_12 + %153 = OpExtInst %void %133 PushConstantRegionGroupOffset %uint_48 %uint_12 + %136 = OpExtInst %void %133 Kernel %24 %134 %uint_3 %uint_0 %135 + %138 = OpExtInst %void %133 ArgumentInfo %137 + %139 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_0 %uint_0 %uint_0 %138 + %141 = OpExtInst %void %133 ArgumentInfo %140 + %142 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_1 %uint_0 %uint_1 %141 + %144 = OpExtInst %void %133 ArgumentInfo %143 + %145 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_2 %uint_0 %uint_2 %144 + %154 = OpExtInst %void %133 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-2.1.2.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-2.1.2.spv.dis new file mode 100644 index 0000000000..ff564af293 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-2.1.2.spv.dis @@ -0,0 +1,200 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 4 and %21[0][1] == 4 and %21[0][2] == 4 and %21[0][3] == 4) +; @Config: 2, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 155 +; Schema: 0 + OpCapability Shader + %133 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %134 = OpString "xf_barrier" + %135 = OpString " __kernel" + %137 = OpString "flag" + %140 = OpString "in" + %143 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_264 = OpConstant %uint 264 + %uint_68 = OpConstant %uint 68 + %uint_66 = OpConstant %uint 66 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_68 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_66 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %106 None + OpBranchConditional %76 %79 %106 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %95 None + OpBranchConditional %81 %84 %95 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %89 = OpAtomicLoad %uint %86 %uint_1 %uint_66 + %90 = OpINotEqual %bool %89 %uint_0 + OpLoopMerge %93 %88 None + OpBranchConditional %90 %93 %88 + %93 = OpLabel + OpBranch %95 + %95 = OpLabel + OpBranch %97 + %97 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpSelectionMerge %104 None + OpBranchConditional %81 %100 %104 + %100 = OpLabel + %101 = OpIAdd %uint %36 %uint_1 + %102 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %101 + OpAtomicStore %102 %uint_1 %uint_68 %uint_0 + OpBranch %104 + %104 = OpLabel + OpBranch %106 + %106 = OpLabel + OpBranch %108 + %108 = OpLabel + %109 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %128 None + OpBranchConditional %109 %112 %128 + %112 = OpLabel + %113 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %114 = OpLoad %uint %113 + OpBranch %116 + %116 = OpLabel + %117 = OpPhi %uint %121 %116 %114 %112 + %118 = OpPhi %uint %122 %116 %uint_0 %112 + %119 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %118 + %120 = OpLoad %uint %119 + %121 = OpIAdd %uint %117 %120 + OpStore %113 %121 + %122 = OpIAdd %uint %118 %uint_1 + %123 = OpUGreaterThanEqual %bool %122 %47 + OpLoopMerge %126 %116 None + OpBranchConditional %123 %126 %116 + %126 = OpLabel + OpBranch %128 + %128 = OpLabel + OpBranch %130 + %130 = OpLabel + OpReturn + OpFunctionEnd + %147 = OpExtInst %void %133 PushConstantGlobalSize %uint_0 %uint_12 + %149 = OpExtInst %void %133 PushConstantRegionOffset %uint_16 %uint_12 + %151 = OpExtInst %void %133 PushConstantNumWorkgroups %uint_32 %uint_12 + %153 = OpExtInst %void %133 PushConstantRegionGroupOffset %uint_48 %uint_12 + %136 = OpExtInst %void %133 Kernel %24 %134 %uint_3 %uint_0 %135 + %138 = OpExtInst %void %133 ArgumentInfo %137 + %139 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_0 %uint_0 %uint_0 %138 + %141 = OpExtInst %void %133 ArgumentInfo %140 + %142 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_1 %uint_0 %uint_1 %141 + %144 = OpExtInst %void %133 ArgumentInfo %143 + %145 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_2 %uint_0 %uint_2 %144 + %154 = OpExtInst %void %133 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-3.1.3.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-3.1.3.spv.dis new file mode 100644 index 0000000000..8c0756b644 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-3.1.3.spv.dis @@ -0,0 +1,202 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 9 and %21[0][1] == 9 and %21[0][2] == 9) +; @Output: forall (%21[0][3] == 9 and %21[0][4] == 9 and %21[0][5] == 9) +; @Output: forall (%21[0][6] == 9 and %21[0][7] == 9 and %21[0][8] == 9) +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 155 +; Schema: 0 + OpCapability Shader + %133 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %134 = OpString "xf_barrier" + %135 = OpString " __kernel" + %137 = OpString "flag" + %140 = OpString "in" + %143 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_264 = OpConstant %uint 264 + %uint_68 = OpConstant %uint 68 + %uint_66 = OpConstant %uint 66 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_68 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_66 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %106 None + OpBranchConditional %76 %79 %106 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %95 None + OpBranchConditional %81 %84 %95 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %89 = OpAtomicLoad %uint %86 %uint_1 %uint_66 + %90 = OpINotEqual %bool %89 %uint_0 + OpLoopMerge %93 %88 None + OpBranchConditional %90 %93 %88 + %93 = OpLabel + OpBranch %95 + %95 = OpLabel + OpBranch %97 + %97 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpSelectionMerge %104 None + OpBranchConditional %81 %100 %104 + %100 = OpLabel + %101 = OpIAdd %uint %36 %uint_1 + %102 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %101 + OpAtomicStore %102 %uint_1 %uint_68 %uint_0 + OpBranch %104 + %104 = OpLabel + OpBranch %106 + %106 = OpLabel + OpBranch %108 + %108 = OpLabel + %109 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %128 None + OpBranchConditional %109 %112 %128 + %112 = OpLabel + %113 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %114 = OpLoad %uint %113 + OpBranch %116 + %116 = OpLabel + %117 = OpPhi %uint %121 %116 %114 %112 + %118 = OpPhi %uint %122 %116 %uint_0 %112 + %119 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %118 + %120 = OpLoad %uint %119 + %121 = OpIAdd %uint %117 %120 + OpStore %113 %121 + %122 = OpIAdd %uint %118 %uint_1 + %123 = OpUGreaterThanEqual %bool %122 %47 + OpLoopMerge %126 %116 None + OpBranchConditional %123 %126 %116 + %126 = OpLabel + OpBranch %128 + %128 = OpLabel + OpBranch %130 + %130 = OpLabel + OpReturn + OpFunctionEnd + %147 = OpExtInst %void %133 PushConstantGlobalSize %uint_0 %uint_12 + %149 = OpExtInst %void %133 PushConstantRegionOffset %uint_16 %uint_12 + %151 = OpExtInst %void %133 PushConstantNumWorkgroups %uint_32 %uint_12 + %153 = OpExtInst %void %133 PushConstantRegionGroupOffset %uint_48 %uint_12 + %136 = OpExtInst %void %133 Kernel %24 %134 %uint_3 %uint_0 %135 + %138 = OpExtInst %void %133 ArgumentInfo %137 + %139 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_0 %uint_0 %uint_0 %138 + %141 = OpExtInst %void %133 ArgumentInfo %140 + %142 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_1 %uint_0 %uint_1 %141 + %144 = OpExtInst %void %133 ArgumentInfo %143 + %145 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_2 %uint_0 %uint_2 %144 + %154 = OpExtInst %void %133 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-fail1.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-fail1.spv.dis new file mode 100644 index 0000000000..3965304f30 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-fail1.spv.dis @@ -0,0 +1,201 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 4 and %21[0][1] == 4 and %21[0][2] == 4 and %21[0][3] == 4) +; @Config: 2, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 156 +; Schema: 0 + OpCapability Shader + %134 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %135 = OpString "xf_barrier" + %136 = OpString " __kernel" + %138 = OpString "flag" + %141 = OpString "in" + %144 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_264 = OpConstant %uint 264 + %uint_68 = OpConstant %uint 68 + %uint_66 = OpConstant %uint 66 + %uint_64 = OpConstant %uint 64 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_68 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_66 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %107 None + OpBranchConditional %76 %79 %107 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %96 None + OpBranchConditional %81 %84 %96 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %90 = OpAtomicLoad %uint %86 %uint_1 %uint_64 + %91 = OpINotEqual %bool %90 %uint_0 + OpLoopMerge %94 %88 None + OpBranchConditional %91 %94 %88 + %94 = OpLabel + OpBranch %96 + %96 = OpLabel + OpBranch %98 + %98 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpSelectionMerge %105 None + OpBranchConditional %81 %101 %105 + %101 = OpLabel + %102 = OpIAdd %uint %36 %uint_1 + %103 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %102 + OpAtomicStore %103 %uint_1 %uint_68 %uint_0 + OpBranch %105 + %105 = OpLabel + OpBranch %107 + %107 = OpLabel + OpBranch %109 + %109 = OpLabel + %110 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %129 None + OpBranchConditional %110 %113 %129 + %113 = OpLabel + %114 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %115 = OpLoad %uint %114 + OpBranch %117 + %117 = OpLabel + %118 = OpPhi %uint %122 %117 %115 %113 + %119 = OpPhi %uint %123 %117 %uint_0 %113 + %120 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %119 + %121 = OpLoad %uint %120 + %122 = OpIAdd %uint %118 %121 + OpStore %114 %122 + %123 = OpIAdd %uint %119 %uint_1 + %124 = OpUGreaterThanEqual %bool %123 %47 + OpLoopMerge %127 %117 None + OpBranchConditional %124 %127 %117 + %127 = OpLabel + OpBranch %129 + %129 = OpLabel + OpBranch %131 + %131 = OpLabel + OpReturn + OpFunctionEnd + %148 = OpExtInst %void %134 PushConstantGlobalSize %uint_0 %uint_12 + %150 = OpExtInst %void %134 PushConstantRegionOffset %uint_16 %uint_12 + %152 = OpExtInst %void %134 PushConstantNumWorkgroups %uint_32 %uint_12 + %154 = OpExtInst %void %134 PushConstantRegionGroupOffset %uint_48 %uint_12 + %137 = OpExtInst %void %134 Kernel %24 %135 %uint_3 %uint_0 %136 + %139 = OpExtInst %void %134 ArgumentInfo %138 + %140 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_0 %uint_0 %uint_0 %139 + %142 = OpExtInst %void %134 ArgumentInfo %141 + %143 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_1 %uint_0 %uint_1 %142 + %145 = OpExtInst %void %134 ArgumentInfo %144 + %146 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_2 %uint_0 %uint_2 %145 + %155 = OpExtInst %void %134 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-fail2.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-fail2.spv.dis new file mode 100644 index 0000000000..240d5754a8 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-fail2.spv.dis @@ -0,0 +1,201 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 4 and %21[0][1] == 4 and %21[0][2] == 4 and %21[0][3] == 4) +; @Config: 2, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 156 +; Schema: 0 + OpCapability Shader + %134 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %135 = OpString "xf_barrier" + %136 = OpString " __kernel" + %138 = OpString "flag" + %141 = OpString "in" + %144 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_264 = OpConstant %uint 264 + %uint_68 = OpConstant %uint 68 + %uint_66 = OpConstant %uint 66 + %uint_64 = OpConstant %uint 64 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_68 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_66 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %107 None + OpBranchConditional %76 %79 %107 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %95 None + OpBranchConditional %81 %84 %95 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %89 = OpAtomicLoad %uint %86 %uint_1 %uint_66 + %90 = OpINotEqual %bool %89 %uint_0 + OpLoopMerge %93 %88 None + OpBranchConditional %90 %93 %88 + %93 = OpLabel + OpBranch %95 + %95 = OpLabel + OpBranch %97 + %97 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpSelectionMerge %105 None + OpBranchConditional %81 %100 %105 + %100 = OpLabel + %101 = OpIAdd %uint %36 %uint_1 + %102 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %101 + OpAtomicStore %102 %uint_1 %uint_64 %uint_0 + OpBranch %105 + %105 = OpLabel + OpBranch %107 + %107 = OpLabel + OpBranch %109 + %109 = OpLabel + %110 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %129 None + OpBranchConditional %110 %113 %129 + %113 = OpLabel + %114 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %115 = OpLoad %uint %114 + OpBranch %117 + %117 = OpLabel + %118 = OpPhi %uint %122 %117 %115 %113 + %119 = OpPhi %uint %123 %117 %uint_0 %113 + %120 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %119 + %121 = OpLoad %uint %120 + %122 = OpIAdd %uint %118 %121 + OpStore %114 %122 + %123 = OpIAdd %uint %119 %uint_1 + %124 = OpUGreaterThanEqual %bool %123 %47 + OpLoopMerge %127 %117 None + OpBranchConditional %124 %127 %117 + %127 = OpLabel + OpBranch %129 + %129 = OpLabel + OpBranch %131 + %131 = OpLabel + OpReturn + OpFunctionEnd + %148 = OpExtInst %void %134 PushConstantGlobalSize %uint_0 %uint_12 + %150 = OpExtInst %void %134 PushConstantRegionOffset %uint_16 %uint_12 + %152 = OpExtInst %void %134 PushConstantNumWorkgroups %uint_32 %uint_12 + %154 = OpExtInst %void %134 PushConstantRegionGroupOffset %uint_48 %uint_12 + %137 = OpExtInst %void %134 Kernel %24 %135 %uint_3 %uint_0 %136 + %139 = OpExtInst %void %134 ArgumentInfo %138 + %140 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_0 %uint_0 %uint_0 %139 + %142 = OpExtInst %void %134 ArgumentInfo %141 + %143 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_1 %uint_0 %uint_1 %142 + %145 = OpExtInst %void %134 ArgumentInfo %144 + %146 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_2 %uint_0 %uint_2 %145 + %155 = OpExtInst %void %134 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-fail3.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-fail3.spv.dis new file mode 100644 index 0000000000..7fec5d95f8 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-fail3.spv.dis @@ -0,0 +1,201 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 4 and %21[0][1] == 4 and %21[0][2] == 4 and %21[0][3] == 4) +; @Config: 2, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 156 +; Schema: 0 + OpCapability Shader + %134 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %135 = OpString "xf_barrier" + %136 = OpString " __kernel" + %138 = OpString "flag" + %141 = OpString "in" + %144 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_264 = OpConstant %uint 264 + %uint_64 = OpConstant %uint 64 + %uint_66 = OpConstant %uint 66 + %uint_68 = OpConstant %uint 68 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_64 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_66 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %107 None + OpBranchConditional %76 %79 %107 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %95 None + OpBranchConditional %81 %84 %95 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %89 = OpAtomicLoad %uint %86 %uint_1 %uint_66 + %90 = OpINotEqual %bool %89 %uint_0 + OpLoopMerge %93 %88 None + OpBranchConditional %90 %93 %88 + %93 = OpLabel + OpBranch %95 + %95 = OpLabel + OpBranch %97 + %97 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpSelectionMerge %105 None + OpBranchConditional %81 %100 %105 + %100 = OpLabel + %101 = OpIAdd %uint %36 %uint_1 + %102 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %101 + OpAtomicStore %102 %uint_1 %uint_68 %uint_0 + OpBranch %105 + %105 = OpLabel + OpBranch %107 + %107 = OpLabel + OpBranch %109 + %109 = OpLabel + %110 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %129 None + OpBranchConditional %110 %113 %129 + %113 = OpLabel + %114 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %115 = OpLoad %uint %114 + OpBranch %117 + %117 = OpLabel + %118 = OpPhi %uint %122 %117 %115 %113 + %119 = OpPhi %uint %123 %117 %uint_0 %113 + %120 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %119 + %121 = OpLoad %uint %120 + %122 = OpIAdd %uint %118 %121 + OpStore %114 %122 + %123 = OpIAdd %uint %119 %uint_1 + %124 = OpUGreaterThanEqual %bool %123 %47 + OpLoopMerge %127 %117 None + OpBranchConditional %124 %127 %117 + %127 = OpLabel + OpBranch %129 + %129 = OpLabel + OpBranch %131 + %131 = OpLabel + OpReturn + OpFunctionEnd + %148 = OpExtInst %void %134 PushConstantGlobalSize %uint_0 %uint_12 + %150 = OpExtInst %void %134 PushConstantRegionOffset %uint_16 %uint_12 + %152 = OpExtInst %void %134 PushConstantNumWorkgroups %uint_32 %uint_12 + %154 = OpExtInst %void %134 PushConstantRegionGroupOffset %uint_48 %uint_12 + %137 = OpExtInst %void %134 Kernel %24 %135 %uint_3 %uint_0 %136 + %139 = OpExtInst %void %134 ArgumentInfo %138 + %140 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_0 %uint_0 %uint_0 %139 + %142 = OpExtInst %void %134 ArgumentInfo %141 + %143 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_1 %uint_0 %uint_1 %142 + %145 = OpExtInst %void %134 ArgumentInfo %144 + %146 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_2 %uint_0 %uint_2 %145 + %155 = OpExtInst %void %134 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-fail4.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-fail4.spv.dis new file mode 100644 index 0000000000..c5c4b8c599 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-fail4.spv.dis @@ -0,0 +1,201 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 4 and %21[0][1] == 4 and %21[0][2] == 4 and %21[0][3] == 4) +; @Config: 2, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 156 +; Schema: 0 + OpCapability Shader + %134 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %135 = OpString "xf_barrier" + %136 = OpString " __kernel" + %138 = OpString "flag" + %141 = OpString "in" + %144 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_264 = OpConstant %uint 264 + %uint_68 = OpConstant %uint 68 + %uint_64 = OpConstant %uint 64 + %uint_66 = OpConstant %uint 66 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_68 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_64 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %107 None + OpBranchConditional %76 %79 %107 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %96 None + OpBranchConditional %81 %84 %96 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %90 = OpAtomicLoad %uint %86 %uint_1 %uint_66 + %91 = OpINotEqual %bool %90 %uint_0 + OpLoopMerge %94 %88 None + OpBranchConditional %91 %94 %88 + %94 = OpLabel + OpBranch %96 + %96 = OpLabel + OpBranch %98 + %98 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpSelectionMerge %105 None + OpBranchConditional %81 %101 %105 + %101 = OpLabel + %102 = OpIAdd %uint %36 %uint_1 + %103 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %102 + OpAtomicStore %103 %uint_1 %uint_68 %uint_0 + OpBranch %105 + %105 = OpLabel + OpBranch %107 + %107 = OpLabel + OpBranch %109 + %109 = OpLabel + %110 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %129 None + OpBranchConditional %110 %113 %129 + %113 = OpLabel + %114 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %115 = OpLoad %uint %114 + OpBranch %117 + %117 = OpLabel + %118 = OpPhi %uint %122 %117 %115 %113 + %119 = OpPhi %uint %123 %117 %uint_0 %113 + %120 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %119 + %121 = OpLoad %uint %120 + %122 = OpIAdd %uint %118 %121 + OpStore %114 %122 + %123 = OpIAdd %uint %119 %uint_1 + %124 = OpUGreaterThanEqual %bool %123 %47 + OpLoopMerge %127 %117 None + OpBranchConditional %124 %127 %117 + %127 = OpLabel + OpBranch %129 + %129 = OpLabel + OpBranch %131 + %131 = OpLabel + OpReturn + OpFunctionEnd + %148 = OpExtInst %void %134 PushConstantGlobalSize %uint_0 %uint_12 + %150 = OpExtInst %void %134 PushConstantRegionOffset %uint_16 %uint_12 + %152 = OpExtInst %void %134 PushConstantNumWorkgroups %uint_32 %uint_12 + %154 = OpExtInst %void %134 PushConstantRegionGroupOffset %uint_48 %uint_12 + %137 = OpExtInst %void %134 Kernel %24 %135 %uint_3 %uint_0 %136 + %139 = OpExtInst %void %134 ArgumentInfo %138 + %140 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_0 %uint_0 %uint_0 %139 + %142 = OpExtInst %void %134 ArgumentInfo %141 + %143 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_1 %uint_0 %uint_1 %142 + %145 = OpExtInst %void %134 ArgumentInfo %144 + %146 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_2 %uint_0 %uint_2 %145 + %155 = OpExtInst %void %134 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-weakest.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-weakest.spv.dis new file mode 100644 index 0000000000..309c081b39 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-local-weakest.spv.dis @@ -0,0 +1,199 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 4 and %21[0][1] == 4 and %21[0][2] == 4 and %21[0][3] == 4) +; @Config: 2, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 154 +; Schema: 0 + OpCapability Shader + %132 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %133 = OpString "xf_barrier" + %134 = OpString " __kernel" + %136 = OpString "flag" + %139 = OpString "in" + %142 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_264 = OpConstant %uint 264 + %uint_64 = OpConstant %uint 64 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %74 None + OpBranchConditional %51 %54 %74 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %70 None + OpBranchConditional %56 %59 %70 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_64 %uint_1 + OpBranch %63 + %63 = OpLabel + %64 = OpAtomicLoad %uint %60 %uint_1 %uint_64 + %65 = OpINotEqual %bool %64 %uint_1 + OpLoopMerge %68 %63 None + OpBranchConditional %65 %68 %63 + %68 = OpLabel + OpBranch %70 + %70 = OpLabel + OpBranch %72 + %72 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %74 + %74 = OpLabel + %75 = OpPhi %bool %false %72 %true %25 + OpSelectionMerge %105 None + OpBranchConditional %75 %78 %105 + %78 = OpLabel + %79 = OpIAdd %uint %36 %uint_1 + %80 = OpULessThan %bool %79 %39 + OpSelectionMerge %94 None + OpBranchConditional %80 %83 %94 + %83 = OpLabel + %84 = OpIAdd %uint %36 %uint_1 + %85 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %84 + OpBranch %87 + %87 = OpLabel + %88 = OpAtomicLoad %uint %85 %uint_1 %uint_64 + %89 = OpINotEqual %bool %88 %uint_0 + OpLoopMerge %92 %87 None + OpBranchConditional %89 %92 %87 + %92 = OpLabel + OpBranch %94 + %94 = OpLabel + OpBranch %96 + %96 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpSelectionMerge %103 None + OpBranchConditional %80 %99 %103 + %99 = OpLabel + %100 = OpIAdd %uint %36 %uint_1 + %101 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %100 + OpAtomicStore %101 %uint_1 %uint_64 %uint_0 + OpBranch %103 + %103 = OpLabel + OpBranch %105 + %105 = OpLabel + OpBranch %107 + %107 = OpLabel + %108 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %127 None + OpBranchConditional %108 %111 %127 + %111 = OpLabel + %112 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %113 = OpLoad %uint %112 + OpBranch %115 + %115 = OpLabel + %116 = OpPhi %uint %120 %115 %113 %111 + %117 = OpPhi %uint %121 %115 %uint_0 %111 + %118 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %117 + %119 = OpLoad %uint %118 + %120 = OpIAdd %uint %116 %119 + OpStore %112 %120 + %121 = OpIAdd %uint %117 %uint_1 + %122 = OpUGreaterThanEqual %bool %121 %47 + OpLoopMerge %125 %115 None + OpBranchConditional %122 %125 %115 + %125 = OpLabel + OpBranch %127 + %127 = OpLabel + OpBranch %129 + %129 = OpLabel + OpReturn + OpFunctionEnd + %146 = OpExtInst %void %132 PushConstantGlobalSize %uint_0 %uint_12 + %148 = OpExtInst %void %132 PushConstantRegionOffset %uint_16 %uint_12 + %150 = OpExtInst %void %132 PushConstantNumWorkgroups %uint_32 %uint_12 + %152 = OpExtInst %void %132 PushConstantRegionGroupOffset %uint_48 %uint_12 + %135 = OpExtInst %void %132 Kernel %24 %133 %uint_3 %uint_0 %134 + %137 = OpExtInst %void %132 ArgumentInfo %136 + %138 = OpExtInst %void %132 ArgumentStorageBuffer %135 %uint_0 %uint_0 %uint_0 %137 + %140 = OpExtInst %void %132 ArgumentInfo %139 + %141 = OpExtInst %void %132 ArgumentStorageBuffer %135 %uint_1 %uint_0 %uint_1 %140 + %143 = OpExtInst %void %132 ArgumentInfo %142 + %144 = OpExtInst %void %132 ArgumentStorageBuffer %135 %uint_2 %uint_0 %uint_2 %143 + %153 = OpExtInst %void %132 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-weakest.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-weakest.spv.dis new file mode 100644 index 0000000000..3259e7e80d --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-weakest.spv.dis @@ -0,0 +1,202 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 4 and %21[0][1] == 4 and %21[0][2] == 4 and %21[0][3] == 4) +; @Config: 2, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 154 +; Schema: 0 + OpCapability Shader + %132 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %133 = OpString "xf_barrier" + %134 = OpString " __kernel" + %136 = OpString "flag" + %139 = OpString "in" + %142 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %19 Coherent + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %20 Coherent + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %21 Coherent + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_72 = OpConstant %uint 72 + %uint_64 = OpConstant %uint 64 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %74 None + OpBranchConditional %51 %54 %74 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %70 None + OpBranchConditional %56 %59 %70 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_64 %uint_1 + OpBranch %63 + %63 = OpLabel + %64 = OpAtomicLoad %uint %60 %uint_1 %uint_64 + %65 = OpINotEqual %bool %64 %uint_1 + OpLoopMerge %68 %63 None + OpBranchConditional %65 %68 %63 + %68 = OpLabel + OpBranch %70 + %70 = OpLabel + OpBranch %72 + %72 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpBranch %74 + %74 = OpLabel + %75 = OpPhi %bool %false %72 %true %25 + OpSelectionMerge %105 None + OpBranchConditional %75 %78 %105 + %78 = OpLabel + %79 = OpIAdd %uint %36 %uint_1 + %80 = OpULessThan %bool %79 %39 + OpSelectionMerge %94 None + OpBranchConditional %80 %83 %94 + %83 = OpLabel + %84 = OpIAdd %uint %36 %uint_1 + %85 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %84 + OpBranch %87 + %87 = OpLabel + %88 = OpAtomicLoad %uint %85 %uint_1 %uint_64 + %89 = OpINotEqual %bool %88 %uint_0 + OpLoopMerge %92 %87 None + OpBranchConditional %89 %92 %87 + %92 = OpLabel + OpBranch %94 + %94 = OpLabel + OpBranch %96 + %96 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpSelectionMerge %103 None + OpBranchConditional %80 %99 %103 + %99 = OpLabel + %100 = OpIAdd %uint %36 %uint_1 + %101 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %100 + OpAtomicStore %101 %uint_1 %uint_64 %uint_0 + OpBranch %103 + %103 = OpLabel + OpBranch %105 + %105 = OpLabel + OpBranch %107 + %107 = OpLabel + %108 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %127 None + OpBranchConditional %108 %111 %127 + %111 = OpLabel + %112 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %113 = OpLoad %uint %112 + OpBranch %115 + %115 = OpLabel + %116 = OpPhi %uint %120 %115 %113 %111 + %117 = OpPhi %uint %121 %115 %uint_0 %111 + %118 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %117 + %119 = OpLoad %uint %118 + %120 = OpIAdd %uint %116 %119 + OpStore %112 %120 + %121 = OpIAdd %uint %117 %uint_1 + %122 = OpUGreaterThanEqual %bool %121 %47 + OpLoopMerge %125 %115 None + OpBranchConditional %122 %125 %115 + %125 = OpLabel + OpBranch %127 + %127 = OpLabel + OpBranch %129 + %129 = OpLabel + OpReturn + OpFunctionEnd + %146 = OpExtInst %void %132 PushConstantGlobalSize %uint_0 %uint_12 + %148 = OpExtInst %void %132 PushConstantRegionOffset %uint_16 %uint_12 + %150 = OpExtInst %void %132 PushConstantNumWorkgroups %uint_32 %uint_12 + %152 = OpExtInst %void %132 PushConstantRegionGroupOffset %uint_48 %uint_12 + %135 = OpExtInst %void %132 Kernel %24 %133 %uint_3 %uint_0 %134 + %137 = OpExtInst %void %132 ArgumentInfo %136 + %138 = OpExtInst %void %132 ArgumentStorageBuffer %135 %uint_0 %uint_0 %uint_0 %137 + %140 = OpExtInst %void %132 ArgumentInfo %139 + %141 = OpExtInst %void %132 ArgumentStorageBuffer %135 %uint_1 %uint_0 %uint_1 %140 + %143 = OpExtInst %void %132 ArgumentInfo %142 + %144 = OpExtInst %void %132 ArgumentStorageBuffer %135 %uint_2 %uint_0 %uint_2 %143 + %153 = OpExtInst %void %132 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-1.1.2.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-1.1.2.spv.dis new file mode 100644 index 0000000000..8f901f1d55 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-1.1.2.spv.dis @@ -0,0 +1,200 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 2 and %21[0][1] == 2) +; @Config: 1, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 155 +; Schema: 0 + OpCapability Shader + %133 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %134 = OpString "xf_barrier" + %135 = OpString " __kernel" + %137 = OpString "flag" + %140 = OpString "in" + %143 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_8 = OpConstant %uint 8 + %uint_68 = OpConstant %uint 68 + %uint_66 = OpConstant %uint 66 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_68 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_66 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %106 None + OpBranchConditional %76 %79 %106 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %95 None + OpBranchConditional %81 %84 %95 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %89 = OpAtomicLoad %uint %86 %uint_1 %uint_66 + %90 = OpINotEqual %bool %89 %uint_0 + OpLoopMerge %93 %88 None + OpBranchConditional %90 %93 %88 + %93 = OpLabel + OpBranch %95 + %95 = OpLabel + OpBranch %97 + %97 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + OpSelectionMerge %104 None + OpBranchConditional %81 %100 %104 + %100 = OpLabel + %101 = OpIAdd %uint %36 %uint_1 + %102 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %101 + OpAtomicStore %102 %uint_1 %uint_68 %uint_0 + OpBranch %104 + %104 = OpLabel + OpBranch %106 + %106 = OpLabel + OpBranch %108 + %108 = OpLabel + %109 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %128 None + OpBranchConditional %109 %112 %128 + %112 = OpLabel + %113 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %114 = OpLoad %uint %113 + OpBranch %116 + %116 = OpLabel + %117 = OpPhi %uint %121 %116 %114 %112 + %118 = OpPhi %uint %122 %116 %uint_0 %112 + %119 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %118 + %120 = OpLoad %uint %119 + %121 = OpIAdd %uint %117 %120 + OpStore %113 %121 + %122 = OpIAdd %uint %118 %uint_1 + %123 = OpUGreaterThanEqual %bool %122 %47 + OpLoopMerge %126 %116 None + OpBranchConditional %123 %126 %116 + %126 = OpLabel + OpBranch %128 + %128 = OpLabel + OpBranch %130 + %130 = OpLabel + OpReturn + OpFunctionEnd + %147 = OpExtInst %void %133 PushConstantGlobalSize %uint_0 %uint_12 + %149 = OpExtInst %void %133 PushConstantRegionOffset %uint_16 %uint_12 + %151 = OpExtInst %void %133 PushConstantNumWorkgroups %uint_32 %uint_12 + %153 = OpExtInst %void %133 PushConstantRegionGroupOffset %uint_48 %uint_12 + %136 = OpExtInst %void %133 Kernel %24 %134 %uint_3 %uint_0 %135 + %138 = OpExtInst %void %133 ArgumentInfo %137 + %139 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_0 %uint_0 %uint_0 %138 + %141 = OpExtInst %void %133 ArgumentInfo %140 + %142 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_1 %uint_0 %uint_1 %141 + %144 = OpExtInst %void %133 ArgumentInfo %143 + %145 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_2 %uint_0 %uint_2 %144 + %154 = OpExtInst %void %133 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-2.1.1.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-2.1.1.spv.dis new file mode 100644 index 0000000000..f7c911d76b --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-2.1.1.spv.dis @@ -0,0 +1,200 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 2 and %21[0][1] == 2) +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 155 +; Schema: 0 + OpCapability Shader + %133 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %134 = OpString "xf_barrier" + %135 = OpString " __kernel" + %137 = OpString "flag" + %140 = OpString "in" + %143 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_8 = OpConstant %uint 8 + %uint_68 = OpConstant %uint 68 + %uint_66 = OpConstant %uint 66 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_68 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_66 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %106 None + OpBranchConditional %76 %79 %106 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %95 None + OpBranchConditional %81 %84 %95 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %89 = OpAtomicLoad %uint %86 %uint_1 %uint_66 + %90 = OpINotEqual %bool %89 %uint_0 + OpLoopMerge %93 %88 None + OpBranchConditional %90 %93 %88 + %93 = OpLabel + OpBranch %95 + %95 = OpLabel + OpBranch %97 + %97 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + OpSelectionMerge %104 None + OpBranchConditional %81 %100 %104 + %100 = OpLabel + %101 = OpIAdd %uint %36 %uint_1 + %102 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %101 + OpAtomicStore %102 %uint_1 %uint_68 %uint_0 + OpBranch %104 + %104 = OpLabel + OpBranch %106 + %106 = OpLabel + OpBranch %108 + %108 = OpLabel + %109 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %128 None + OpBranchConditional %109 %112 %128 + %112 = OpLabel + %113 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %114 = OpLoad %uint %113 + OpBranch %116 + %116 = OpLabel + %117 = OpPhi %uint %121 %116 %114 %112 + %118 = OpPhi %uint %122 %116 %uint_0 %112 + %119 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %118 + %120 = OpLoad %uint %119 + %121 = OpIAdd %uint %117 %120 + OpStore %113 %121 + %122 = OpIAdd %uint %118 %uint_1 + %123 = OpUGreaterThanEqual %bool %122 %47 + OpLoopMerge %126 %116 None + OpBranchConditional %123 %126 %116 + %126 = OpLabel + OpBranch %128 + %128 = OpLabel + OpBranch %130 + %130 = OpLabel + OpReturn + OpFunctionEnd + %147 = OpExtInst %void %133 PushConstantGlobalSize %uint_0 %uint_12 + %149 = OpExtInst %void %133 PushConstantRegionOffset %uint_16 %uint_12 + %151 = OpExtInst %void %133 PushConstantNumWorkgroups %uint_32 %uint_12 + %153 = OpExtInst %void %133 PushConstantRegionGroupOffset %uint_48 %uint_12 + %136 = OpExtInst %void %133 Kernel %24 %134 %uint_3 %uint_0 %135 + %138 = OpExtInst %void %133 ArgumentInfo %137 + %139 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_0 %uint_0 %uint_0 %138 + %141 = OpExtInst %void %133 ArgumentInfo %140 + %142 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_1 %uint_0 %uint_1 %141 + %144 = OpExtInst %void %133 ArgumentInfo %143 + %145 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_2 %uint_0 %uint_2 %144 + %154 = OpExtInst %void %133 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-2.1.2.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-2.1.2.spv.dis new file mode 100644 index 0000000000..fe9dcd8d91 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-2.1.2.spv.dis @@ -0,0 +1,200 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 4 and %21[0][1] == 4 and %21[0][2] == 4 and %21[0][3] == 4) +; @Config: 2, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 155 +; Schema: 0 + OpCapability Shader + %133 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %134 = OpString "xf_barrier" + %135 = OpString " __kernel" + %137 = OpString "flag" + %140 = OpString "in" + %143 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_8 = OpConstant %uint 8 + %uint_68 = OpConstant %uint 68 + %uint_66 = OpConstant %uint 66 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_68 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_66 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %106 None + OpBranchConditional %76 %79 %106 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %95 None + OpBranchConditional %81 %84 %95 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %89 = OpAtomicLoad %uint %86 %uint_1 %uint_66 + %90 = OpINotEqual %bool %89 %uint_0 + OpLoopMerge %93 %88 None + OpBranchConditional %90 %93 %88 + %93 = OpLabel + OpBranch %95 + %95 = OpLabel + OpBranch %97 + %97 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + OpSelectionMerge %104 None + OpBranchConditional %81 %100 %104 + %100 = OpLabel + %101 = OpIAdd %uint %36 %uint_1 + %102 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %101 + OpAtomicStore %102 %uint_1 %uint_68 %uint_0 + OpBranch %104 + %104 = OpLabel + OpBranch %106 + %106 = OpLabel + OpBranch %108 + %108 = OpLabel + %109 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %128 None + OpBranchConditional %109 %112 %128 + %112 = OpLabel + %113 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %114 = OpLoad %uint %113 + OpBranch %116 + %116 = OpLabel + %117 = OpPhi %uint %121 %116 %114 %112 + %118 = OpPhi %uint %122 %116 %uint_0 %112 + %119 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %118 + %120 = OpLoad %uint %119 + %121 = OpIAdd %uint %117 %120 + OpStore %113 %121 + %122 = OpIAdd %uint %118 %uint_1 + %123 = OpUGreaterThanEqual %bool %122 %47 + OpLoopMerge %126 %116 None + OpBranchConditional %123 %126 %116 + %126 = OpLabel + OpBranch %128 + %128 = OpLabel + OpBranch %130 + %130 = OpLabel + OpReturn + OpFunctionEnd + %147 = OpExtInst %void %133 PushConstantGlobalSize %uint_0 %uint_12 + %149 = OpExtInst %void %133 PushConstantRegionOffset %uint_16 %uint_12 + %151 = OpExtInst %void %133 PushConstantNumWorkgroups %uint_32 %uint_12 + %153 = OpExtInst %void %133 PushConstantRegionGroupOffset %uint_48 %uint_12 + %136 = OpExtInst %void %133 Kernel %24 %134 %uint_3 %uint_0 %135 + %138 = OpExtInst %void %133 ArgumentInfo %137 + %139 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_0 %uint_0 %uint_0 %138 + %141 = OpExtInst %void %133 ArgumentInfo %140 + %142 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_1 %uint_0 %uint_1 %141 + %144 = OpExtInst %void %133 ArgumentInfo %143 + %145 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_2 %uint_0 %uint_2 %144 + %154 = OpExtInst %void %133 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-3.1.3.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-3.1.3.spv.dis new file mode 100644 index 0000000000..78f37eda4d --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-3.1.3.spv.dis @@ -0,0 +1,202 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 9 and %21[0][1] == 9 and %21[0][2] == 9) +; @Output: forall (%21[0][3] == 9 and %21[0][4] == 9 and %21[0][5] == 9) +; @Output: forall (%21[0][6] == 9 and %21[0][7] == 9 and %21[0][8] == 9) +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 155 +; Schema: 0 + OpCapability Shader + %133 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %134 = OpString "xf_barrier" + %135 = OpString " __kernel" + %137 = OpString "flag" + %140 = OpString "in" + %143 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_8 = OpConstant %uint 8 + %uint_68 = OpConstant %uint 68 + %uint_66 = OpConstant %uint 66 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_68 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_66 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %106 None + OpBranchConditional %76 %79 %106 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %95 None + OpBranchConditional %81 %84 %95 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %89 = OpAtomicLoad %uint %86 %uint_1 %uint_66 + %90 = OpINotEqual %bool %89 %uint_0 + OpLoopMerge %93 %88 None + OpBranchConditional %90 %93 %88 + %93 = OpLabel + OpBranch %95 + %95 = OpLabel + OpBranch %97 + %97 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + OpSelectionMerge %104 None + OpBranchConditional %81 %100 %104 + %100 = OpLabel + %101 = OpIAdd %uint %36 %uint_1 + %102 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %101 + OpAtomicStore %102 %uint_1 %uint_68 %uint_0 + OpBranch %104 + %104 = OpLabel + OpBranch %106 + %106 = OpLabel + OpBranch %108 + %108 = OpLabel + %109 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %128 None + OpBranchConditional %109 %112 %128 + %112 = OpLabel + %113 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %114 = OpLoad %uint %113 + OpBranch %116 + %116 = OpLabel + %117 = OpPhi %uint %121 %116 %114 %112 + %118 = OpPhi %uint %122 %116 %uint_0 %112 + %119 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %118 + %120 = OpLoad %uint %119 + %121 = OpIAdd %uint %117 %120 + OpStore %113 %121 + %122 = OpIAdd %uint %118 %uint_1 + %123 = OpUGreaterThanEqual %bool %122 %47 + OpLoopMerge %126 %116 None + OpBranchConditional %123 %126 %116 + %126 = OpLabel + OpBranch %128 + %128 = OpLabel + OpBranch %130 + %130 = OpLabel + OpReturn + OpFunctionEnd + %147 = OpExtInst %void %133 PushConstantGlobalSize %uint_0 %uint_12 + %149 = OpExtInst %void %133 PushConstantRegionOffset %uint_16 %uint_12 + %151 = OpExtInst %void %133 PushConstantNumWorkgroups %uint_32 %uint_12 + %153 = OpExtInst %void %133 PushConstantRegionGroupOffset %uint_48 %uint_12 + %136 = OpExtInst %void %133 Kernel %24 %134 %uint_3 %uint_0 %135 + %138 = OpExtInst %void %133 ArgumentInfo %137 + %139 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_0 %uint_0 %uint_0 %138 + %141 = OpExtInst %void %133 ArgumentInfo %140 + %142 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_1 %uint_0 %uint_1 %141 + %144 = OpExtInst %void %133 ArgumentInfo %143 + %145 = OpExtInst %void %133 ArgumentStorageBuffer %136 %uint_2 %uint_0 %uint_2 %144 + %154 = OpExtInst %void %133 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-fail1.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-fail1.spv.dis new file mode 100644 index 0000000000..5de96580c9 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-fail1.spv.dis @@ -0,0 +1,201 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 4 and %21[0][1] == 4 and %21[0][2] == 4 and %21[0][3] == 4) +; @Config: 2, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 156 +; Schema: 0 + OpCapability Shader + %134 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %135 = OpString "xf_barrier" + %136 = OpString " __kernel" + %138 = OpString "flag" + %141 = OpString "in" + %144 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_8 = OpConstant %uint 8 + %uint_68 = OpConstant %uint 68 + %uint_66 = OpConstant %uint 66 + %uint_64 = OpConstant %uint 64 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_68 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_66 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %107 None + OpBranchConditional %76 %79 %107 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %96 None + OpBranchConditional %81 %84 %96 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %90 = OpAtomicLoad %uint %86 %uint_1 %uint_64 + %91 = OpINotEqual %bool %90 %uint_0 + OpLoopMerge %94 %88 None + OpBranchConditional %91 %94 %88 + %94 = OpLabel + OpBranch %96 + %96 = OpLabel + OpBranch %98 + %98 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + OpSelectionMerge %105 None + OpBranchConditional %81 %101 %105 + %101 = OpLabel + %102 = OpIAdd %uint %36 %uint_1 + %103 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %102 + OpAtomicStore %103 %uint_1 %uint_68 %uint_0 + OpBranch %105 + %105 = OpLabel + OpBranch %107 + %107 = OpLabel + OpBranch %109 + %109 = OpLabel + %110 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %129 None + OpBranchConditional %110 %113 %129 + %113 = OpLabel + %114 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %115 = OpLoad %uint %114 + OpBranch %117 + %117 = OpLabel + %118 = OpPhi %uint %122 %117 %115 %113 + %119 = OpPhi %uint %123 %117 %uint_0 %113 + %120 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %119 + %121 = OpLoad %uint %120 + %122 = OpIAdd %uint %118 %121 + OpStore %114 %122 + %123 = OpIAdd %uint %119 %uint_1 + %124 = OpUGreaterThanEqual %bool %123 %47 + OpLoopMerge %127 %117 None + OpBranchConditional %124 %127 %117 + %127 = OpLabel + OpBranch %129 + %129 = OpLabel + OpBranch %131 + %131 = OpLabel + OpReturn + OpFunctionEnd + %148 = OpExtInst %void %134 PushConstantGlobalSize %uint_0 %uint_12 + %150 = OpExtInst %void %134 PushConstantRegionOffset %uint_16 %uint_12 + %152 = OpExtInst %void %134 PushConstantNumWorkgroups %uint_32 %uint_12 + %154 = OpExtInst %void %134 PushConstantRegionGroupOffset %uint_48 %uint_12 + %137 = OpExtInst %void %134 Kernel %24 %135 %uint_3 %uint_0 %136 + %139 = OpExtInst %void %134 ArgumentInfo %138 + %140 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_0 %uint_0 %uint_0 %139 + %142 = OpExtInst %void %134 ArgumentInfo %141 + %143 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_1 %uint_0 %uint_1 %142 + %145 = OpExtInst %void %134 ArgumentInfo %144 + %146 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_2 %uint_0 %uint_2 %145 + %155 = OpExtInst %void %134 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-fail2.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-fail2.spv.dis new file mode 100644 index 0000000000..63f14ccf0e --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-fail2.spv.dis @@ -0,0 +1,201 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 4 and %21[0][1] == 4 and %21[0][2] == 4 and %21[0][3] == 4) +; @Config: 2, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 156 +; Schema: 0 + OpCapability Shader + %134 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %135 = OpString "xf_barrier" + %136 = OpString " __kernel" + %138 = OpString "flag" + %141 = OpString "in" + %144 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_8 = OpConstant %uint 8 + %uint_68 = OpConstant %uint 68 + %uint_66 = OpConstant %uint 66 + %uint_64 = OpConstant %uint 64 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_68 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_66 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %107 None + OpBranchConditional %76 %79 %107 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %95 None + OpBranchConditional %81 %84 %95 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %89 = OpAtomicLoad %uint %86 %uint_1 %uint_66 + %90 = OpINotEqual %bool %89 %uint_0 + OpLoopMerge %93 %88 None + OpBranchConditional %90 %93 %88 + %93 = OpLabel + OpBranch %95 + %95 = OpLabel + OpBranch %97 + %97 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + OpSelectionMerge %105 None + OpBranchConditional %81 %100 %105 + %100 = OpLabel + %101 = OpIAdd %uint %36 %uint_1 + %102 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %101 + OpAtomicStore %102 %uint_1 %uint_64 %uint_0 + OpBranch %105 + %105 = OpLabel + OpBranch %107 + %107 = OpLabel + OpBranch %109 + %109 = OpLabel + %110 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %129 None + OpBranchConditional %110 %113 %129 + %113 = OpLabel + %114 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %115 = OpLoad %uint %114 + OpBranch %117 + %117 = OpLabel + %118 = OpPhi %uint %122 %117 %115 %113 + %119 = OpPhi %uint %123 %117 %uint_0 %113 + %120 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %119 + %121 = OpLoad %uint %120 + %122 = OpIAdd %uint %118 %121 + OpStore %114 %122 + %123 = OpIAdd %uint %119 %uint_1 + %124 = OpUGreaterThanEqual %bool %123 %47 + OpLoopMerge %127 %117 None + OpBranchConditional %124 %127 %117 + %127 = OpLabel + OpBranch %129 + %129 = OpLabel + OpBranch %131 + %131 = OpLabel + OpReturn + OpFunctionEnd + %148 = OpExtInst %void %134 PushConstantGlobalSize %uint_0 %uint_12 + %150 = OpExtInst %void %134 PushConstantRegionOffset %uint_16 %uint_12 + %152 = OpExtInst %void %134 PushConstantNumWorkgroups %uint_32 %uint_12 + %154 = OpExtInst %void %134 PushConstantRegionGroupOffset %uint_48 %uint_12 + %137 = OpExtInst %void %134 Kernel %24 %135 %uint_3 %uint_0 %136 + %139 = OpExtInst %void %134 ArgumentInfo %138 + %140 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_0 %uint_0 %uint_0 %139 + %142 = OpExtInst %void %134 ArgumentInfo %141 + %143 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_1 %uint_0 %uint_1 %142 + %145 = OpExtInst %void %134 ArgumentInfo %144 + %146 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_2 %uint_0 %uint_2 %145 + %155 = OpExtInst %void %134 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-fail3.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-fail3.spv.dis new file mode 100644 index 0000000000..2dd66a6823 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-fail3.spv.dis @@ -0,0 +1,201 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 4 and %21[0][1] == 4 and %21[0][2] == 4 and %21[0][3] == 4) +; @Config: 2, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 156 +; Schema: 0 + OpCapability Shader + %134 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %135 = OpString "xf_barrier" + %136 = OpString " __kernel" + %138 = OpString "flag" + %141 = OpString "in" + %144 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_8 = OpConstant %uint 8 + %uint_64 = OpConstant %uint 64 + %uint_66 = OpConstant %uint 66 + %uint_68 = OpConstant %uint 68 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_64 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_66 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %107 None + OpBranchConditional %76 %79 %107 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %95 None + OpBranchConditional %81 %84 %95 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %89 = OpAtomicLoad %uint %86 %uint_1 %uint_66 + %90 = OpINotEqual %bool %89 %uint_0 + OpLoopMerge %93 %88 None + OpBranchConditional %90 %93 %88 + %93 = OpLabel + OpBranch %95 + %95 = OpLabel + OpBranch %97 + %97 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + OpSelectionMerge %105 None + OpBranchConditional %81 %100 %105 + %100 = OpLabel + %101 = OpIAdd %uint %36 %uint_1 + %102 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %101 + OpAtomicStore %102 %uint_1 %uint_68 %uint_0 + OpBranch %105 + %105 = OpLabel + OpBranch %107 + %107 = OpLabel + OpBranch %109 + %109 = OpLabel + %110 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %129 None + OpBranchConditional %110 %113 %129 + %113 = OpLabel + %114 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %115 = OpLoad %uint %114 + OpBranch %117 + %117 = OpLabel + %118 = OpPhi %uint %122 %117 %115 %113 + %119 = OpPhi %uint %123 %117 %uint_0 %113 + %120 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %119 + %121 = OpLoad %uint %120 + %122 = OpIAdd %uint %118 %121 + OpStore %114 %122 + %123 = OpIAdd %uint %119 %uint_1 + %124 = OpUGreaterThanEqual %bool %123 %47 + OpLoopMerge %127 %117 None + OpBranchConditional %124 %127 %117 + %127 = OpLabel + OpBranch %129 + %129 = OpLabel + OpBranch %131 + %131 = OpLabel + OpReturn + OpFunctionEnd + %148 = OpExtInst %void %134 PushConstantGlobalSize %uint_0 %uint_12 + %150 = OpExtInst %void %134 PushConstantRegionOffset %uint_16 %uint_12 + %152 = OpExtInst %void %134 PushConstantNumWorkgroups %uint_32 %uint_12 + %154 = OpExtInst %void %134 PushConstantRegionGroupOffset %uint_48 %uint_12 + %137 = OpExtInst %void %134 Kernel %24 %135 %uint_3 %uint_0 %136 + %139 = OpExtInst %void %134 ArgumentInfo %138 + %140 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_0 %uint_0 %uint_0 %139 + %142 = OpExtInst %void %134 ArgumentInfo %141 + %143 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_1 %uint_0 %uint_1 %142 + %145 = OpExtInst %void %134 ArgumentInfo %144 + %146 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_2 %uint_0 %uint_2 %145 + %155 = OpExtInst %void %134 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-fail4.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-fail4.spv.dis new file mode 100644 index 0000000000..49711aa2e8 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-fail4.spv.dis @@ -0,0 +1,201 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 4 and %21[0][1] == 4 and %21[0][2] == 4 and %21[0][3] == 4) +; @Config: 2, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 156 +; Schema: 0 + OpCapability Shader + %134 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %135 = OpString "xf_barrier" + %136 = OpString " __kernel" + %138 = OpString "flag" + %141 = OpString "in" + %144 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_8 = OpConstant %uint 8 + %uint_68 = OpConstant %uint 68 + %uint_64 = OpConstant %uint 64 + %uint_66 = OpConstant %uint 66 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %51 %54 %75 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %71 None + OpBranchConditional %56 %59 %71 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_68 %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpAtomicLoad %uint %60 %uint_1 %uint_64 + %66 = OpINotEqual %bool %65 %uint_1 + OpLoopMerge %69 %63 None + OpBranchConditional %66 %69 %63 + %69 = OpLabel + OpBranch %71 + %71 = OpLabel + OpBranch %73 + %73 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %true %25 + OpSelectionMerge %107 None + OpBranchConditional %76 %79 %107 + %79 = OpLabel + %80 = OpIAdd %uint %36 %uint_1 + %81 = OpULessThan %bool %80 %39 + OpSelectionMerge %96 None + OpBranchConditional %81 %84 %96 + %84 = OpLabel + %85 = OpIAdd %uint %36 %uint_1 + %86 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %85 + OpBranch %88 + %88 = OpLabel + %90 = OpAtomicLoad %uint %86 %uint_1 %uint_66 + %91 = OpINotEqual %bool %90 %uint_0 + OpLoopMerge %94 %88 None + OpBranchConditional %91 %94 %88 + %94 = OpLabel + OpBranch %96 + %96 = OpLabel + OpBranch %98 + %98 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + OpSelectionMerge %105 None + OpBranchConditional %81 %101 %105 + %101 = OpLabel + %102 = OpIAdd %uint %36 %uint_1 + %103 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %102 + OpAtomicStore %103 %uint_1 %uint_68 %uint_0 + OpBranch %105 + %105 = OpLabel + OpBranch %107 + %107 = OpLabel + OpBranch %109 + %109 = OpLabel + %110 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %129 None + OpBranchConditional %110 %113 %129 + %113 = OpLabel + %114 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %115 = OpLoad %uint %114 + OpBranch %117 + %117 = OpLabel + %118 = OpPhi %uint %122 %117 %115 %113 + %119 = OpPhi %uint %123 %117 %uint_0 %113 + %120 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %119 + %121 = OpLoad %uint %120 + %122 = OpIAdd %uint %118 %121 + OpStore %114 %122 + %123 = OpIAdd %uint %119 %uint_1 + %124 = OpUGreaterThanEqual %bool %123 %47 + OpLoopMerge %127 %117 None + OpBranchConditional %124 %127 %117 + %127 = OpLabel + OpBranch %129 + %129 = OpLabel + OpBranch %131 + %131 = OpLabel + OpReturn + OpFunctionEnd + %148 = OpExtInst %void %134 PushConstantGlobalSize %uint_0 %uint_12 + %150 = OpExtInst %void %134 PushConstantRegionOffset %uint_16 %uint_12 + %152 = OpExtInst %void %134 PushConstantNumWorkgroups %uint_32 %uint_12 + %154 = OpExtInst %void %134 PushConstantRegionGroupOffset %uint_48 %uint_12 + %137 = OpExtInst %void %134 Kernel %24 %135 %uint_3 %uint_0 %136 + %139 = OpExtInst %void %134 ArgumentInfo %138 + %140 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_0 %uint_0 %uint_0 %139 + %142 = OpExtInst %void %134 ArgumentInfo %141 + %143 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_1 %uint_0 %uint_1 %142 + %145 = OpExtInst %void %134 ArgumentInfo %144 + %146 = OpExtInst %void %134 ArgumentStorageBuffer %137 %uint_2 %uint_0 %uint_2 %145 + %155 = OpExtInst %void %134 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-weakest.spv.dis b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-weakest.spv.dis new file mode 100644 index 0000000000..3bbbaa9dea --- /dev/null +++ b/dartagnan/src/test/resources/spirv/benchmarks/xf-barrier-zero-weakest.spv.dis @@ -0,0 +1,199 @@ +; flag +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0}} +; data +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Output: forall (%21[0][0] == 4 and %21[0][1] == 4 and %21[0][2] == 4 and %21[0][3] == 4) +; @Config: 2, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 154 +; Schema: 0 + OpCapability Shader + %132 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "xf_barrier" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %19 %20 %21 %5 + OpSource OpenCL_C 200 + %133 = OpString "xf_barrier" + %134 = OpString " __kernel" + %136 = OpString "flag" + %139 = OpString "in" + %142 = OpString "out" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpMemberDecorate %_struct_3 2 Offset 32 + OpMemberDecorate %_struct_3 3 Offset 48 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_17 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool + %uint_8 = OpConstant %uint 8 + %uint_64 = OpConstant %uint 64 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_32 = OpConstant %uint 32 + %uint_48 = OpConstant %uint 48 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_3 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %33 %29 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_2 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpIAdd %uint %44 %41 + %46 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %45 + OpStore %49 %uint_1 + %51 = OpINotEqual %bool %34 %uint_0 + OpSelectionMerge %74 None + OpBranchConditional %51 %54 %74 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + %56 = OpIEqual %bool %36 %uint_0 + OpSelectionMerge %70 None + OpBranchConditional %56 %59 %70 + %59 = OpLabel + %60 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %34 + OpAtomicStore %60 %uint_1 %uint_64 %uint_1 + OpBranch %63 + %63 = OpLabel + %64 = OpAtomicLoad %uint %60 %uint_1 %uint_64 + %65 = OpINotEqual %bool %64 %uint_1 + OpLoopMerge %68 %63 None + OpBranchConditional %65 %68 %63 + %68 = OpLabel + OpBranch %70 + %70 = OpLabel + OpBranch %72 + %72 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + OpBranch %74 + %74 = OpLabel + %75 = OpPhi %bool %false %72 %true %25 + OpSelectionMerge %105 None + OpBranchConditional %75 %78 %105 + %78 = OpLabel + %79 = OpIAdd %uint %36 %uint_1 + %80 = OpULessThan %bool %79 %39 + OpSelectionMerge %94 None + OpBranchConditional %80 %83 %94 + %83 = OpLabel + %84 = OpIAdd %uint %36 %uint_1 + %85 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %84 + OpBranch %87 + %87 = OpLabel + %88 = OpAtomicLoad %uint %85 %uint_1 %uint_64 + %89 = OpINotEqual %bool %88 %uint_0 + OpLoopMerge %92 %87 None + OpBranchConditional %89 %92 %87 + %92 = OpLabel + OpBranch %94 + %94 = OpLabel + OpBranch %96 + %96 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_8 + OpSelectionMerge %103 None + OpBranchConditional %80 %99 %103 + %99 = OpLabel + %100 = OpIAdd %uint %36 %uint_1 + %101 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %100 + OpAtomicStore %101 %uint_1 %uint_64 %uint_0 + OpBranch %103 + %103 = OpLabel + OpBranch %105 + %105 = OpLabel + OpBranch %107 + %107 = OpLabel + %108 = OpINotEqual %bool %47 %uint_0 + OpSelectionMerge %127 None + OpBranchConditional %108 %111 %127 + %111 = OpLabel + %112 = OpAccessChain %_ptr_StorageBuffer_uint %21 %uint_0 %45 + %113 = OpLoad %uint %112 + OpBranch %115 + %115 = OpLabel + %116 = OpPhi %uint %120 %115 %113 %111 + %117 = OpPhi %uint %121 %115 %uint_0 %111 + %118 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %117 + %119 = OpLoad %uint %118 + %120 = OpIAdd %uint %116 %119 + OpStore %112 %120 + %121 = OpIAdd %uint %117 %uint_1 + %122 = OpUGreaterThanEqual %bool %121 %47 + OpLoopMerge %125 %115 None + OpBranchConditional %122 %125 %115 + %125 = OpLabel + OpBranch %127 + %127 = OpLabel + OpBranch %129 + %129 = OpLabel + OpReturn + OpFunctionEnd + %146 = OpExtInst %void %132 PushConstantGlobalSize %uint_0 %uint_12 + %148 = OpExtInst %void %132 PushConstantRegionOffset %uint_16 %uint_12 + %150 = OpExtInst %void %132 PushConstantNumWorkgroups %uint_32 %uint_12 + %152 = OpExtInst %void %132 PushConstantRegionGroupOffset %uint_48 %uint_12 + %135 = OpExtInst %void %132 Kernel %24 %133 %uint_3 %uint_0 %134 + %137 = OpExtInst %void %132 ArgumentInfo %136 + %138 = OpExtInst %void %132 ArgumentStorageBuffer %135 %uint_0 %uint_0 %uint_0 %137 + %140 = OpExtInst %void %132 ArgumentInfo %139 + %141 = OpExtInst %void %132 ArgumentStorageBuffer %135 %uint_1 %uint_0 %uint_1 %140 + %143 = OpExtInst %void %132 ArgumentInfo %142 + %144 = OpExtInst %void %132 ArgumentStorageBuffer %135 %uint_2 %uint_0 %uint_2 %143 + %153 = OpExtInst %void %132 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/addressofinit.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/addressofinit.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/addressofinit.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/alignment/int3int4.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/alignment/int3int4.spv.dis new file mode 100644 index 0000000000..e9f715dde3 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/alignment/int3int4.spv.dis @@ -0,0 +1,74 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + %37 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %13 %18 %5 + OpSource OpenCL_C 200 + %38 = OpString "foo" + %39 = OpString " __kernel" + %42 = OpString "n" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_v4uint ArrayStride 16 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %v4uint = OpTypeVector %uint 4 +%_runtimearr_v4uint = OpTypeRuntimeArray %v4uint + %_struct_16 = OpTypeStruct %_runtimearr_v4uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %31 = OpUndef %v4uint +%_ptr_StorageBuffer_v4uint = OpTypePointer StorageBuffer %v4uint + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %26 + %32 = OpCompositeInsert %v4uint %30 %31 0 + %33 = OpVectorShuffle %v4uint %32 %31 0 0 0 4294967295 + %34 = OpIAdd %uint %26 %29 + %36 = OpAccessChain %_ptr_StorageBuffer_v4uint %18 %uint_0 %34 + OpStore %36 %33 + OpReturn + OpFunctionEnd + %46 = OpExtInst %void %37 PushConstantRegionOffset %uint_0 %uint_12 + %41 = OpExtInst %void %37 Kernel %21 %38 %uint_1 %uint_0 %39 + %43 = OpExtInst %void %37 ArgumentInfo %42 + %44 = OpExtInst %void %37 ArgumentStorageBuffer %41 %uint_0 %uint_0 %uint_0 %43 + %48 = OpExtInst %void %37 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/alignment/race_location.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/alignment/race_location.spv.dis new file mode 100644 index 0000000000..7768bb0eaa --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/alignment/race_location.spv.dis @@ -0,0 +1,74 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + %37 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %13 %18 %5 + OpSource OpenCL_C 200 + %38 = OpString "foo" + %39 = OpString " __kernel" + %42 = OpString "n" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_v4uint ArrayStride 16 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %v4uint = OpTypeVector %uint 4 +%_runtimearr_v4uint = OpTypeRuntimeArray %v4uint + %_struct_16 = OpTypeStruct %_runtimearr_v4uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %31 = OpUndef %v4uint +%_ptr_StorageBuffer_v4uint = OpTypePointer StorageBuffer %v4uint + %uint_200 = OpConstant %uint 200 + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %26 + %32 = OpCompositeInsert %v4uint %30 %31 0 + %33 = OpVectorShuffle %v4uint %32 %31 0 0 0 4294967295 + %36 = OpAccessChain %_ptr_StorageBuffer_v4uint %18 %uint_0 %uint_200 + OpStore %36 %33 + OpReturn + OpFunctionEnd + %46 = OpExtInst %void %37 PushConstantRegionOffset %uint_0 %uint_12 + %41 = OpExtInst %void %37 Kernel %21 %38 %uint_1 %uint_0 %39 + %43 = OpExtInst %void %37 ArgumentInfo %42 + %44 = OpExtInst %void %37 ArgumentStorageBuffer %41 %uint_0 %uint_0 %uint_0 %43 + %48 = OpExtInst %void %37 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/annotation_tests/test_axiom.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/annotation_tests/test_axiom.spv.dis new file mode 100644 index 0000000000..da9175440e --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/annotation_tests/test_axiom.spv.dis @@ -0,0 +1,73 @@ +; @Input: %14 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %40 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %8 %gl_LocalInvocationID %14 + OpSource OpenCL_C 200 + %41 = OpString "foo" + %42 = OpString " __kernel" + %45 = OpString "A" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_12 0 Offset 0 + OpDecorate %_struct_12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_12 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_12 = OpTypePointer StorageBuffer %_struct_12 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool + %uint_16 = OpConstant %uint 16 + %false = OpConstantFalse %bool +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_StorageBuffer_uint %14 %uint_0 %uint_0 + %22 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %23 = OpCompositeExtract %uint %22 0 + %26 = OpIEqual %bool %23 %uint_16 + %27 = OpCompositeExtract %uint %22 1 + %28 = OpIEqual %bool %27 %uint_16 + %30 = OpSelect %bool %26 %28 %false + %31 = OpLogicalNot %bool %30 + OpSelectionMerge %39 None + OpBranchConditional %31 %34 %39 + %34 = OpLabel + %36 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %37 = OpLoad %uint %36 + OpStore %21 %37 + OpBranch %39 + %39 = OpLabel + OpReturn + OpFunctionEnd + %44 = OpExtInst %void %40 Kernel %17 %41 %uint_1 %uint_0 %42 + %46 = OpExtInst %void %40 ArgumentInfo %45 + %47 = OpExtInst %void %40 ArgumentStorageBuffer %44 %uint_0 %uint_0 %uint_0 %46 + %49 = OpExtInst %void %40 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/array_in_array.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/array_in_array.spv.dis new file mode 100644 index 0000000000..7ca31451ac --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/array_in_array.spv.dis @@ -0,0 +1,49 @@ +; @Config: 8, 1, 8 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %16 "foo" %gl_GlobalInvocationID %13 %5 + OpSource OpenCL_C 200 + %19 = OpString "foo" + %20 = OpString " __kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %16 = OpFunction %void Pure %15 + %17 = OpLabel + OpReturn + OpFunctionEnd + %24 = OpExtInst %void %18 PushConstantGlobalSize %uint_0 %uint_12 + %26 = OpExtInst %void %18 PushConstantRegionOffset %uint_16 %uint_12 + %22 = OpExtInst %void %18 Kernel %16 %19 %uint_0 %uint_0 %20 + %29 = OpExtInst %void %18 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/array_in_array_2.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/array_in_array_2.spv.dis new file mode 100644 index 0000000000..6d5d0d0689 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/array_in_array_2.spv.dis @@ -0,0 +1,46 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %16 "foo" %gl_GlobalInvocationID %13 %5 + OpSource OpenCL_C 200 + %19 = OpString "foo" + %20 = OpString " __kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_12 = OpConstant %uint 12 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %16 = OpFunction %void Pure %15 + %17 = OpLabel + OpReturn + OpFunctionEnd + %24 = OpExtInst %void %18 PushConstantRegionOffset %uint_0 %uint_12 + %22 = OpExtInst %void %18 Kernel %16 %19 %uint_0 %uint_0 %20 + %27 = OpExtInst %void %18 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/array_in_array_param.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/array_in_array_param.spv.dis new file mode 100644 index 0000000000..9da9de1805 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/array_in_array_param.spv.dis @@ -0,0 +1,49 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %16 "foo" %gl_GlobalInvocationID %13 %5 + OpSource OpenCL_C 200 + %19 = OpString "foo" + %20 = OpString " __kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %16 = OpFunction %void Pure %15 + %17 = OpLabel + OpReturn + OpFunctionEnd + %25 = OpExtInst %void %18 PushConstantGlobalSize %uint_0 %uint_12 + %27 = OpExtInst %void %18 PushConstantRegionOffset %uint_16 %uint_12 + %23 = OpExtInst %void %18 Kernel %16 %19 %uint_1 %uint_0 %20 + %29 = OpExtInst %void %18 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/multi_dim_array.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/multi_dim_array.spv.dis new file mode 100644 index 0000000000..b96c292109 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/multi_dim_array.spv.dis @@ -0,0 +1,48 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_LocalInvocationID %gl_WorkGroupID %14 %5 + OpSource OpenCL_C 200 + %20 = OpString "foo" + %21 = OpString " __kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %9 SpecId 0 + OpDecorate %10 SpecId 1 + OpDecorate %11 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %9 %10 %11 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %16 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_12 = OpConstant %uint 12 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpFunction %void Pure %16 + %18 = OpLabel + OpReturn + OpFunctionEnd + %25 = OpExtInst %void %19 PushConstantRegionGroupOffset %uint_0 %uint_12 + %23 = OpExtInst %void %19 Kernel %17 %20 %uint_0 %uint_0 %21 + %28 = OpExtInst %void %19 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/multi_dim_array_fail_upper.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/multi_dim_array_fail_upper.spv.dis new file mode 100644 index 0000000000..0429a61277 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/multi_dim_array_fail_upper.spv.dis @@ -0,0 +1,53 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %18 "foo" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %5 + OpSource OpenCL_C 200 + %21 = OpString "foo" + %22 = OpString " __kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %17 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpFunction %void Pure %17 + %19 = OpLabel + OpReturn + OpFunctionEnd + %26 = OpExtInst %void %20 PushConstantRegionOffset %uint_0 %uint_12 + %28 = OpExtInst %void %20 PushConstantRegionGroupOffset %uint_16 %uint_12 + %24 = OpExtInst %void %20 Kernel %18 %21 %uint_0 %uint_0 %22 + %31 = OpExtInst %void %20 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/negative_index_multi_dim.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/negative_index_multi_dim.spv.dis new file mode 100644 index 0000000000..b2b2106a0c --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/negative_index_multi_dim.spv.dis @@ -0,0 +1,51 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_GlobalInvocationID %gl_LocalInvocationID %14 %5 + OpSource OpenCL_C 200 + %20 = OpString "foo" + %21 = OpString " __kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %9 SpecId 0 + OpDecorate %10 SpecId 1 + OpDecorate %11 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %9 %10 %11 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %16 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpFunction %void Pure %16 + %18 = OpLabel + OpReturn + OpFunctionEnd + %25 = OpExtInst %void %19 PushConstantGlobalSize %uint_0 %uint_12 + %27 = OpExtInst %void %19 PushConstantRegionOffset %uint_16 %uint_12 + %23 = OpExtInst %void %19 Kernel %17 %20 %uint_0 %uint_0 %21 + %30 = OpExtInst %void %19 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/negative_index_multi_dim_fail.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/negative_index_multi_dim_fail.spv.dis new file mode 100644 index 0000000000..1471eec23d --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/negative_index_multi_dim_fail.spv.dis @@ -0,0 +1,49 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %16 "foo" %gl_GlobalInvocationID %13 %5 + OpSource OpenCL_C 200 + %19 = OpString "foo" + %20 = OpString " __kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %16 = OpFunction %void Pure %15 + %17 = OpLabel + OpReturn + OpFunctionEnd + %24 = OpExtInst %void %18 PushConstantGlobalSize %uint_0 %uint_12 + %26 = OpExtInst %void %18 PushConstantRegionOffset %uint_16 %uint_12 + %22 = OpExtInst %void %18 Kernel %16 %19 %uint_0 %uint_0 %20 + %29 = OpExtInst %void %18 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/private_array.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/private_array.spv.dis new file mode 100644 index 0000000000..293beb9482 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/private_array.spv.dis @@ -0,0 +1,46 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %16 "foo" %gl_GlobalInvocationID %13 %5 + OpSource OpenCL_C 200 + %19 = OpString "foo" + %20 = OpString " __kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_12 = OpConstant %uint 12 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %16 = OpFunction %void Pure %15 + %17 = OpLabel + OpReturn + OpFunctionEnd + %24 = OpExtInst %void %18 PushConstantRegionOffset %uint_0 %uint_12 + %22 = OpExtInst %void %18 Kernel %16 %19 %uint_0 %uint_0 %20 + %27 = OpExtInst %void %18 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/realign_simple.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/realign_simple.spv.dis new file mode 100644 index 0000000000..1471eec23d --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/realign_simple.spv.dis @@ -0,0 +1,49 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %16 "foo" %gl_GlobalInvocationID %13 %5 + OpSource OpenCL_C 200 + %19 = OpString "foo" + %20 = OpString " __kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %16 = OpFunction %void Pure %15 + %17 = OpLabel + OpReturn + OpFunctionEnd + %24 = OpExtInst %void %18 PushConstantGlobalSize %uint_0 %uint_12 + %26 = OpExtInst %void %18 PushConstantRegionOffset %uint_16 %uint_12 + %22 = OpExtInst %void %18 Kernel %16 %19 %uint_0 %uint_0 %20 + %29 = OpExtInst %void %18 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/realign_simple_fail.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/realign_simple_fail.spv.dis new file mode 100644 index 0000000000..1471eec23d --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/realign_simple_fail.spv.dis @@ -0,0 +1,49 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %16 "foo" %gl_GlobalInvocationID %13 %5 + OpSource OpenCL_C 200 + %19 = OpString "foo" + %20 = OpString " __kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %16 = OpFunction %void Pure %15 + %17 = OpLabel + OpReturn + OpFunctionEnd + %24 = OpExtInst %void %18 PushConstantGlobalSize %uint_0 %uint_12 + %26 = OpExtInst %void %18 PushConstantRegionOffset %uint_16 %uint_12 + %22 = OpExtInst %void %18 Kernel %16 %19 %uint_0 %uint_0 %20 + %29 = OpExtInst %void %18 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/simple_array.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/simple_array.spv.dis new file mode 100644 index 0000000000..1471eec23d --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/simple_array.spv.dis @@ -0,0 +1,49 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %16 "foo" %gl_GlobalInvocationID %13 %5 + OpSource OpenCL_C 200 + %19 = OpString "foo" + %20 = OpString " __kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %16 = OpFunction %void Pure %15 + %17 = OpLabel + OpReturn + OpFunctionEnd + %24 = OpExtInst %void %18 PushConstantGlobalSize %uint_0 %uint_12 + %26 = OpExtInst %void %18 PushConstantRegionOffset %uint_16 %uint_12 + %22 = OpExtInst %void %18 Kernel %16 %19 %uint_0 %uint_0 %20 + %29 = OpExtInst %void %18 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/simple_array_fail_lower.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/simple_array_fail_lower.spv.dis new file mode 100644 index 0000000000..1471eec23d --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/simple_array_fail_lower.spv.dis @@ -0,0 +1,49 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %16 "foo" %gl_GlobalInvocationID %13 %5 + OpSource OpenCL_C 200 + %19 = OpString "foo" + %20 = OpString " __kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %16 = OpFunction %void Pure %15 + %17 = OpLabel + OpReturn + OpFunctionEnd + %24 = OpExtInst %void %18 PushConstantGlobalSize %uint_0 %uint_12 + %26 = OpExtInst %void %18 PushConstantRegionOffset %uint_16 %uint_12 + %22 = OpExtInst %void %18 Kernel %16 %19 %uint_0 %uint_0 %20 + %29 = OpExtInst %void %18 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/simple_array_fail_upper.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/simple_array_fail_upper.spv.dis new file mode 100644 index 0000000000..1471eec23d --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/simple_array_fail_upper.spv.dis @@ -0,0 +1,49 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %16 "foo" %gl_GlobalInvocationID %13 %5 + OpSource OpenCL_C 200 + %19 = OpString "foo" + %20 = OpString " __kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %16 = OpFunction %void Pure %15 + %17 = OpLabel + OpReturn + OpFunctionEnd + %24 = OpExtInst %void %18 PushConstantGlobalSize %uint_0 %uint_12 + %26 = OpExtInst %void %18 PushConstantRegionOffset %uint_16 %uint_12 + %22 = OpExtInst %void %18 Kernel %16 %19 %uint_0 %uint_0 %20 + %29 = OpExtInst %void %18 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/simple_array_fail_var.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/simple_array_fail_var.spv.dis new file mode 100644 index 0000000000..293beb9482 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/array_bounds_tests/simple_array_fail_var.spv.dis @@ -0,0 +1,46 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %16 "foo" %gl_GlobalInvocationID %13 %5 + OpSource OpenCL_C 200 + %19 = OpString "foo" + %20 = OpString " __kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_12 = OpConstant %uint 12 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %16 = OpFunction %void Pure %15 + %17 = OpLabel + OpReturn + OpFunctionEnd + %24 = OpExtInst %void %18 PushConstantRegionOffset %uint_0 %uint_12 + %22 = OpExtInst %void %18 Kernel %16 %19 %uint_0 %uint_0 %20 + %27 = OpExtInst %void %18 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test1.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test1.spv.dis new file mode 100644 index 0000000000..c3fba1f6ab --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test1.spv.dis @@ -0,0 +1,132 @@ +; @Input: %24 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 102 +; Schema: 0 + OpCapability Shader + %90 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %27 "foo" %6 %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %20 %24 %10 + OpSource OpenCL_C 200 + %91 = OpString "foo" + %92 = OpString " kernel" + %94 = OpString "p" + OpMemberDecorate %_struct_8 0 Offset 0 + OpMemberDecorate %_struct_8 1 Offset 16 + OpDecorate %_struct_8 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_22 0 Offset 0 + OpDecorate %_struct_22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 0 + OpDecorate %83 NoContraction + OpDecorate %15 SpecId 0 + OpDecorate %16 SpecId 1 + OpDecorate %17 SpecId 2 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_float_uint_64 = OpTypeArray %float %uint_64 +%_ptr_Workgroup__arr_float_uint_64 = OpTypePointer Workgroup %_arr_float_uint_64 + %v3uint = OpTypeVector %uint 3 + %_struct_8 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_8 = OpTypePointer PushConstant %_struct_8 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %15 = OpSpecConstant %uint 1 + %16 = OpSpecConstant %uint 1 + %17 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %15 %16 %17 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_22 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_22 = OpTypePointer StorageBuffer %_struct_22 + %void = OpTypeVoid + %26 = OpTypeFunction %void +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_2 = OpConstant %uint 2 + %bool = OpTypeBool + %uint_6 = OpConstant %uint 6 +%_ptr_Workgroup_float = OpTypePointer Workgroup %float +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %float_2 = OpConstant %float 2 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %6 = OpVariable %_ptr_Workgroup__arr_float_uint_64 Workgroup + %10 = OpVariable %_ptr_PushConstant__struct_8 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %20 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %24 = OpVariable %_ptr_StorageBuffer__struct_22 StorageBuffer + %27 = OpFunction %void None %26 + %28 = OpLabel + %32 = OpAccessChain %_ptr_PushConstant_uint %10 %uint_1 %uint_0 + %33 = OpLoad %uint %32 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %37 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %38 = OpLoad %uint %37 + %40 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %41 = OpLoad %uint %40 + %42 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %43 = OpCompositeExtract %uint %42 0 + %44 = OpCompositeExtract %uint %42 1 + %45 = OpCompositeExtract %uint %42 2 + %46 = OpIMul %uint %44 %41 + %47 = OpIAdd %uint %46 %38 + %48 = OpIMul %uint %47 %43 + %49 = OpIAdd %uint %48 %36 + %50 = OpIMul %uint %43 %44 + %51 = OpIMul %uint %50 %45 + %53 = OpULessThan %bool %49 %uint_64 + OpSelectionMerge %77 None + OpBranchConditional %53 %56 %77 + %56 = OpLabel + %57 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %58 = OpLoad %uint %57 + %59 = OpIAdd %uint %33 %58 + %61 = OpShiftLeftLogical %uint %59 %uint_6 + OpBranch %63 + %63 = OpLabel + %64 = OpPhi %uint %70 %63 %49 %56 + %66 = OpAccessChain %_ptr_Workgroup_float %6 %64 + %67 = OpIAdd %uint %61 %64 + %69 = OpAccessChain %_ptr_StorageBuffer_float %24 %uint_0 %67 + %70 = OpIAdd %uint %64 %51 + %71 = OpLoad %float %69 + OpStore %66 %71 + %72 = OpUGreaterThanEqual %bool %70 %uint_64 + OpLoopMerge %75 %63 None + OpBranchConditional %72 %75 %63 + %75 = OpLabel + OpBranch %77 + %77 = OpLabel + OpBranch %79 + %79 = OpLabel + %80 = OpAccessChain %_ptr_Workgroup_float %6 %36 + %81 = OpLoad %float %80 + %83 = OpFMul %float %81 %float_2 + %84 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %85 = OpLoad %uint %84 + %86 = OpAccessChain %_ptr_PushConstant_uint %10 %uint_0 %uint_0 + %87 = OpLoad %uint %86 + %88 = OpIAdd %uint %85 %87 + %89 = OpAccessChain %_ptr_StorageBuffer_float %24 %uint_0 %88 + OpStore %89 %83 + OpReturn + OpFunctionEnd + %98 = OpExtInst %void %90 PushConstantRegionOffset %uint_0 %uint_12 + %100 = OpExtInst %void %90 PushConstantRegionGroupOffset %uint_16 %uint_12 + %93 = OpExtInst %void %90 Kernel %27 %91 %uint_1 %uint_0 %92 + %95 = OpExtInst %void %90 ArgumentInfo %94 + %96 = OpExtInst %void %90 ArgumentStorageBuffer %93 %uint_0 %uint_0 %uint_0 %95 + %101 = OpExtInst %void %90 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test10.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test10.spv.dis new file mode 100644 index 0000000000..12dd92c273 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test10.spv.dis @@ -0,0 +1,116 @@ +; @Input: %23 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 87 +; Schema: 0 + OpCapability Shader + %77 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %26 "foo" %6 %gl_GlobalInvocationID %gl_LocalInvocationID %19 %23 %10 + OpSource OpenCL_C 200 + %78 = OpString "foo" + %79 = OpString " kernel" + %81 = OpString "p" + OpMemberDecorate %_struct_8 0 Offset 0 + OpDecorate %_struct_8 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_21 0 Offset 0 + OpDecorate %_struct_21 Block + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 0 + OpDecorate %14 SpecId 0 + OpDecorate %15 SpecId 1 + OpDecorate %16 SpecId 2 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_float_uint_64 = OpTypeArray %float %uint_64 +%_ptr_Workgroup__arr_float_uint_64 = OpTypePointer Workgroup %_arr_float_uint_64 + %v3uint = OpTypeVector %uint 3 + %_struct_8 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_8 = OpTypePointer PushConstant %_struct_8 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %14 = OpSpecConstant %uint 1 + %15 = OpSpecConstant %uint 1 + %16 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %14 %15 %16 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_21 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_21 = OpTypePointer StorageBuffer %_struct_21 + %void = OpTypeVoid + %25 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_Workgroup_float = OpTypePointer Workgroup %float + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %uint_12 = OpConstant %uint 12 + %6 = OpVariable %_ptr_Workgroup__arr_float_uint_64 Workgroup + %10 = OpVariable %_ptr_PushConstant__struct_8 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %19 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %23 = OpVariable %_ptr_StorageBuffer__struct_21 StorageBuffer + %26 = OpFunction %void None %25 + %27 = OpLabel + %30 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %31 = OpLoad %uint %30 + %33 = OpAccessChain %_ptr_PushConstant_uint %10 %uint_0 %uint_0 + %34 = OpLoad %uint %33 + %35 = OpIAdd %uint %34 %31 + %36 = OpConvertUToF %float %35 + %37 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %38 = OpLoad %uint %37 + %40 = OpAccessChain %_ptr_Workgroup_float %6 %38 + OpStore %40 %36 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %43 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %44 = OpLoad %uint %43 + %46 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %47 = OpLoad %uint %46 + %48 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %49 = OpLoad %uint %48 + %50 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %51 = OpCompositeExtract %uint %50 0 + %52 = OpCompositeExtract %uint %50 1 + %53 = OpCompositeExtract %uint %50 2 + %54 = OpIMul %uint %52 %49 + %55 = OpIAdd %uint %54 %47 + %56 = OpIMul %uint %55 %51 + %57 = OpIAdd %uint %56 %44 + %58 = OpIMul %uint %51 %52 + %59 = OpIMul %uint %58 %53 + %61 = OpULessThan %bool %57 %uint_64 + OpSelectionMerge %76 None + OpBranchConditional %61 %64 %76 + %64 = OpLabel + %65 = OpPhi %uint %69 %64 %57 %27 + %67 = OpAccessChain %_ptr_StorageBuffer_float %23 %uint_0 %65 + %68 = OpAccessChain %_ptr_Workgroup_float %6 %65 + %69 = OpIAdd %uint %65 %59 + %70 = OpLoad %float %68 + OpStore %67 %70 + %71 = OpUGreaterThanEqual %bool %69 %uint_64 + OpLoopMerge %74 %64 None + OpBranchConditional %71 %74 %64 + %74 = OpLabel + OpBranch %76 + %76 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpReturn + OpFunctionEnd + %85 = OpExtInst %void %77 PushConstantRegionOffset %uint_0 %uint_12 + %80 = OpExtInst %void %77 Kernel %26 %78 %uint_1 %uint_0 %79 + %82 = OpExtInst %void %77 ArgumentInfo %81 + %83 = OpExtInst %void %77 ArgumentStorageBuffer %80 %uint_0 %uint_0 %uint_0 %82 + %86 = OpExtInst %void %77 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test13.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test13.spv.dis new file mode 100644 index 0000000000..0fa5927f08 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test13.spv.dis @@ -0,0 +1,123 @@ +; @Input: %22 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %23 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 91 +; Schema: 0 + OpCapability Shader + %78 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %26 "foo" %5 %gl_GlobalInvocationID %17 %gl_LocalInvocationID %22 %23 %9 + OpSource OpenCL_C 200 + %79 = OpString "foo" + %80 = OpString " kernel" + %82 = OpString "p" + %85 = OpString "q" + OpMemberDecorate %_struct_7 0 Offset 0 + OpDecorate %_struct_7 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_20 0 Offset 0 + OpDecorate %_struct_20 Block + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 0 + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 1 + OpDecorate %12 SpecId 0 + OpDecorate %13 SpecId 1 + OpDecorate %14 SpecId 2 + %uint = OpTypeInt 32 0 + %uint_1024 = OpConstant %uint 1024 +%_arr_uint_uint_1024 = OpTypeArray %uint %uint_1024 +%_ptr_Workgroup__arr_uint_uint_1024 = OpTypePointer Workgroup %_arr_uint_uint_1024 + %v3uint = OpTypeVector %uint 3 + %_struct_7 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_7 = OpTypePointer PushConstant %_struct_7 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %12 = OpSpecConstant %uint 1 + %13 = OpSpecConstant %uint 1 + %14 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %12 %13 %14 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_20 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_20 = OpTypePointer StorageBuffer %_struct_20 + %void = OpTypeVoid + %25 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %bool = OpTypeBool +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_328 = OpConstant %uint 328 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_264 = OpConstant %uint 264 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_Workgroup__arr_uint_uint_1024 Workgroup + %9 = OpVariable %_ptr_PushConstant__struct_7 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %17 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %22 = OpVariable %_ptr_StorageBuffer__struct_20 StorageBuffer + %23 = OpVariable %_ptr_StorageBuffer__struct_20 StorageBuffer + %26 = OpFunction %void None %25 + %27 = OpLabel + %30 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %31 = OpLoad %uint %30 + %33 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %34 = OpLoad %uint %33 + %36 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %37 = OpLoad %uint %36 + %38 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %39 = OpCompositeExtract %uint %38 0 + %40 = OpCompositeExtract %uint %38 1 + %41 = OpCompositeExtract %uint %38 2 + %42 = OpIMul %uint %40 %37 + %43 = OpIAdd %uint %42 %34 + %44 = OpIMul %uint %43 %39 + %45 = OpIAdd %uint %44 %31 + %46 = OpIMul %uint %39 %40 + %47 = OpIMul %uint %46 %41 + %49 = OpULessThan %bool %45 %uint_1024 + OpSelectionMerge %65 None + OpBranchConditional %49 %52 %65 + %52 = OpLabel + %53 = OpPhi %uint %58 %52 %45 %27 + %55 = OpAccessChain %_ptr_Workgroup_uint %5 %53 + %57 = OpAccessChain %_ptr_StorageBuffer_uint %22 %uint_0 %53 + %58 = OpIAdd %uint %53 %47 + %59 = OpLoad %uint %57 + OpStore %55 %59 + %60 = OpUGreaterThanEqual %bool %58 %uint_1024 + OpLoopMerge %63 %52 None + OpBranchConditional %60 %63 %52 + %63 = OpLabel + OpBranch %65 + %65 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_328 + %67 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %68 = OpLoad %uint %67 + %70 = OpAccessChain %_ptr_PushConstant_uint %9 %uint_0 %uint_0 + %71 = OpLoad %uint %70 + %72 = OpIAdd %uint %71 %68 + %73 = OpAccessChain %_ptr_Workgroup_uint %5 %72 + %74 = OpLoad %uint %73 + %75 = OpIAdd %uint %68 %71 + %76 = OpAccessChain %_ptr_StorageBuffer_uint %23 %uint_0 %75 + OpStore %76 %74 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpReturn + OpFunctionEnd + %89 = OpExtInst %void %78 PushConstantRegionOffset %uint_0 %uint_12 + %81 = OpExtInst %void %78 Kernel %26 %79 %uint_2 %uint_0 %80 + %83 = OpExtInst %void %78 ArgumentInfo %82 + %84 = OpExtInst %void %78 ArgumentStorageBuffer %81 %uint_0 %uint_0 %uint_0 %83 + %86 = OpExtInst %void %78 ArgumentInfo %85 + %87 = OpExtInst %void %78 ArgumentStorageBuffer %81 %uint_1 %uint_0 %uint_1 %86 + %90 = OpExtInst %void %78 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test14.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test14.spv.dis new file mode 100644 index 0000000000..fc0f77bfcc --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test14.spv.dis @@ -0,0 +1,180 @@ +; @Input: %25 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %26 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 143 +; Schema: 0 + OpCapability Shader + %128 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %29 "foo" %6 %7 %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %21 %25 %26 %11 + OpSource OpenCL_C 200 + %129 = OpString "foo" + %130 = OpString " kernel" + %132 = OpString "p" + %135 = OpString "q" + OpMemberDecorate %_struct_9 0 Offset 0 + OpMemberDecorate %_struct_9 1 Offset 16 + OpDecorate %_struct_9 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_23 0 Offset 0 + OpDecorate %_struct_23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 1 + OpDecorate %114 NoContraction + OpDecorate %123 NoContraction + OpDecorate %16 SpecId 0 + OpDecorate %17 SpecId 1 + OpDecorate %18 SpecId 2 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_float_uint_64 = OpTypeArray %float %uint_64 +%_ptr_Workgroup__arr_float_uint_64 = OpTypePointer Workgroup %_arr_float_uint_64 + %v3uint = OpTypeVector %uint 3 + %_struct_9 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_9 = OpTypePointer PushConstant %_struct_9 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %16 = OpSpecConstant %uint 1 + %17 = OpSpecConstant %uint 1 + %18 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %16 %17 %18 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_23 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_23 = OpTypePointer StorageBuffer %_struct_23 + %void = OpTypeVoid + %28 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %bool = OpTypeBool + %uint_6 = OpConstant %uint 6 +%_ptr_Workgroup_float = OpTypePointer Workgroup %float +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %uint_264 = OpConstant %uint 264 + %float_2 = OpConstant %float 2 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %6 = OpVariable %_ptr_Workgroup__arr_float_uint_64 Workgroup + %7 = OpVariable %_ptr_Workgroup__arr_float_uint_64 Workgroup + %11 = OpVariable %_ptr_PushConstant__struct_9 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %21 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %25 = OpVariable %_ptr_StorageBuffer__struct_23 StorageBuffer + %26 = OpVariable %_ptr_StorageBuffer__struct_23 StorageBuffer + %29 = OpFunction %void None %28 + %30 = OpLabel + %33 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %34 = OpLoad %uint %33 + %37 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_1 %uint_0 + %38 = OpLoad %uint %37 + %39 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %40 = OpLoad %uint %39 + %41 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %42 = OpLoad %uint %41 + %44 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %45 = OpLoad %uint %44 + %46 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %47 = OpCompositeExtract %uint %46 0 + %48 = OpCompositeExtract %uint %46 1 + %49 = OpCompositeExtract %uint %46 2 + %50 = OpIMul %uint %48 %45 + %51 = OpIAdd %uint %50 %42 + %52 = OpIMul %uint %51 %47 + %53 = OpIAdd %uint %52 %40 + %54 = OpIMul %uint %47 %48 + %55 = OpIMul %uint %54 %49 + %57 = OpULessThan %bool %53 %uint_64 + %58 = OpLogicalNot %bool %57 + OpSelectionMerge %63 None + OpBranchConditional %58 %61 %63 + %61 = OpLabel + OpBranch %63 + %63 = OpLabel + %64 = OpPhi %bool %false %61 %true %30 + OpSelectionMerge %105 None + OpBranchConditional %64 %67 %105 + %67 = OpLabel + %68 = OpIAdd %uint %38 %34 + %70 = OpShiftLeftLogical %uint %68 %uint_6 + OpBranch %72 + %72 = OpLabel + %73 = OpPhi %uint %79 %72 %53 %67 + %75 = OpAccessChain %_ptr_Workgroup_float %6 %73 + %76 = OpIAdd %uint %70 %73 + %78 = OpAccessChain %_ptr_StorageBuffer_float %25 %uint_0 %76 + %79 = OpIAdd %uint %73 %55 + %80 = OpLoad %float %78 + OpStore %75 %80 + %81 = OpUGreaterThanEqual %bool %79 %uint_64 + OpLoopMerge %84 %72 None + OpBranchConditional %81 %84 %72 + %84 = OpLabel + OpSelectionMerge %103 None + OpBranchConditional %57 %87 %103 + %87 = OpLabel + %88 = OpIAdd %uint %38 %34 + %89 = OpShiftLeftLogical %uint %88 %uint_6 + OpBranch %91 + %91 = OpLabel + %92 = OpPhi %uint %96 %91 %53 %87 + %93 = OpAccessChain %_ptr_Workgroup_float %7 %92 + %94 = OpIAdd %uint %89 %92 + %95 = OpAccessChain %_ptr_StorageBuffer_float %26 %uint_0 %94 + %96 = OpIAdd %uint %92 %55 + %97 = OpLoad %float %95 + OpStore %93 %97 + %98 = OpUGreaterThanEqual %bool %96 %uint_64 + OpLoopMerge %101 %91 None + OpBranchConditional %98 %101 %91 + %101 = OpLabel + OpBranch %103 + %103 = OpLabel + OpBranch %105 + %105 = OpLabel + OpBranch %107 + %107 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %109 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %110 = OpLoad %uint %109 + %111 = OpAccessChain %_ptr_Workgroup_float %6 %110 + %112 = OpLoad %float %111 + %114 = OpFMul %float %112 %float_2 + %115 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %116 = OpLoad %uint %115 + %117 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_0 %uint_0 + %118 = OpLoad %uint %117 + %119 = OpIAdd %uint %116 %118 + %120 = OpAccessChain %_ptr_StorageBuffer_float %25 %uint_0 %119 + OpStore %120 %114 + %121 = OpAccessChain %_ptr_Workgroup_float %7 %110 + %122 = OpLoad %float %121 + %123 = OpFMul %float %122 %float_2 + %124 = OpIAdd %uint %116 %118 + %125 = OpAccessChain %_ptr_StorageBuffer_float %26 %uint_0 %124 + OpStore %125 %123 + OpReturn + OpFunctionEnd + %139 = OpExtInst %void %128 PushConstantRegionOffset %uint_0 %uint_12 + %141 = OpExtInst %void %128 PushConstantRegionGroupOffset %uint_16 %uint_12 + %131 = OpExtInst %void %128 Kernel %29 %129 %uint_2 %uint_0 %130 + %133 = OpExtInst %void %128 ArgumentInfo %132 + %134 = OpExtInst %void %128 ArgumentStorageBuffer %131 %uint_0 %uint_0 %uint_0 %133 + %136 = OpExtInst %void %128 ArgumentInfo %135 + %137 = OpExtInst %void %128 ArgumentStorageBuffer %131 %uint_1 %uint_0 %uint_1 %136 + %142 = OpExtInst %void %128 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test15.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test15.spv.dis new file mode 100644 index 0000000000..706bcff8d8 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test15.spv.dis @@ -0,0 +1,147 @@ +; @Input: %25 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 112 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointersStorageBuffer + %100 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %28 "foo" %7 %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %21 %25 %11 + OpSource OpenCL_C 200 + %101 = OpString "foo" + %102 = OpString " kernel" + %104 = OpString "p" + OpMemberDecorate %_struct_9 0 Offset 0 + OpMemberDecorate %_struct_9 1 Offset 16 + OpDecorate %_struct_9 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %_struct_23 0 Offset 0 + OpDecorate %_struct_23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %25 Coherent + OpDecorate %93 NoContraction + OpDecorate %_ptr_StorageBuffer_v4float ArrayStride 16 + OpDecorate %16 SpecId 0 + OpDecorate %17 SpecId 1 + OpDecorate %18 SpecId 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_v4float_uint_64 = OpTypeArray %v4float %uint_64 +%_ptr_Workgroup__arr_v4float_uint_64 = OpTypePointer Workgroup %_arr_v4float_uint_64 + %v3uint = OpTypeVector %uint 3 + %_struct_9 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_9 = OpTypePointer PushConstant %_struct_9 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %16 = OpSpecConstant %uint 1 + %17 = OpSpecConstant %uint 1 + %18 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %16 %17 %18 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %_struct_23 = OpTypeStruct %_runtimearr_v4float +%_ptr_StorageBuffer__struct_23 = OpTypePointer StorageBuffer %_struct_23 + %void = OpTypeVoid + %27 = OpTypeFunction %void +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %43 = OpConstantNull %_ptr_StorageBuffer_v4float + %uint_2 = OpConstant %uint 2 + %uint_6 = OpConstant %uint 6 +%_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float + %uint_264 = OpConstant %uint 264 + %uint_328 = OpConstant %uint 328 + %float_2 = OpConstant %float 2 + %92 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %7 = OpVariable %_ptr_Workgroup__arr_v4float_uint_64 Workgroup + %11 = OpVariable %_ptr_PushConstant__struct_9 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %21 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %25 = OpVariable %_ptr_StorageBuffer__struct_23 StorageBuffer + %28 = OpFunction %void None %27 + %29 = OpLabel + %32 = OpAccessChain %_ptr_StorageBuffer_v4float %25 %uint_0 %uint_0 + %34 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %35 = OpLoad %uint %34 + %38 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_1 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpIAdd %uint %39 %35 + %42 = OpIEqual %bool %40 %uint_1 + %44 = OpSelect %_ptr_StorageBuffer_v4float %42 %32 %43 + %45 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %46 = OpLoad %uint %45 + %47 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %48 = OpLoad %uint %47 + %50 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %51 = OpLoad %uint %50 + %52 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %53 = OpCompositeExtract %uint %52 0 + %54 = OpCompositeExtract %uint %52 1 + %55 = OpCompositeExtract %uint %52 2 + %56 = OpIMul %uint %54 %51 + %57 = OpIAdd %uint %56 %48 + %58 = OpIMul %uint %57 %53 + %59 = OpIAdd %uint %58 %46 + %60 = OpIMul %uint %53 %54 + %61 = OpIMul %uint %60 %55 + %62 = OpULessThan %bool %59 %uint_64 + OpSelectionMerge %82 None + OpBranchConditional %62 %65 %82 + %65 = OpLabel + %67 = OpShiftLeftLogical %uint %40 %uint_6 + OpBranch %69 + %69 = OpLabel + %70 = OpPhi %uint %75 %69 %59 %65 + %72 = OpAccessChain %_ptr_Workgroup_v4float %7 %70 + %73 = OpIAdd %uint %67 %70 + %74 = OpPtrAccessChain %_ptr_StorageBuffer_v4float %44 %73 + %75 = OpIAdd %uint %70 %61 + %76 = OpLoad %v4float %74 + OpStore %72 %76 + %77 = OpUGreaterThanEqual %bool %75 %uint_64 + OpLoopMerge %80 %69 None + OpBranchConditional %77 %80 %69 + %80 = OpLabel + OpBranch %82 + %82 = OpLabel + OpBranch %84 + %84 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %87 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %88 = OpLoad %uint %87 + %89 = OpAccessChain %_ptr_Workgroup_v4float %7 %88 + %90 = OpLoad %v4float %89 + %93 = OpFMul %v4float %90 %92 + %94 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %95 = OpLoad %uint %94 + %96 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_0 %uint_0 + %97 = OpLoad %uint %96 + %98 = OpIAdd %uint %95 %97 + %99 = OpPtrAccessChain %_ptr_StorageBuffer_v4float %44 %98 + OpStore %99 %93 + OpReturn + OpFunctionEnd + %108 = OpExtInst %void %100 PushConstantRegionOffset %uint_0 %uint_12 + %110 = OpExtInst %void %100 PushConstantRegionGroupOffset %uint_16 %uint_12 + %103 = OpExtInst %void %100 Kernel %28 %101 %uint_1 %uint_0 %102 + %105 = OpExtInst %void %100 ArgumentInfo %104 + %106 = OpExtInst %void %100 ArgumentStorageBuffer %103 %uint_0 %uint_0 %uint_0 %105 + %111 = OpExtInst %void %100 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test16.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test16.spv.dis new file mode 100644 index 0000000000..cf59c89c88 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test16.spv.dis @@ -0,0 +1,130 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 102 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointersStorageBuffer + %93 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "foo" %7 %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %21 %11 + OpSource OpenCL_C 200 + %94 = OpString "foo" + %95 = OpString " kernel" + OpMemberDecorate %_struct_9 0 Offset 0 + OpMemberDecorate %_struct_9 1 Offset 16 + OpDecorate %_struct_9 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %86 NoContraction + OpDecorate %_ptr_StorageBuffer_v4float ArrayStride 16 + OpDecorate %16 SpecId 0 + OpDecorate %17 SpecId 1 + OpDecorate %18 SpecId 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_v4float_uint_64 = OpTypeArray %v4float %uint_64 +%_ptr_Workgroup__arr_v4float_uint_64 = OpTypePointer Workgroup %_arr_v4float_uint_64 + %v3uint = OpTypeVector %uint 3 + %_struct_9 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_9 = OpTypePointer PushConstant %_struct_9 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %16 = OpSpecConstant %uint 1 + %17 = OpSpecConstant %uint 1 + %18 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %16 %17 %18 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_2 = OpConstant %uint 2 + %bool = OpTypeBool + %uint_6 = OpConstant %uint 6 +%_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float + %66 = OpConstantNull %_ptr_StorageBuffer_v4float + %uint_264 = OpConstant %uint 264 + %uint_328 = OpConstant %uint 328 + %float_2 = OpConstant %float 2 + %85 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %7 = OpVariable %_ptr_Workgroup__arr_v4float_uint_64 Workgroup + %11 = OpVariable %_ptr_PushConstant__struct_9 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %21 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %24 = OpFunction %void None %23 + %25 = OpLabel + %29 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_1 %uint_0 + %30 = OpLoad %uint %29 + %32 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %33 = OpLoad %uint %32 + %34 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %35 = OpLoad %uint %34 + %37 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %38 = OpLoad %uint %37 + %39 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %40 = OpCompositeExtract %uint %39 0 + %41 = OpCompositeExtract %uint %39 1 + %42 = OpCompositeExtract %uint %39 2 + %43 = OpIMul %uint %41 %38 + %44 = OpIAdd %uint %43 %35 + %45 = OpIMul %uint %44 %40 + %46 = OpIAdd %uint %45 %33 + %47 = OpIMul %uint %40 %41 + %48 = OpIMul %uint %47 %42 + %50 = OpULessThan %bool %46 %uint_64 + OpSelectionMerge %75 None + OpBranchConditional %50 %53 %75 + %53 = OpLabel + %54 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %55 = OpLoad %uint %54 + %56 = OpIAdd %uint %30 %55 + %58 = OpShiftLeftLogical %uint %56 %uint_6 + OpBranch %60 + %60 = OpLabel + %61 = OpPhi %uint %68 %60 %46 %53 + %63 = OpAccessChain %_ptr_Workgroup_v4float %7 %61 + %64 = OpIAdd %uint %58 %61 + %67 = OpPtrAccessChain %_ptr_StorageBuffer_v4float %66 %64 + %68 = OpIAdd %uint %61 %48 + %69 = OpLoad %v4float %67 + OpStore %63 %69 + %70 = OpUGreaterThanEqual %bool %68 %uint_64 + OpLoopMerge %73 %60 None + OpBranchConditional %70 %73 %60 + %73 = OpLabel + OpBranch %75 + %75 = OpLabel + OpBranch %77 + %77 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %80 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %81 = OpLoad %uint %80 + %82 = OpAccessChain %_ptr_Workgroup_v4float %7 %81 + %83 = OpLoad %v4float %82 + %86 = OpFMul %v4float %83 %85 + %87 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %88 = OpLoad %uint %87 + %89 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_0 %uint_0 + %90 = OpLoad %uint %89 + %91 = OpIAdd %uint %88 %90 + %92 = OpPtrAccessChain %_ptr_StorageBuffer_v4float %66 %91 + OpStore %92 %86 + OpReturn + OpFunctionEnd + %98 = OpExtInst %void %93 PushConstantRegionOffset %uint_0 %uint_12 + %100 = OpExtInst %void %93 PushConstantRegionGroupOffset %uint_16 %uint_12 + %96 = OpExtInst %void %93 Kernel %24 %94 %uint_0 %uint_0 %95 + %101 = OpExtInst %void %93 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test17.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test17.spv.dis new file mode 100644 index 0000000000..ac749f344b --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test17.spv.dis @@ -0,0 +1,161 @@ +; @Input: %25 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %26 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 121 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointersStorageBuffer + OpCapability VariablePointers + %106 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %29 "foo" %7 %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %21 %25 %26 %11 + OpSource OpenCL_C 200 + %107 = OpString "foo" + %108 = OpString " kernel" + %110 = OpString "p" + %113 = OpString "q" + OpMemberDecorate %_struct_9 0 Offset 0 + OpMemberDecorate %_struct_9 1 Offset 16 + OpDecorate %_struct_9 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %_struct_23 0 Offset 0 + OpDecorate %_struct_23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %25 Coherent + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 1 + OpDecorate %26 Coherent + OpDecorate %99 NoContraction + OpDecorate %_ptr_StorageBuffer_v4float ArrayStride 16 + OpDecorate %16 SpecId 0 + OpDecorate %17 SpecId 1 + OpDecorate %18 SpecId 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_v4float_uint_64 = OpTypeArray %v4float %uint_64 +%_ptr_Workgroup__arr_v4float_uint_64 = OpTypePointer Workgroup %_arr_v4float_uint_64 + %v3uint = OpTypeVector %uint 3 + %_struct_9 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_9 = OpTypePointer PushConstant %_struct_9 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %16 = OpSpecConstant %uint 1 + %17 = OpSpecConstant %uint 1 + %18 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %16 %17 %18 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %_struct_23 = OpTypeStruct %_runtimearr_v4float +%_ptr_StorageBuffer__struct_23 = OpTypePointer StorageBuffer %_struct_23 + %void = OpTypeVoid + %28 = OpTypeFunction %void +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %45 = OpConstantNull %_ptr_Workgroup__arr_v4float_uint_64 + %uint_2 = OpConstant %uint 2 + %uint_6 = OpConstant %uint 6 +%_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float + %uint_264 = OpConstant %uint 264 + %uint_328 = OpConstant %uint 328 + %uint_63 = OpConstant %uint 63 + %float_2 = OpConstant %float 2 + %98 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %7 = OpVariable %_ptr_Workgroup__arr_v4float_uint_64 Workgroup + %11 = OpVariable %_ptr_PushConstant__struct_9 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %21 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %25 = OpVariable %_ptr_StorageBuffer__struct_23 StorageBuffer + %26 = OpVariable %_ptr_StorageBuffer__struct_23 StorageBuffer + %29 = OpFunction %void None %28 + %30 = OpLabel + %33 = OpAccessChain %_ptr_StorageBuffer_v4float %25 %uint_0 %uint_0 + %34 = OpAccessChain %_ptr_StorageBuffer_v4float %26 %uint_0 %uint_0 + %36 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %37 = OpLoad %uint %36 + %40 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_1 %uint_0 + %41 = OpLoad %uint %40 + %42 = OpIAdd %uint %41 %37 + %44 = OpIEqual %bool %42 %uint_1 + %46 = OpSelect %_ptr_Workgroup__arr_v4float_uint_64 %44 %7 %45 + %47 = OpSelect %_ptr_StorageBuffer_v4float %44 %33 %34 + %48 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %49 = OpLoad %uint %48 + %50 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %51 = OpLoad %uint %50 + %53 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %54 = OpLoad %uint %53 + %55 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %56 = OpCompositeExtract %uint %55 0 + %57 = OpCompositeExtract %uint %55 1 + %58 = OpCompositeExtract %uint %55 2 + %59 = OpIMul %uint %57 %54 + %60 = OpIAdd %uint %59 %51 + %61 = OpIMul %uint %60 %56 + %62 = OpIAdd %uint %61 %49 + %63 = OpIMul %uint %56 %57 + %64 = OpIMul %uint %63 %58 + %65 = OpULessThan %bool %62 %uint_64 + OpSelectionMerge %85 None + OpBranchConditional %65 %68 %85 + %68 = OpLabel + %70 = OpShiftLeftLogical %uint %42 %uint_6 + OpBranch %72 + %72 = OpLabel + %73 = OpPhi %uint %78 %72 %62 %68 + %75 = OpAccessChain %_ptr_Workgroup_v4float %46 %73 + %76 = OpIAdd %uint %70 %73 + %77 = OpPtrAccessChain %_ptr_StorageBuffer_v4float %47 %76 + %78 = OpIAdd %uint %73 %64 + %79 = OpLoad %v4float %77 + OpStore %75 %79 + %80 = OpUGreaterThanEqual %bool %78 %uint_64 + OpLoopMerge %83 %72 None + OpBranchConditional %80 %83 %72 + %83 = OpLabel + OpBranch %85 + %85 = OpLabel + OpBranch %87 + %87 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %90 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %91 = OpLoad %uint %90 + %92 = OpShiftRightLogical %uint %91 %uint_6 + %94 = OpBitwiseAnd %uint %91 %uint_63 + %95 = OpPtrAccessChain %_ptr_Workgroup_v4float %46 %92 %94 + %96 = OpLoad %v4float %95 + %99 = OpFMul %v4float %96 %98 + %100 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %101 = OpLoad %uint %100 + %102 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_0 %uint_0 + %103 = OpLoad %uint %102 + %104 = OpIAdd %uint %101 %103 + %105 = OpPtrAccessChain %_ptr_StorageBuffer_v4float %47 %104 + OpStore %105 %99 + OpReturn + OpFunctionEnd + %117 = OpExtInst %void %106 PushConstantRegionOffset %uint_0 %uint_12 + %119 = OpExtInst %void %106 PushConstantRegionGroupOffset %uint_16 %uint_12 + %109 = OpExtInst %void %106 Kernel %29 %107 %uint_2 %uint_0 %108 + %111 = OpExtInst %void %106 ArgumentInfo %110 + %112 = OpExtInst %void %106 ArgumentStorageBuffer %109 %uint_0 %uint_0 %uint_0 %111 + %114 = OpExtInst %void %106 ArgumentInfo %113 + %115 = OpExtInst %void %106 ArgumentStorageBuffer %109 %uint_1 %uint_0 %uint_1 %114 + %120 = OpExtInst %void %106 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test18.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test18.spv.dis new file mode 100644 index 0000000000..e7a46b7d8c --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test18.spv.dis @@ -0,0 +1,154 @@ +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %22 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 114 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointersStorageBuffer + OpCapability VariablePointers + %99 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %25 "foo" %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %15 %21 %22 %5 + OpSource OpenCL_C 200 + %100 = OpString "foo" + %101 = OpString " kernel" + %103 = OpString "p" + %106 = OpString "q" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %_struct_19 0 Offset 0 + OpDecorate %_struct_19 Block + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 0 + OpDecorate %21 Coherent + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 1 + OpDecorate %22 Coherent + OpDecorate %92 NoContraction + OpDecorate %_ptr_StorageBuffer_v4float ArrayStride 16 + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %_struct_19 = OpTypeStruct %_runtimearr_v4float +%_ptr_StorageBuffer__struct_19 = OpTypePointer StorageBuffer %_struct_19 + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 + %uint_64 = OpConstant %uint 64 + %uint_6 = OpConstant %uint 6 +%_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float + %70 = OpConstantNull %_ptr_Workgroup_v4float + %uint_264 = OpConstant %uint 264 + %uint_328 = OpConstant %uint 328 + %float_2 = OpConstant %float 2 + %91 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %21 = OpVariable %_ptr_StorageBuffer__struct_19 StorageBuffer + %22 = OpVariable %_ptr_StorageBuffer__struct_19 StorageBuffer + %25 = OpFunction %void None %24 + %26 = OpLabel + %29 = OpAccessChain %_ptr_StorageBuffer_v4float %21 %uint_0 %uint_0 + %30 = OpAccessChain %_ptr_StorageBuffer_v4float %22 %uint_0 %uint_0 + %32 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %33 = OpLoad %uint %32 + %36 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %37 = OpLoad %uint %36 + %38 = OpIAdd %uint %37 %33 + %40 = OpIEqual %bool %38 %uint_1 + %41 = OpSelect %_ptr_StorageBuffer_v4float %40 %29 %30 + %42 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %43 = OpLoad %uint %42 + %44 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %45 = OpLoad %uint %44 + %47 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %48 = OpLoad %uint %47 + %49 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %50 = OpCompositeExtract %uint %49 0 + %51 = OpCompositeExtract %uint %49 1 + %52 = OpCompositeExtract %uint %49 2 + %53 = OpIMul %uint %51 %48 + %54 = OpIAdd %uint %53 %45 + %55 = OpIMul %uint %54 %50 + %56 = OpIAdd %uint %55 %43 + %57 = OpIMul %uint %50 %51 + %58 = OpIMul %uint %57 %52 + %60 = OpULessThan %bool %56 %uint_64 + OpSelectionMerge %81 None + OpBranchConditional %60 %63 %81 + %63 = OpLabel + %65 = OpShiftLeftLogical %uint %38 %uint_6 + OpBranch %67 + %67 = OpLabel + %68 = OpPhi %uint %74 %67 %56 %63 + %71 = OpPtrAccessChain %_ptr_Workgroup_v4float %70 %68 + %72 = OpIAdd %uint %65 %68 + %73 = OpPtrAccessChain %_ptr_StorageBuffer_v4float %41 %72 + %74 = OpIAdd %uint %68 %58 + %75 = OpLoad %v4float %73 + OpStore %71 %75 + %76 = OpUGreaterThanEqual %bool %74 %uint_64 + OpLoopMerge %79 %67 None + OpBranchConditional %76 %79 %67 + %79 = OpLabel + OpBranch %81 + %81 = OpLabel + OpBranch %83 + %83 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %86 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %87 = OpLoad %uint %86 + %88 = OpPtrAccessChain %_ptr_Workgroup_v4float %70 %87 + %89 = OpLoad %v4float %88 + %92 = OpFMul %v4float %89 %91 + %93 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %94 = OpLoad %uint %93 + %95 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %96 = OpLoad %uint %95 + %97 = OpIAdd %uint %94 %96 + %98 = OpPtrAccessChain %_ptr_StorageBuffer_v4float %41 %97 + OpStore %98 %92 + OpReturn + OpFunctionEnd + %110 = OpExtInst %void %99 PushConstantRegionOffset %uint_0 %uint_12 + %112 = OpExtInst %void %99 PushConstantRegionGroupOffset %uint_16 %uint_12 + %102 = OpExtInst %void %99 Kernel %25 %100 %uint_2 %uint_0 %101 + %104 = OpExtInst %void %99 ArgumentInfo %103 + %105 = OpExtInst %void %99 ArgumentStorageBuffer %102 %uint_0 %uint_0 %uint_0 %104 + %107 = OpExtInst %void %99 ArgumentInfo %106 + %108 = OpExtInst %void %99 ArgumentStorageBuffer %102 %uint_1 %uint_0 %uint_1 %107 + %113 = OpExtInst %void %99 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test2.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test2.spv.dis new file mode 100644 index 0000000000..fc0f77bfcc --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test2.spv.dis @@ -0,0 +1,180 @@ +; @Input: %25 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %26 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 143 +; Schema: 0 + OpCapability Shader + %128 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %29 "foo" %6 %7 %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %21 %25 %26 %11 + OpSource OpenCL_C 200 + %129 = OpString "foo" + %130 = OpString " kernel" + %132 = OpString "p" + %135 = OpString "q" + OpMemberDecorate %_struct_9 0 Offset 0 + OpMemberDecorate %_struct_9 1 Offset 16 + OpDecorate %_struct_9 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_23 0 Offset 0 + OpDecorate %_struct_23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 1 + OpDecorate %114 NoContraction + OpDecorate %123 NoContraction + OpDecorate %16 SpecId 0 + OpDecorate %17 SpecId 1 + OpDecorate %18 SpecId 2 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_float_uint_64 = OpTypeArray %float %uint_64 +%_ptr_Workgroup__arr_float_uint_64 = OpTypePointer Workgroup %_arr_float_uint_64 + %v3uint = OpTypeVector %uint 3 + %_struct_9 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_9 = OpTypePointer PushConstant %_struct_9 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %16 = OpSpecConstant %uint 1 + %17 = OpSpecConstant %uint 1 + %18 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %16 %17 %18 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_23 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_23 = OpTypePointer StorageBuffer %_struct_23 + %void = OpTypeVoid + %28 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %bool = OpTypeBool + %uint_6 = OpConstant %uint 6 +%_ptr_Workgroup_float = OpTypePointer Workgroup %float +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %uint_264 = OpConstant %uint 264 + %float_2 = OpConstant %float 2 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %6 = OpVariable %_ptr_Workgroup__arr_float_uint_64 Workgroup + %7 = OpVariable %_ptr_Workgroup__arr_float_uint_64 Workgroup + %11 = OpVariable %_ptr_PushConstant__struct_9 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %21 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %25 = OpVariable %_ptr_StorageBuffer__struct_23 StorageBuffer + %26 = OpVariable %_ptr_StorageBuffer__struct_23 StorageBuffer + %29 = OpFunction %void None %28 + %30 = OpLabel + %33 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %34 = OpLoad %uint %33 + %37 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_1 %uint_0 + %38 = OpLoad %uint %37 + %39 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %40 = OpLoad %uint %39 + %41 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %42 = OpLoad %uint %41 + %44 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %45 = OpLoad %uint %44 + %46 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %47 = OpCompositeExtract %uint %46 0 + %48 = OpCompositeExtract %uint %46 1 + %49 = OpCompositeExtract %uint %46 2 + %50 = OpIMul %uint %48 %45 + %51 = OpIAdd %uint %50 %42 + %52 = OpIMul %uint %51 %47 + %53 = OpIAdd %uint %52 %40 + %54 = OpIMul %uint %47 %48 + %55 = OpIMul %uint %54 %49 + %57 = OpULessThan %bool %53 %uint_64 + %58 = OpLogicalNot %bool %57 + OpSelectionMerge %63 None + OpBranchConditional %58 %61 %63 + %61 = OpLabel + OpBranch %63 + %63 = OpLabel + %64 = OpPhi %bool %false %61 %true %30 + OpSelectionMerge %105 None + OpBranchConditional %64 %67 %105 + %67 = OpLabel + %68 = OpIAdd %uint %38 %34 + %70 = OpShiftLeftLogical %uint %68 %uint_6 + OpBranch %72 + %72 = OpLabel + %73 = OpPhi %uint %79 %72 %53 %67 + %75 = OpAccessChain %_ptr_Workgroup_float %6 %73 + %76 = OpIAdd %uint %70 %73 + %78 = OpAccessChain %_ptr_StorageBuffer_float %25 %uint_0 %76 + %79 = OpIAdd %uint %73 %55 + %80 = OpLoad %float %78 + OpStore %75 %80 + %81 = OpUGreaterThanEqual %bool %79 %uint_64 + OpLoopMerge %84 %72 None + OpBranchConditional %81 %84 %72 + %84 = OpLabel + OpSelectionMerge %103 None + OpBranchConditional %57 %87 %103 + %87 = OpLabel + %88 = OpIAdd %uint %38 %34 + %89 = OpShiftLeftLogical %uint %88 %uint_6 + OpBranch %91 + %91 = OpLabel + %92 = OpPhi %uint %96 %91 %53 %87 + %93 = OpAccessChain %_ptr_Workgroup_float %7 %92 + %94 = OpIAdd %uint %89 %92 + %95 = OpAccessChain %_ptr_StorageBuffer_float %26 %uint_0 %94 + %96 = OpIAdd %uint %92 %55 + %97 = OpLoad %float %95 + OpStore %93 %97 + %98 = OpUGreaterThanEqual %bool %96 %uint_64 + OpLoopMerge %101 %91 None + OpBranchConditional %98 %101 %91 + %101 = OpLabel + OpBranch %103 + %103 = OpLabel + OpBranch %105 + %105 = OpLabel + OpBranch %107 + %107 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %109 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %110 = OpLoad %uint %109 + %111 = OpAccessChain %_ptr_Workgroup_float %6 %110 + %112 = OpLoad %float %111 + %114 = OpFMul %float %112 %float_2 + %115 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %116 = OpLoad %uint %115 + %117 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_0 %uint_0 + %118 = OpLoad %uint %117 + %119 = OpIAdd %uint %116 %118 + %120 = OpAccessChain %_ptr_StorageBuffer_float %25 %uint_0 %119 + OpStore %120 %114 + %121 = OpAccessChain %_ptr_Workgroup_float %7 %110 + %122 = OpLoad %float %121 + %123 = OpFMul %float %122 %float_2 + %124 = OpIAdd %uint %116 %118 + %125 = OpAccessChain %_ptr_StorageBuffer_float %26 %uint_0 %124 + OpStore %125 %123 + OpReturn + OpFunctionEnd + %139 = OpExtInst %void %128 PushConstantRegionOffset %uint_0 %uint_12 + %141 = OpExtInst %void %128 PushConstantRegionGroupOffset %uint_16 %uint_12 + %131 = OpExtInst %void %128 Kernel %29 %129 %uint_2 %uint_0 %130 + %133 = OpExtInst %void %128 ArgumentInfo %132 + %134 = OpExtInst %void %128 ArgumentStorageBuffer %131 %uint_0 %uint_0 %uint_0 %133 + %136 = OpExtInst %void %128 ArgumentInfo %135 + %137 = OpExtInst %void %128 ArgumentStorageBuffer %131 %uint_1 %uint_0 %uint_1 %136 + %142 = OpExtInst %void %128 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test4.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test4.spv.dis new file mode 100644 index 0000000000..72c05691c8 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test4.spv.dis @@ -0,0 +1,222 @@ +; @Input: %24 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %25 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 185 +; Schema: 0 + OpCapability Shader + %172 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %28 "foo" %6 %7 %gl_LocalInvocationID %gl_WorkGroupID %20 %24 %25 %11 + OpSource OpenCL_C 200 + %173 = OpString "foo" + %174 = OpString " kernel" + %176 = OpString "p" + %179 = OpString "q" + OpMemberDecorate %_struct_9 0 Offset 0 + OpDecorate %_struct_9 Block + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_22 0 Offset 0 + OpDecorate %_struct_22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 0 + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 1 + OpDecorate %113 NoContraction + OpDecorate %116 NoContraction + OpDecorate %15 SpecId 0 + OpDecorate %16 SpecId 1 + OpDecorate %17 SpecId 2 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_float_uint_64 = OpTypeArray %float %uint_64 +%_ptr_Workgroup__arr_float_uint_64 = OpTypePointer Workgroup %_arr_float_uint_64 + %v3uint = OpTypeVector %uint 3 + %_struct_9 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_9 = OpTypePointer PushConstant %_struct_9 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %15 = OpSpecConstant %uint 1 + %16 = OpSpecConstant %uint 1 + %17 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %15 %16 %17 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_22 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_22 = OpTypePointer StorageBuffer %_struct_22 + %void = OpTypeVoid + %27 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %bool = OpTypeBool + %uint_6 = OpConstant %uint 6 +%_ptr_Workgroup_float = OpTypePointer Workgroup %float +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %uint_264 = OpConstant %uint 264 + %float_2 = OpConstant %float 2 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %6 = OpVariable %_ptr_Workgroup__arr_float_uint_64 Workgroup + %7 = OpVariable %_ptr_Workgroup__arr_float_uint_64 Workgroup + %11 = OpVariable %_ptr_PushConstant__struct_9 PushConstant +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %20 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %24 = OpVariable %_ptr_StorageBuffer__struct_22 StorageBuffer + %25 = OpVariable %_ptr_StorageBuffer__struct_22 StorageBuffer + %28 = OpFunction %void None %27 + %29 = OpLabel + %32 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %33 = OpLoad %uint %32 + %35 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_0 %uint_0 + %36 = OpLoad %uint %35 + %37 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %38 = OpLoad %uint %37 + %40 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %44 = OpLoad %uint %43 + %45 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %46 = OpCompositeExtract %uint %45 0 + %47 = OpCompositeExtract %uint %45 1 + %48 = OpCompositeExtract %uint %45 2 + %49 = OpIMul %uint %47 %44 + %50 = OpIAdd %uint %49 %41 + %51 = OpIMul %uint %50 %46 + %52 = OpIAdd %uint %51 %38 + %53 = OpIMul %uint %46 %47 + %54 = OpIMul %uint %53 %48 + %56 = OpULessThan %bool %52 %uint_64 + %57 = OpLogicalNot %bool %56 + OpSelectionMerge %62 None + OpBranchConditional %57 %60 %62 + %60 = OpLabel + OpBranch %62 + %62 = OpLabel + %63 = OpPhi %bool %false %60 %true %29 + OpSelectionMerge %104 None + OpBranchConditional %63 %66 %104 + %66 = OpLabel + %67 = OpIAdd %uint %36 %33 + %69 = OpShiftLeftLogical %uint %67 %uint_6 + OpBranch %71 + %71 = OpLabel + %72 = OpPhi %uint %78 %71 %52 %66 + %74 = OpAccessChain %_ptr_Workgroup_float %6 %72 + %75 = OpIAdd %uint %69 %72 + %77 = OpAccessChain %_ptr_StorageBuffer_float %24 %uint_0 %75 + %78 = OpIAdd %uint %72 %54 + %79 = OpLoad %float %77 + OpStore %74 %79 + %80 = OpUGreaterThanEqual %bool %78 %uint_64 + OpLoopMerge %83 %71 None + OpBranchConditional %80 %83 %71 + %83 = OpLabel + OpSelectionMerge %102 None + OpBranchConditional %56 %86 %102 + %86 = OpLabel + %87 = OpIAdd %uint %36 %33 + %88 = OpShiftLeftLogical %uint %87 %uint_6 + OpBranch %90 + %90 = OpLabel + %91 = OpPhi %uint %95 %90 %52 %86 + %92 = OpAccessChain %_ptr_Workgroup_float %7 %91 + %93 = OpIAdd %uint %88 %91 + %94 = OpAccessChain %_ptr_StorageBuffer_float %25 %uint_0 %93 + %95 = OpIAdd %uint %91 %54 + %96 = OpLoad %float %94 + OpStore %92 %96 + %97 = OpUGreaterThanEqual %bool %95 %uint_64 + OpLoopMerge %100 %90 None + OpBranchConditional %97 %100 %90 + %100 = OpLabel + OpBranch %102 + %102 = OpLabel + OpBranch %104 + %104 = OpLabel + OpBranch %106 + %106 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %108 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %109 = OpLoad %uint %108 + %110 = OpAccessChain %_ptr_Workgroup_float %6 %109 + %111 = OpLoad %float %110 + %113 = OpFMul %float %111 %float_2 + OpStore %110 %113 + %114 = OpAccessChain %_ptr_Workgroup_float %7 %109 + %115 = OpLoad %float %114 + %116 = OpFMul %float %115 %float_2 + OpStore %114 %116 + %117 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %118 = OpLoad %uint %117 + %119 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_0 %uint_0 + %120 = OpLoad %uint %119 + %121 = OpIAdd %uint %120 %118 + %122 = OpShiftLeftLogical %uint %121 %uint_6 + %123 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %124 = OpLoad %uint %123 + %125 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %126 = OpLoad %uint %125 + %127 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %128 = OpCompositeExtract %uint %127 0 + %129 = OpCompositeExtract %uint %127 1 + %130 = OpCompositeExtract %uint %127 2 + %131 = OpIMul %uint %129 %126 + %132 = OpIAdd %uint %131 %124 + %133 = OpIMul %uint %132 %128 + %134 = OpIAdd %uint %133 %109 + %135 = OpIMul %uint %128 %129 + %136 = OpIMul %uint %135 %130 + %137 = OpULessThan %bool %134 %uint_64 + OpSelectionMerge %167 None + OpBranchConditional %137 %140 %167 + %140 = OpLabel + %141 = OpPhi %uint %145 %140 %134 %106 + %142 = OpBitwiseOr %uint %141 %122 + %143 = OpAccessChain %_ptr_StorageBuffer_float %24 %uint_0 %142 + %144 = OpAccessChain %_ptr_Workgroup_float %6 %141 + %145 = OpIAdd %uint %141 %136 + %146 = OpLoad %float %144 + OpStore %143 %146 + %147 = OpUGreaterThanEqual %bool %145 %uint_64 + OpLoopMerge %150 %140 None + OpBranchConditional %147 %150 %140 + %150 = OpLabel + OpSelectionMerge %165 None + OpBranchConditional %137 %153 %165 + %153 = OpLabel + %154 = OpPhi %uint %158 %153 %134 %150 + %155 = OpBitwiseOr %uint %154 %122 + %156 = OpAccessChain %_ptr_StorageBuffer_float %25 %uint_0 %155 + %157 = OpAccessChain %_ptr_Workgroup_float %7 %154 + %158 = OpIAdd %uint %154 %136 + %159 = OpLoad %float %157 + OpStore %156 %159 + %160 = OpUGreaterThanEqual %bool %158 %uint_64 + OpLoopMerge %163 %153 None + OpBranchConditional %160 %163 %153 + %163 = OpLabel + OpBranch %165 + %165 = OpLabel + OpBranch %167 + %167 = OpLabel + OpBranch %169 + %169 = OpLabel + OpReturn + OpFunctionEnd + %183 = OpExtInst %void %172 PushConstantRegionGroupOffset %uint_0 %uint_12 + %175 = OpExtInst %void %172 Kernel %28 %173 %uint_2 %uint_0 %174 + %177 = OpExtInst %void %172 ArgumentInfo %176 + %178 = OpExtInst %void %172 ArgumentStorageBuffer %175 %uint_0 %uint_0 %uint_0 %177 + %180 = OpExtInst %void %172 ArgumentInfo %179 + %181 = OpExtInst %void %172 ArgumentStorageBuffer %175 %uint_1 %uint_0 %uint_1 %180 + %184 = OpExtInst %void %172 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test5.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test5.spv.dis new file mode 100644 index 0000000000..f243a5fa20 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test5.spv.dis @@ -0,0 +1,225 @@ +; @Input: %24 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %25 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 187 +; Schema: 0 + OpCapability Shader + %174 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %28 "foo" %6 %7 %gl_LocalInvocationID %gl_WorkGroupID %20 %24 %25 %11 + OpSource OpenCL_C 200 + %175 = OpString "foo" + %176 = OpString " kernel" + %178 = OpString "p" + %181 = OpString "q" + OpMemberDecorate %_struct_9 0 Offset 0 + OpDecorate %_struct_9 Block + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_22 0 Offset 0 + OpDecorate %_struct_22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 0 + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 1 + OpDecorate %113 NoContraction + OpDecorate %116 NoContraction + OpDecorate %15 SpecId 0 + OpDecorate %16 SpecId 1 + OpDecorate %17 SpecId 2 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_float_uint_64 = OpTypeArray %float %uint_64 +%_ptr_Workgroup__arr_float_uint_64 = OpTypePointer Workgroup %_arr_float_uint_64 + %v3uint = OpTypeVector %uint 3 + %_struct_9 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_9 = OpTypePointer PushConstant %_struct_9 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %15 = OpSpecConstant %uint 1 + %16 = OpSpecConstant %uint 1 + %17 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %15 %16 %17 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_22 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_22 = OpTypePointer StorageBuffer %_struct_22 + %void = OpTypeVoid + %27 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %bool = OpTypeBool + %uint_6 = OpConstant %uint 6 +%_ptr_Workgroup_float = OpTypePointer Workgroup %float +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %uint_264 = OpConstant %uint 264 + %float_2 = OpConstant %float 2 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %6 = OpVariable %_ptr_Workgroup__arr_float_uint_64 Workgroup + %7 = OpVariable %_ptr_Workgroup__arr_float_uint_64 Workgroup + %11 = OpVariable %_ptr_PushConstant__struct_9 PushConstant +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %20 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %24 = OpVariable %_ptr_StorageBuffer__struct_22 StorageBuffer + %25 = OpVariable %_ptr_StorageBuffer__struct_22 StorageBuffer + %28 = OpFunction %void None %27 + %29 = OpLabel + %32 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %33 = OpLoad %uint %32 + %35 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_0 %uint_0 + %36 = OpLoad %uint %35 + %37 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %38 = OpLoad %uint %37 + %40 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %44 = OpLoad %uint %43 + %45 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %46 = OpCompositeExtract %uint %45 0 + %47 = OpCompositeExtract %uint %45 1 + %48 = OpCompositeExtract %uint %45 2 + %49 = OpIMul %uint %47 %44 + %50 = OpIAdd %uint %49 %41 + %51 = OpIMul %uint %50 %46 + %52 = OpIAdd %uint %51 %38 + %53 = OpIMul %uint %46 %47 + %54 = OpIMul %uint %53 %48 + %56 = OpULessThan %bool %52 %uint_64 + %57 = OpLogicalNot %bool %56 + OpSelectionMerge %62 None + OpBranchConditional %57 %60 %62 + %60 = OpLabel + OpBranch %62 + %62 = OpLabel + %63 = OpPhi %bool %false %60 %true %29 + OpSelectionMerge %104 None + OpBranchConditional %63 %66 %104 + %66 = OpLabel + %67 = OpIAdd %uint %36 %33 + %69 = OpShiftLeftLogical %uint %67 %uint_6 + OpBranch %71 + %71 = OpLabel + %72 = OpPhi %uint %78 %71 %52 %66 + %74 = OpAccessChain %_ptr_Workgroup_float %6 %72 + %75 = OpIAdd %uint %69 %72 + %77 = OpAccessChain %_ptr_StorageBuffer_float %24 %uint_0 %75 + %78 = OpIAdd %uint %72 %54 + %79 = OpLoad %float %77 + OpStore %74 %79 + %80 = OpUGreaterThanEqual %bool %78 %uint_64 + OpLoopMerge %83 %71 None + OpBranchConditional %80 %83 %71 + %83 = OpLabel + OpSelectionMerge %102 None + OpBranchConditional %56 %86 %102 + %86 = OpLabel + %87 = OpIAdd %uint %36 %33 + %88 = OpShiftLeftLogical %uint %87 %uint_6 + OpBranch %90 + %90 = OpLabel + %91 = OpPhi %uint %95 %90 %52 %86 + %92 = OpAccessChain %_ptr_Workgroup_float %7 %91 + %93 = OpIAdd %uint %88 %91 + %94 = OpAccessChain %_ptr_StorageBuffer_float %25 %uint_0 %93 + %95 = OpIAdd %uint %91 %54 + %96 = OpLoad %float %94 + OpStore %92 %96 + %97 = OpUGreaterThanEqual %bool %95 %uint_64 + OpLoopMerge %100 %90 None + OpBranchConditional %97 %100 %90 + %100 = OpLabel + OpBranch %102 + %102 = OpLabel + OpBranch %104 + %104 = OpLabel + OpBranch %106 + %106 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %108 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %109 = OpLoad %uint %108 + %110 = OpAccessChain %_ptr_Workgroup_float %6 %109 + %111 = OpLoad %float %110 + %113 = OpFMul %float %111 %float_2 + OpStore %110 %113 + %114 = OpAccessChain %_ptr_Workgroup_float %7 %109 + %115 = OpLoad %float %114 + %116 = OpFMul %float %115 %float_2 + OpStore %114 %116 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %117 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %118 = OpLoad %uint %117 + %119 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_0 %uint_0 + %120 = OpLoad %uint %119 + %121 = OpIAdd %uint %120 %118 + %122 = OpShiftLeftLogical %uint %121 %uint_6 + %123 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %124 = OpLoad %uint %123 + %125 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %126 = OpLoad %uint %125 + %127 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %128 = OpLoad %uint %127 + %129 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %130 = OpCompositeExtract %uint %129 0 + %131 = OpCompositeExtract %uint %129 1 + %132 = OpCompositeExtract %uint %129 2 + %133 = OpIMul %uint %131 %128 + %134 = OpIAdd %uint %133 %126 + %135 = OpIMul %uint %134 %130 + %136 = OpIAdd %uint %135 %124 + %137 = OpIMul %uint %130 %131 + %138 = OpIMul %uint %137 %132 + %139 = OpULessThan %bool %136 %uint_64 + OpSelectionMerge %169 None + OpBranchConditional %139 %142 %169 + %142 = OpLabel + %143 = OpPhi %uint %147 %142 %136 %106 + %144 = OpBitwiseOr %uint %143 %122 + %145 = OpAccessChain %_ptr_StorageBuffer_float %24 %uint_0 %144 + %146 = OpAccessChain %_ptr_Workgroup_float %6 %143 + %147 = OpIAdd %uint %143 %138 + %148 = OpLoad %float %146 + OpStore %145 %148 + %149 = OpUGreaterThanEqual %bool %147 %uint_64 + OpLoopMerge %152 %142 None + OpBranchConditional %149 %152 %142 + %152 = OpLabel + OpSelectionMerge %167 None + OpBranchConditional %139 %155 %167 + %155 = OpLabel + %156 = OpPhi %uint %160 %155 %136 %152 + %157 = OpBitwiseOr %uint %156 %122 + %158 = OpAccessChain %_ptr_StorageBuffer_float %24 %uint_0 %157 + %159 = OpAccessChain %_ptr_Workgroup_float %7 %156 + %160 = OpIAdd %uint %156 %138 + %161 = OpLoad %float %159 + OpStore %158 %161 + %162 = OpUGreaterThanEqual %bool %160 %uint_64 + OpLoopMerge %165 %155 None + OpBranchConditional %162 %165 %155 + %165 = OpLabel + OpBranch %167 + %167 = OpLabel + OpBranch %169 + %169 = OpLabel + OpBranch %171 + %171 = OpLabel + OpReturn + OpFunctionEnd + %185 = OpExtInst %void %174 PushConstantRegionGroupOffset %uint_0 %uint_12 + %177 = OpExtInst %void %174 Kernel %28 %175 %uint_2 %uint_0 %176 + %179 = OpExtInst %void %174 ArgumentInfo %178 + %180 = OpExtInst %void %174 ArgumentStorageBuffer %177 %uint_0 %uint_0 %uint_0 %179 + %182 = OpExtInst %void %174 ArgumentInfo %181 + %183 = OpExtInst %void %174 ArgumentStorageBuffer %177 %uint_1 %uint_0 %uint_1 %182 + %186 = OpExtInst %void %174 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test7.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test7.spv.dis new file mode 100644 index 0000000000..fc510f3bfb --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test7.spv.dis @@ -0,0 +1,90 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %64 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_GlobalInvocationID %13 %gl_LocalInvocationID %5 + OpSource OpenCL_C 200 + %65 = OpString "foo" + %66 = OpString " kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %uint_213 = OpConstant %uint 213 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_64 = OpConstant %uint 64 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %17 = OpFunction %void Pure %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %22 = OpLoad %uint %21 + %24 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %25 = OpLoad %uint %24 + %26 = OpIAdd %uint %25 %22 + %29 = OpULessThan %bool %26 %uint_213 + OpSelectionMerge %61 None + OpBranchConditional %29 %32 %61 + %32 = OpLabel + %33 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %34 = OpLoad %uint %33 + %36 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %37 = OpLoad %uint %36 + %39 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %40 = OpLoad %uint %39 + %41 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %42 = OpCompositeExtract %uint %41 0 + %43 = OpCompositeExtract %uint %41 1 + %44 = OpCompositeExtract %uint %41 2 + %45 = OpIMul %uint %43 %40 + %46 = OpIAdd %uint %45 %37 + %47 = OpIMul %uint %46 %42 + %48 = OpIAdd %uint %47 %34 + %49 = OpIMul %uint %42 %43 + %50 = OpIMul %uint %49 %44 + OpBranch %52 + %52 = OpLabel + %53 = OpPhi %uint %56 %52 %48 %32 + %55 = OpUGreaterThanEqual %bool %53 %uint_64 + %56 = OpIAdd %uint %53 %50 + OpLoopMerge %59 %52 None + OpBranchConditional %55 %59 %52 + %59 = OpLabel + OpBranch %61 + %61 = OpLabel + OpBranch %63 + %63 = OpLabel + OpReturn + OpFunctionEnd + %69 = OpExtInst %void %64 PushConstantRegionOffset %uint_0 %uint_12 + %67 = OpExtInst %void %64 Kernel %17 %65 %uint_2 %uint_0 %66 + %70 = OpExtInst %void %64 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test8.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test8.spv.dis new file mode 100644 index 0000000000..fd9c8e40bf --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test8.spv.dis @@ -0,0 +1,83 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 63 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_LocalInvocationID %gl_WorkGroupID %14 %5 + OpSource OpenCL_C 200 + %57 = OpString "foo" + %58 = OpString " kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %9 SpecId 0 + OpDecorate %10 SpecId 1 + OpDecorate %11 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %9 %10 %11 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %bool = OpTypeBool + %uint_64 = OpConstant %uint 64 + %uint_264 = OpConstant %uint 264 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %22 = OpLoad %uint %21 + %24 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %25 = OpLoad %uint %24 + %27 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %28 = OpLoad %uint %27 + %29 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %30 = OpCompositeExtract %uint %29 0 + %31 = OpCompositeExtract %uint %29 1 + %32 = OpCompositeExtract %uint %29 2 + %33 = OpIMul %uint %31 %28 + %34 = OpIAdd %uint %33 %25 + %35 = OpIMul %uint %34 %30 + %36 = OpIAdd %uint %35 %22 + %37 = OpIMul %uint %30 %31 + %38 = OpIMul %uint %37 %32 + OpBranch %40 + %40 = OpLabel + %41 = OpPhi %uint %36 %18 %45 %40 + %44 = OpUGreaterThanEqual %bool %41 %uint_64 + %45 = OpIAdd %uint %41 %38 + OpLoopMerge %48 %40 None + OpBranchConditional %44 %48 %40 + %48 = OpLabel + %49 = OpPhi %uint %51 %48 %36 %40 + %50 = OpUGreaterThanEqual %bool %49 %uint_64 + %51 = OpIAdd %uint %49 %38 + OpLoopMerge %54 %48 None + OpBranchConditional %50 %54 %48 + %54 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpReturn + OpFunctionEnd + %61 = OpExtInst %void %56 PushConstantRegionGroupOffset %uint_0 %uint_12 + %59 = OpExtInst %void %56 Kernel %17 %57 %uint_2 %uint_0 %58 + %62 = OpExtInst %void %56 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test9.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test9.spv.dis new file mode 100644 index 0000000000..63228a12c9 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/fail/test9.spv.dis @@ -0,0 +1,90 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 70 +; Schema: 0 + OpCapability Shader + %63 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_LocalInvocationID %gl_WorkGroupID %14 %5 + OpSource OpenCL_C 200 + %64 = OpString "foo" + %65 = OpString " kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %9 SpecId 0 + OpDecorate %10 SpecId 1 + OpDecorate %11 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %9 %10 %11 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %bool = OpTypeBool + %uint_64 = OpConstant %uint 64 + %uint_13 = OpConstant %uint 13 + %uint_264 = OpConstant %uint 264 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %22 = OpLoad %uint %21 + %24 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %25 = OpLoad %uint %24 + %27 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %28 = OpLoad %uint %27 + %29 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %30 = OpCompositeExtract %uint %29 0 + %31 = OpCompositeExtract %uint %29 1 + %32 = OpCompositeExtract %uint %29 2 + %33 = OpIMul %uint %31 %28 + %34 = OpIAdd %uint %33 %25 + %35 = OpIMul %uint %34 %30 + %36 = OpIAdd %uint %35 %22 + %37 = OpIMul %uint %30 %31 + %38 = OpIMul %uint %37 %32 + OpBranch %40 + %40 = OpLabel + %41 = OpPhi %uint %36 %18 %45 %40 + %44 = OpUGreaterThanEqual %bool %41 %uint_64 + %45 = OpIAdd %uint %41 %38 + OpLoopMerge %48 %40 None + OpBranchConditional %44 %48 %40 + %48 = OpLabel + %49 = OpPhi %uint %51 %48 %36 %40 + %50 = OpUGreaterThanEqual %bool %49 %uint_64 + %51 = OpIAdd %uint %49 %38 + OpLoopMerge %54 %48 None + OpBranchConditional %50 %54 %48 + %54 = OpLabel + %56 = OpUGreaterThan %bool %22 %uint_13 + OpSelectionMerge %62 None + OpBranchConditional %56 %59 %62 + %59 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %62 + %62 = OpLabel + OpReturn + OpFunctionEnd + %68 = OpExtInst %void %63 PushConstantRegionGroupOffset %uint_0 %uint_12 + %66 = OpExtInst %void %63 Kernel %17 %64 %uint_2 %uint_0 %65 + %69 = OpExtInst %void %63 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test1.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test1.spv.dis new file mode 100644 index 0000000000..293a6e95ab --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test1.spv.dis @@ -0,0 +1,139 @@ +; @Input: %24 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 106 +; Schema: 0 + OpCapability Shader + %94 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %27 "foo" %6 %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %20 %24 %10 + OpSource OpenCL_C 200 + %95 = OpString "foo" + %96 = OpString " kernel" + %98 = OpString "p" + OpMemberDecorate %_struct_8 0 Offset 0 + OpMemberDecorate %_struct_8 1 Offset 16 + OpDecorate %_struct_8 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_22 0 Offset 0 + OpDecorate %_struct_22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 0 + OpDecorate %24 Coherent + OpDecorate %87 NoContraction + OpDecorate %15 SpecId 0 + OpDecorate %16 SpecId 1 + OpDecorate %17 SpecId 2 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_float_uint_64 = OpTypeArray %float %uint_64 +%_ptr_Workgroup__arr_float_uint_64 = OpTypePointer Workgroup %_arr_float_uint_64 + %v3uint = OpTypeVector %uint 3 + %_struct_8 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_8 = OpTypePointer PushConstant %_struct_8 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %15 = OpSpecConstant %uint 1 + %16 = OpSpecConstant %uint 1 + %17 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %15 %16 %17 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_22 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_22 = OpTypePointer StorageBuffer %_struct_22 + %void = OpTypeVoid + %26 = OpTypeFunction %void +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_2 = OpConstant %uint 2 + %bool = OpTypeBool + %uint_6 = OpConstant %uint 6 +%_ptr_Workgroup_float = OpTypePointer Workgroup %float +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %uint_264 = OpConstant %uint 264 + %uint_328 = OpConstant %uint 328 + %float_2 = OpConstant %float 2 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %6 = OpVariable %_ptr_Workgroup__arr_float_uint_64 Workgroup + %10 = OpVariable %_ptr_PushConstant__struct_8 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %20 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %24 = OpVariable %_ptr_StorageBuffer__struct_22 StorageBuffer + %27 = OpFunction %void None %26 + %28 = OpLabel + %32 = OpAccessChain %_ptr_PushConstant_uint %10 %uint_1 %uint_0 + %33 = OpLoad %uint %32 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %37 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %38 = OpLoad %uint %37 + %40 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %41 = OpLoad %uint %40 + %42 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %43 = OpCompositeExtract %uint %42 0 + %44 = OpCompositeExtract %uint %42 1 + %45 = OpCompositeExtract %uint %42 2 + %46 = OpIMul %uint %44 %41 + %47 = OpIAdd %uint %46 %38 + %48 = OpIMul %uint %47 %43 + %49 = OpIAdd %uint %48 %36 + %50 = OpIMul %uint %43 %44 + %51 = OpIMul %uint %50 %45 + %53 = OpULessThan %bool %49 %uint_64 + OpSelectionMerge %77 None + OpBranchConditional %53 %56 %77 + %56 = OpLabel + %57 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %58 = OpLoad %uint %57 + %59 = OpIAdd %uint %33 %58 + %61 = OpShiftLeftLogical %uint %59 %uint_6 + OpBranch %63 + %63 = OpLabel + %64 = OpPhi %uint %70 %63 %49 %56 + %66 = OpAccessChain %_ptr_Workgroup_float %6 %64 + %67 = OpIAdd %uint %61 %64 + %69 = OpAccessChain %_ptr_StorageBuffer_float %24 %uint_0 %67 + %70 = OpIAdd %uint %64 %51 + %71 = OpLoad %float %69 + OpStore %66 %71 + %72 = OpUGreaterThanEqual %bool %70 %uint_64 + OpLoopMerge %75 %63 None + OpBranchConditional %72 %75 %63 + %75 = OpLabel + OpBranch %77 + %77 = OpLabel + OpBranch %79 + %79 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %82 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %83 = OpLoad %uint %82 + %84 = OpAccessChain %_ptr_Workgroup_float %6 %83 + %85 = OpLoad %float %84 + %87 = OpFMul %float %85 %float_2 + %88 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %89 = OpLoad %uint %88 + %90 = OpAccessChain %_ptr_PushConstant_uint %10 %uint_0 %uint_0 + %91 = OpLoad %uint %90 + %92 = OpIAdd %uint %89 %91 + %93 = OpAccessChain %_ptr_StorageBuffer_float %24 %uint_0 %92 + OpStore %93 %87 + OpReturn + OpFunctionEnd + %102 = OpExtInst %void %94 PushConstantRegionOffset %uint_0 %uint_12 + %104 = OpExtInst %void %94 PushConstantRegionGroupOffset %uint_16 %uint_12 + %97 = OpExtInst %void %94 Kernel %27 %95 %uint_1 %uint_0 %96 + %99 = OpExtInst %void %94 ArgumentInfo %98 + %100 = OpExtInst %void %94 ArgumentStorageBuffer %97 %uint_0 %uint_0 %uint_0 %99 + %105 = OpExtInst %void %94 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test2.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test2.spv.dis new file mode 100644 index 0000000000..a3412a0197 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test2.spv.dis @@ -0,0 +1,184 @@ +; @Input: %25 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %26 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 144 +; Schema: 0 + OpCapability Shader + %129 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %29 "foo" %6 %7 %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %21 %25 %26 %11 + OpSource OpenCL_C 200 + %130 = OpString "foo" + %131 = OpString " kernel" + %133 = OpString "p" + %136 = OpString "q" + OpMemberDecorate %_struct_9 0 Offset 0 + OpMemberDecorate %_struct_9 1 Offset 16 + OpDecorate %_struct_9 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_23 0 Offset 0 + OpDecorate %_struct_23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %25 Coherent + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 1 + OpDecorate %26 Coherent + OpDecorate %115 NoContraction + OpDecorate %124 NoContraction + OpDecorate %16 SpecId 0 + OpDecorate %17 SpecId 1 + OpDecorate %18 SpecId 2 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_float_uint_64 = OpTypeArray %float %uint_64 +%_ptr_Workgroup__arr_float_uint_64 = OpTypePointer Workgroup %_arr_float_uint_64 + %v3uint = OpTypeVector %uint 3 + %_struct_9 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_9 = OpTypePointer PushConstant %_struct_9 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %16 = OpSpecConstant %uint 1 + %17 = OpSpecConstant %uint 1 + %18 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %16 %17 %18 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_23 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_23 = OpTypePointer StorageBuffer %_struct_23 + %void = OpTypeVoid + %28 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %bool = OpTypeBool + %uint_6 = OpConstant %uint 6 +%_ptr_Workgroup_float = OpTypePointer Workgroup %float +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %uint_264 = OpConstant %uint 264 + %uint_328 = OpConstant %uint 328 + %float_2 = OpConstant %float 2 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %6 = OpVariable %_ptr_Workgroup__arr_float_uint_64 Workgroup + %7 = OpVariable %_ptr_Workgroup__arr_float_uint_64 Workgroup + %11 = OpVariable %_ptr_PushConstant__struct_9 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %21 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %25 = OpVariable %_ptr_StorageBuffer__struct_23 StorageBuffer + %26 = OpVariable %_ptr_StorageBuffer__struct_23 StorageBuffer + %29 = OpFunction %void None %28 + %30 = OpLabel + %33 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %34 = OpLoad %uint %33 + %37 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_1 %uint_0 + %38 = OpLoad %uint %37 + %39 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %40 = OpLoad %uint %39 + %41 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %42 = OpLoad %uint %41 + %44 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %45 = OpLoad %uint %44 + %46 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %47 = OpCompositeExtract %uint %46 0 + %48 = OpCompositeExtract %uint %46 1 + %49 = OpCompositeExtract %uint %46 2 + %50 = OpIMul %uint %48 %45 + %51 = OpIAdd %uint %50 %42 + %52 = OpIMul %uint %51 %47 + %53 = OpIAdd %uint %52 %40 + %54 = OpIMul %uint %47 %48 + %55 = OpIMul %uint %54 %49 + %57 = OpULessThan %bool %53 %uint_64 + %58 = OpLogicalNot %bool %57 + OpSelectionMerge %63 None + OpBranchConditional %58 %61 %63 + %61 = OpLabel + OpBranch %63 + %63 = OpLabel + %64 = OpPhi %bool %false %61 %true %30 + OpSelectionMerge %105 None + OpBranchConditional %64 %67 %105 + %67 = OpLabel + %68 = OpIAdd %uint %38 %34 + %70 = OpShiftLeftLogical %uint %68 %uint_6 + OpBranch %72 + %72 = OpLabel + %73 = OpPhi %uint %79 %72 %53 %67 + %75 = OpAccessChain %_ptr_Workgroup_float %6 %73 + %76 = OpIAdd %uint %70 %73 + %78 = OpAccessChain %_ptr_StorageBuffer_float %25 %uint_0 %76 + %79 = OpIAdd %uint %73 %55 + %80 = OpLoad %float %78 + OpStore %75 %80 + %81 = OpUGreaterThanEqual %bool %79 %uint_64 + OpLoopMerge %84 %72 None + OpBranchConditional %81 %84 %72 + %84 = OpLabel + OpSelectionMerge %103 None + OpBranchConditional %57 %87 %103 + %87 = OpLabel + %88 = OpIAdd %uint %38 %34 + %89 = OpShiftLeftLogical %uint %88 %uint_6 + OpBranch %91 + %91 = OpLabel + %92 = OpPhi %uint %96 %91 %53 %87 + %93 = OpAccessChain %_ptr_Workgroup_float %7 %92 + %94 = OpIAdd %uint %89 %92 + %95 = OpAccessChain %_ptr_StorageBuffer_float %26 %uint_0 %94 + %96 = OpIAdd %uint %92 %55 + %97 = OpLoad %float %95 + OpStore %93 %97 + %98 = OpUGreaterThanEqual %bool %96 %uint_64 + OpLoopMerge %101 %91 None + OpBranchConditional %98 %101 %91 + %101 = OpLabel + OpBranch %103 + %103 = OpLabel + OpBranch %105 + %105 = OpLabel + OpBranch %107 + %107 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %110 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %111 = OpLoad %uint %110 + %112 = OpAccessChain %_ptr_Workgroup_float %6 %111 + %113 = OpLoad %float %112 + %115 = OpFMul %float %113 %float_2 + %116 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %117 = OpLoad %uint %116 + %118 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_0 %uint_0 + %119 = OpLoad %uint %118 + %120 = OpIAdd %uint %117 %119 + %121 = OpAccessChain %_ptr_StorageBuffer_float %25 %uint_0 %120 + OpStore %121 %115 + %122 = OpAccessChain %_ptr_Workgroup_float %7 %111 + %123 = OpLoad %float %122 + %124 = OpFMul %float %123 %float_2 + %125 = OpIAdd %uint %117 %119 + %126 = OpAccessChain %_ptr_StorageBuffer_float %26 %uint_0 %125 + OpStore %126 %124 + OpReturn + OpFunctionEnd + %140 = OpExtInst %void %129 PushConstantRegionOffset %uint_0 %uint_12 + %142 = OpExtInst %void %129 PushConstantRegionGroupOffset %uint_16 %uint_12 + %132 = OpExtInst %void %129 Kernel %29 %130 %uint_2 %uint_0 %131 + %134 = OpExtInst %void %129 ArgumentInfo %133 + %135 = OpExtInst %void %129 ArgumentStorageBuffer %132 %uint_0 %uint_0 %uint_0 %134 + %137 = OpExtInst %void %129 ArgumentInfo %136 + %138 = OpExtInst %void %129 ArgumentStorageBuffer %132 %uint_1 %uint_0 %uint_1 %137 + %143 = OpExtInst %void %129 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test3.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test3.spv.dis new file mode 100644 index 0000000000..a3412a0197 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test3.spv.dis @@ -0,0 +1,184 @@ +; @Input: %25 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %26 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 144 +; Schema: 0 + OpCapability Shader + %129 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %29 "foo" %6 %7 %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %21 %25 %26 %11 + OpSource OpenCL_C 200 + %130 = OpString "foo" + %131 = OpString " kernel" + %133 = OpString "p" + %136 = OpString "q" + OpMemberDecorate %_struct_9 0 Offset 0 + OpMemberDecorate %_struct_9 1 Offset 16 + OpDecorate %_struct_9 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_23 0 Offset 0 + OpDecorate %_struct_23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %25 Coherent + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 1 + OpDecorate %26 Coherent + OpDecorate %115 NoContraction + OpDecorate %124 NoContraction + OpDecorate %16 SpecId 0 + OpDecorate %17 SpecId 1 + OpDecorate %18 SpecId 2 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_float_uint_64 = OpTypeArray %float %uint_64 +%_ptr_Workgroup__arr_float_uint_64 = OpTypePointer Workgroup %_arr_float_uint_64 + %v3uint = OpTypeVector %uint 3 + %_struct_9 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_9 = OpTypePointer PushConstant %_struct_9 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %16 = OpSpecConstant %uint 1 + %17 = OpSpecConstant %uint 1 + %18 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %16 %17 %18 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_23 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_23 = OpTypePointer StorageBuffer %_struct_23 + %void = OpTypeVoid + %28 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %bool = OpTypeBool + %uint_6 = OpConstant %uint 6 +%_ptr_Workgroup_float = OpTypePointer Workgroup %float +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %uint_264 = OpConstant %uint 264 + %uint_328 = OpConstant %uint 328 + %float_2 = OpConstant %float 2 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %6 = OpVariable %_ptr_Workgroup__arr_float_uint_64 Workgroup + %7 = OpVariable %_ptr_Workgroup__arr_float_uint_64 Workgroup + %11 = OpVariable %_ptr_PushConstant__struct_9 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %21 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %25 = OpVariable %_ptr_StorageBuffer__struct_23 StorageBuffer + %26 = OpVariable %_ptr_StorageBuffer__struct_23 StorageBuffer + %29 = OpFunction %void None %28 + %30 = OpLabel + %33 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %34 = OpLoad %uint %33 + %37 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_1 %uint_0 + %38 = OpLoad %uint %37 + %39 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %40 = OpLoad %uint %39 + %41 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %42 = OpLoad %uint %41 + %44 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %45 = OpLoad %uint %44 + %46 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %47 = OpCompositeExtract %uint %46 0 + %48 = OpCompositeExtract %uint %46 1 + %49 = OpCompositeExtract %uint %46 2 + %50 = OpIMul %uint %48 %45 + %51 = OpIAdd %uint %50 %42 + %52 = OpIMul %uint %51 %47 + %53 = OpIAdd %uint %52 %40 + %54 = OpIMul %uint %47 %48 + %55 = OpIMul %uint %54 %49 + %57 = OpULessThan %bool %53 %uint_64 + %58 = OpLogicalNot %bool %57 + OpSelectionMerge %63 None + OpBranchConditional %58 %61 %63 + %61 = OpLabel + OpBranch %63 + %63 = OpLabel + %64 = OpPhi %bool %false %61 %true %30 + OpSelectionMerge %105 None + OpBranchConditional %64 %67 %105 + %67 = OpLabel + %68 = OpIAdd %uint %38 %34 + %70 = OpShiftLeftLogical %uint %68 %uint_6 + OpBranch %72 + %72 = OpLabel + %73 = OpPhi %uint %79 %72 %53 %67 + %75 = OpAccessChain %_ptr_Workgroup_float %6 %73 + %76 = OpIAdd %uint %70 %73 + %78 = OpAccessChain %_ptr_StorageBuffer_float %25 %uint_0 %76 + %79 = OpIAdd %uint %73 %55 + %80 = OpLoad %float %78 + OpStore %75 %80 + %81 = OpUGreaterThanEqual %bool %79 %uint_64 + OpLoopMerge %84 %72 None + OpBranchConditional %81 %84 %72 + %84 = OpLabel + OpSelectionMerge %103 None + OpBranchConditional %57 %87 %103 + %87 = OpLabel + %88 = OpIAdd %uint %38 %34 + %89 = OpShiftLeftLogical %uint %88 %uint_6 + OpBranch %91 + %91 = OpLabel + %92 = OpPhi %uint %96 %91 %53 %87 + %93 = OpAccessChain %_ptr_Workgroup_float %7 %92 + %94 = OpIAdd %uint %89 %92 + %95 = OpAccessChain %_ptr_StorageBuffer_float %26 %uint_0 %94 + %96 = OpIAdd %uint %92 %55 + %97 = OpLoad %float %95 + OpStore %93 %97 + %98 = OpUGreaterThanEqual %bool %96 %uint_64 + OpLoopMerge %101 %91 None + OpBranchConditional %98 %101 %91 + %101 = OpLabel + OpBranch %103 + %103 = OpLabel + OpBranch %105 + %105 = OpLabel + OpBranch %107 + %107 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %110 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %111 = OpLoad %uint %110 + %112 = OpAccessChain %_ptr_Workgroup_float %6 %111 + %113 = OpLoad %float %112 + %115 = OpFMul %float %113 %float_2 + %116 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %117 = OpLoad %uint %116 + %118 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_0 %uint_0 + %119 = OpLoad %uint %118 + %120 = OpIAdd %uint %117 %119 + %121 = OpAccessChain %_ptr_StorageBuffer_float %25 %uint_0 %120 + OpStore %121 %115 + %122 = OpAccessChain %_ptr_Workgroup_float %7 %111 + %123 = OpLoad %float %122 + %124 = OpFMul %float %123 %float_2 + %125 = OpIAdd %uint %117 %119 + %126 = OpAccessChain %_ptr_StorageBuffer_float %26 %uint_0 %125 + OpStore %126 %124 + OpReturn + OpFunctionEnd + %140 = OpExtInst %void %129 PushConstantRegionOffset %uint_0 %uint_12 + %142 = OpExtInst %void %129 PushConstantRegionGroupOffset %uint_16 %uint_12 + %132 = OpExtInst %void %129 Kernel %29 %130 %uint_2 %uint_0 %131 + %134 = OpExtInst %void %129 ArgumentInfo %133 + %135 = OpExtInst %void %129 ArgumentStorageBuffer %132 %uint_0 %uint_0 %uint_0 %134 + %137 = OpExtInst %void %129 ArgumentInfo %136 + %138 = OpExtInst %void %129 ArgumentStorageBuffer %132 %uint_1 %uint_0 %uint_1 %137 + %143 = OpExtInst %void %129 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test4.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test4.spv.dis new file mode 100644 index 0000000000..cc7aa6f0b1 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test4.spv.dis @@ -0,0 +1,193 @@ +; @Input: %25 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 155 +; Schema: 0 + OpCapability Shader + OpCapability Int8 + %143 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %28 "foo" %6 %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %20 %25 %10 + OpSource OpenCL_C 200 + %144 = OpString "foo" + %145 = OpString " kernel" + %147 = OpString "p" + OpMemberDecorate %_struct_8 0 Offset 0 + OpMemberDecorate %_struct_8 1 Offset 16 + OpDecorate %_struct_8 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uchar ArrayStride 1 + OpMemberDecorate %_struct_23 0 Offset 0 + OpDecorate %_struct_23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %25 Coherent + OpDecorate %124 NoContraction + OpDecorate %15 SpecId 0 + OpDecorate %16 SpecId 1 + OpDecorate %17 SpecId 2 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_128 = OpConstant %uint 128 +%_arr_float_uint_128 = OpTypeArray %float %uint_128 +%_ptr_Workgroup__arr_float_uint_128 = OpTypePointer Workgroup %_arr_float_uint_128 + %v3uint = OpTypeVector %uint 3 + %_struct_8 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_8 = OpTypePointer PushConstant %_struct_8 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %15 = OpSpecConstant %uint 1 + %16 = OpSpecConstant %uint 1 + %17 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %15 %16 %17 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %uchar = OpTypeInt 8 0 +%_runtimearr_uchar = OpTypeRuntimeArray %uchar + %_struct_23 = OpTypeStruct %_runtimearr_uchar +%_ptr_StorageBuffer__struct_23 = OpTypePointer StorageBuffer %_struct_23 + %void = OpTypeVoid + %27 = OpTypeFunction %void +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_2 = OpConstant %uint 2 + %bool = OpTypeBool + %uint_64 = OpConstant %uint 64 + %uint_8 = OpConstant %uint 8 +%_ptr_StorageBuffer_uchar = OpTypePointer StorageBuffer %uchar + %uint_3 = OpConstant %uint 3 + %v4uchar = OpTypeVector %uchar 4 + %84 = OpUndef %v4uchar +%_ptr_Workgroup_float = OpTypePointer Workgroup %float + %uint_256 = OpConstant %uint 256 + %uint_264 = OpConstant %uint 264 + %uint_328 = OpConstant %uint 328 + %float_2 = OpConstant %float 2 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %6 = OpVariable %_ptr_Workgroup__arr_float_uint_128 Workgroup + %10 = OpVariable %_ptr_PushConstant__struct_8 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %20 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %25 = OpVariable %_ptr_StorageBuffer__struct_23 StorageBuffer + %28 = OpFunction %void None %27 + %29 = OpLabel + %33 = OpAccessChain %_ptr_PushConstant_uint %10 %uint_1 %uint_0 + %34 = OpLoad %uint %33 + %36 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %37 = OpLoad %uint %36 + %38 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %39 = OpLoad %uint %38 + %41 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %42 = OpLoad %uint %41 + %43 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %44 = OpCompositeExtract %uint %43 0 + %45 = OpCompositeExtract %uint %43 1 + %46 = OpCompositeExtract %uint %43 2 + %47 = OpIMul %uint %45 %42 + %48 = OpIAdd %uint %47 %39 + %49 = OpIMul %uint %48 %44 + %50 = OpIAdd %uint %49 %37 + %51 = OpIMul %uint %44 %45 + %52 = OpIMul %uint %51 %46 + %55 = OpULessThan %bool %50 %uint_64 + OpSelectionMerge %97 None + OpBranchConditional %55 %58 %97 + %58 = OpLabel + %59 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %60 = OpLoad %uint %59 + %61 = OpIAdd %uint %34 %60 + %63 = OpShiftLeftLogical %uint %61 %uint_8 + OpBranch %65 + %65 = OpLabel + %66 = OpPhi %uint %69 %65 %50 %58 + %67 = OpShiftLeftLogical %uint %66 %uint_2 + %68 = OpIAdd %uint %67 %63 + %69 = OpIAdd %uint %66 %52 + %71 = OpAccessChain %_ptr_StorageBuffer_uchar %25 %uint_0 %68 + %72 = OpLoad %uchar %71 + %73 = OpBitwiseOr %uint %68 %uint_1 + %74 = OpAccessChain %_ptr_StorageBuffer_uchar %25 %uint_0 %73 + %75 = OpLoad %uchar %74 + %76 = OpBitwiseOr %uint %68 %uint_2 + %77 = OpAccessChain %_ptr_StorageBuffer_uchar %25 %uint_0 %76 + %78 = OpLoad %uchar %77 + %80 = OpBitwiseOr %uint %68 %uint_3 + %81 = OpAccessChain %_ptr_StorageBuffer_uchar %25 %uint_0 %80 + %82 = OpLoad %uchar %81 + %85 = OpCompositeInsert %v4uchar %72 %84 0 + %86 = OpCompositeInsert %v4uchar %75 %85 1 + %87 = OpCompositeInsert %v4uchar %78 %86 2 + %88 = OpCompositeInsert %v4uchar %82 %87 3 + %89 = OpBitcast %float %88 + %91 = OpAccessChain %_ptr_Workgroup_float %6 %66 + OpStore %91 %89 + %92 = OpUGreaterThanEqual %bool %69 %uint_64 + OpLoopMerge %95 %65 None + OpBranchConditional %92 %95 %65 + %95 = OpLabel + OpBranch %97 + %97 = OpLabel + OpBranch %99 + %99 = OpLabel + OpBranch %101 + %101 = OpLabel + %102 = OpPhi %uint %50 %99 %105 %101 + %104 = OpUGreaterThanEqual %bool %102 %uint_256 + %105 = OpIAdd %uint %102 %52 + OpLoopMerge %108 %101 None + OpBranchConditional %104 %108 %101 + %108 = OpLabel + %109 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %110 = OpLoad %uint %109 + %111 = OpAccessChain %_ptr_PushConstant_uint %10 %uint_0 %uint_0 + %112 = OpLoad %uint %111 + %113 = OpIAdd %uint %112 %110 + %114 = OpConvertUToF %float %113 + %115 = OpIAdd %uint %37 %uint_64 + %116 = OpAccessChain %_ptr_Workgroup_float %6 %115 + OpStore %116 %114 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %119 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %120 = OpLoad %uint %119 + %121 = OpAccessChain %_ptr_Workgroup_float %6 %120 + %122 = OpLoad %float %121 + %124 = OpFMul %float %122 %float_2 + %125 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %126 = OpLoad %uint %125 + %127 = OpAccessChain %_ptr_PushConstant_uint %10 %uint_0 %uint_0 + %128 = OpLoad %uint %127 + %129 = OpIAdd %uint %128 %126 + %130 = OpShiftLeftLogical %uint %129 %uint_2 + %131 = OpBitcast %v4uchar %124 + %132 = OpCompositeExtract %uchar %131 0 + %133 = OpCompositeExtract %uchar %131 1 + %134 = OpCompositeExtract %uchar %131 2 + %135 = OpCompositeExtract %uchar %131 3 + %136 = OpAccessChain %_ptr_StorageBuffer_uchar %25 %uint_0 %130 + OpStore %136 %132 + %137 = OpBitwiseOr %uint %130 %uint_1 + %138 = OpAccessChain %_ptr_StorageBuffer_uchar %25 %uint_0 %137 + OpStore %138 %133 + %139 = OpBitwiseOr %uint %130 %uint_2 + %140 = OpAccessChain %_ptr_StorageBuffer_uchar %25 %uint_0 %139 + OpStore %140 %134 + %141 = OpBitwiseOr %uint %130 %uint_3 + %142 = OpAccessChain %_ptr_StorageBuffer_uchar %25 %uint_0 %141 + OpStore %142 %135 + OpReturn + OpFunctionEnd + %151 = OpExtInst %void %143 PushConstantRegionOffset %uint_0 %uint_12 + %153 = OpExtInst %void %143 PushConstantRegionGroupOffset %uint_16 %uint_12 + %146 = OpExtInst %void %143 Kernel %28 %144 %uint_1 %uint_0 %145 + %148 = OpExtInst %void %143 ArgumentInfo %147 + %149 = OpExtInst %void %143 ArgumentStorageBuffer %146 %uint_0 %uint_0 %uint_0 %148 + %154 = OpExtInst %void %143 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test5.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test5.spv.dis new file mode 100644 index 0000000000..0fea6ed869 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test5.spv.dis @@ -0,0 +1,163 @@ +; @Input: %23 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 132 +; Schema: 0 + OpCapability Shader + %122 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %26 "foo" %6 %16 %gl_WorkGroupID %gl_LocalInvocationID %23 %10 + OpSource OpenCL_C 200 + %123 = OpString "foo" + %124 = OpString " kernel" + %126 = OpString "p" + OpMemberDecorate %_struct_8 0 Offset 0 + OpDecorate %_struct_8 Block + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_21 0 Offset 0 + OpDecorate %_struct_21 Block + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 0 + OpDecorate %23 Coherent + OpDecorate %11 SpecId 0 + OpDecorate %12 SpecId 1 + OpDecorate %13 SpecId 2 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_float_uint_64 = OpTypeArray %float %uint_64 +%_ptr_Workgroup__arr_float_uint_64 = OpTypePointer Workgroup %_arr_float_uint_64 + %v3uint = OpTypeVector %uint 3 + %_struct_8 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_8 = OpTypePointer PushConstant %_struct_8 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 + %13 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %11 %12 %13 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_21 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_21 = OpTypePointer StorageBuffer %_struct_21 + %void = OpTypeVoid + %25 = OpTypeFunction %void +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %bool = OpTypeBool +%_ptr_Workgroup_float = OpTypePointer Workgroup %float +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %uint_264 = OpConstant %uint 264 + %uint_328 = OpConstant %uint 328 + %uint_12 = OpConstant %uint 12 + %6 = OpVariable %_ptr_Workgroup__arr_float_uint_64 Workgroup + %10 = OpVariable %_ptr_PushConstant__struct_8 PushConstant + %16 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %23 = OpVariable %_ptr_StorageBuffer__struct_21 StorageBuffer + %26 = OpFunction %void None %25 + %27 = OpLabel + %28 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %29 = OpCompositeExtract %uint %28 0 + %32 = OpAccessChain %_ptr_PushConstant_uint %10 %uint_0 %uint_0 + %33 = OpLoad %uint %32 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %39 = OpLoad %uint %38 + %41 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %42 = OpLoad %uint %41 + %43 = OpCompositeExtract %uint %28 1 + %44 = OpCompositeExtract %uint %28 2 + %45 = OpIMul %uint %42 %43 + %46 = OpIAdd %uint %45 %39 + %47 = OpIMul %uint %46 %29 + %48 = OpIAdd %uint %47 %36 + %49 = OpIMul %uint %29 %43 + %50 = OpIMul %uint %49 %44 + %52 = OpULessThan %bool %48 %29 + OpSelectionMerge %75 None + OpBranchConditional %52 %55 %75 + %55 = OpLabel + %56 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %57 = OpLoad %uint %56 + %58 = OpIAdd %uint %33 %57 + %59 = OpIMul %uint %58 %29 + OpBranch %61 + %61 = OpLabel + %62 = OpPhi %uint %68 %61 %48 %55 + %64 = OpAccessChain %_ptr_Workgroup_float %6 %62 + %65 = OpIAdd %uint %59 %62 + %67 = OpAccessChain %_ptr_StorageBuffer_float %23 %uint_0 %65 + %68 = OpIAdd %uint %62 %50 + %69 = OpLoad %float %67 + OpStore %64 %69 + %70 = OpUGreaterThanEqual %bool %68 %29 + OpLoopMerge %73 %61 None + OpBranchConditional %70 %73 %61 + %73 = OpLabel + OpBranch %75 + %75 = OpLabel + OpBranch %77 + %77 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %80 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %81 = OpCompositeExtract %uint %80 0 + %82 = OpAccessChain %_ptr_PushConstant_uint %10 %uint_0 %uint_0 + %83 = OpLoad %uint %82 + %84 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %85 = OpLoad %uint %84 + %86 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %87 = OpLoad %uint %86 + %88 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %89 = OpLoad %uint %88 + %90 = OpCompositeExtract %uint %80 1 + %91 = OpCompositeExtract %uint %80 2 + %92 = OpIMul %uint %89 %90 + %93 = OpIAdd %uint %92 %87 + %94 = OpIMul %uint %93 %81 + %95 = OpIAdd %uint %94 %85 + %96 = OpIMul %uint %81 %90 + %97 = OpIMul %uint %96 %91 + %98 = OpULessThan %bool %95 %81 + OpSelectionMerge %119 None + OpBranchConditional %98 %101 %119 + %101 = OpLabel + %102 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %103 = OpLoad %uint %102 + %104 = OpIAdd %uint %83 %103 + %105 = OpIMul %uint %104 %81 + OpBranch %107 + %107 = OpLabel + %108 = OpPhi %uint %112 %107 %95 %101 + %109 = OpIAdd %uint %105 %108 + %110 = OpAccessChain %_ptr_StorageBuffer_float %23 %uint_0 %109 + %111 = OpAccessChain %_ptr_Workgroup_float %6 %108 + %112 = OpIAdd %uint %108 %97 + %113 = OpLoad %float %111 + OpStore %110 %113 + %114 = OpUGreaterThanEqual %bool %112 %81 + OpLoopMerge %117 %107 None + OpBranchConditional %114 %117 %107 + %117 = OpLabel + OpBranch %119 + %119 = OpLabel + OpBranch %121 + %121 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpReturn + OpFunctionEnd + %130 = OpExtInst %void %122 PushConstantRegionGroupOffset %uint_0 %uint_12 + %125 = OpExtInst %void %122 Kernel %26 %123 %uint_1 %uint_0 %124 + %127 = OpExtInst %void %122 ArgumentInfo %126 + %128 = OpExtInst %void %122 ArgumentStorageBuffer %125 %uint_0 %uint_0 %uint_0 %127 + %131 = OpExtInst %void %122 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test6.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test6.spv.dis new file mode 100644 index 0000000000..328932af95 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test6.spv.dis @@ -0,0 +1,156 @@ +; @Input: %25 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %26 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 116 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointersStorageBuffer + OpCapability VariablePointers + %101 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %29 "foo" %7 %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %21 %25 %26 %11 + OpSource OpenCL_C 200 + %102 = OpString "foo" + %103 = OpString " kernel" + %105 = OpString "p" + %108 = OpString "q" + OpMemberDecorate %_struct_9 0 Offset 0 + OpMemberDecorate %_struct_9 1 Offset 16 + OpDecorate %_struct_9 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %_struct_23 0 Offset 0 + OpDecorate %_struct_23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %25 Coherent + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 1 + OpDecorate %26 Coherent + OpDecorate %94 NoContraction + OpDecorate %_ptr_StorageBuffer_v4float ArrayStride 16 + OpDecorate %16 SpecId 0 + OpDecorate %17 SpecId 1 + OpDecorate %18 SpecId 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_v4float_uint_64 = OpTypeArray %v4float %uint_64 +%_ptr_Workgroup__arr_v4float_uint_64 = OpTypePointer Workgroup %_arr_v4float_uint_64 + %v3uint = OpTypeVector %uint 3 + %_struct_9 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_9 = OpTypePointer PushConstant %_struct_9 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %16 = OpSpecConstant %uint 1 + %17 = OpSpecConstant %uint 1 + %18 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %16 %17 %18 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %_struct_23 = OpTypeStruct %_runtimearr_v4float +%_ptr_StorageBuffer__struct_23 = OpTypePointer StorageBuffer %_struct_23 + %void = OpTypeVoid + %28 = OpTypeFunction %void +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 + %uint_6 = OpConstant %uint 6 +%_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float + %uint_264 = OpConstant %uint 264 + %uint_328 = OpConstant %uint 328 + %float_2 = OpConstant %float 2 + %93 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %7 = OpVariable %_ptr_Workgroup__arr_v4float_uint_64 Workgroup + %11 = OpVariable %_ptr_PushConstant__struct_9 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %21 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %25 = OpVariable %_ptr_StorageBuffer__struct_23 StorageBuffer + %26 = OpVariable %_ptr_StorageBuffer__struct_23 StorageBuffer + %29 = OpFunction %void None %28 + %30 = OpLabel + %33 = OpAccessChain %_ptr_StorageBuffer_v4float %25 %uint_0 %uint_0 + %34 = OpAccessChain %_ptr_StorageBuffer_v4float %26 %uint_0 %uint_0 + %36 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %37 = OpLoad %uint %36 + %40 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_1 %uint_0 + %41 = OpLoad %uint %40 + %42 = OpIAdd %uint %41 %37 + %44 = OpIEqual %bool %42 %uint_1 + %45 = OpSelect %_ptr_StorageBuffer_v4float %44 %33 %34 + %46 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %47 = OpLoad %uint %46 + %48 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %49 = OpLoad %uint %48 + %51 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %52 = OpLoad %uint %51 + %53 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %54 = OpCompositeExtract %uint %53 0 + %55 = OpCompositeExtract %uint %53 1 + %56 = OpCompositeExtract %uint %53 2 + %57 = OpIMul %uint %55 %52 + %58 = OpIAdd %uint %57 %49 + %59 = OpIMul %uint %58 %54 + %60 = OpIAdd %uint %59 %47 + %61 = OpIMul %uint %54 %55 + %62 = OpIMul %uint %61 %56 + %63 = OpULessThan %bool %60 %uint_64 + OpSelectionMerge %83 None + OpBranchConditional %63 %66 %83 + %66 = OpLabel + %68 = OpShiftLeftLogical %uint %42 %uint_6 + OpBranch %70 + %70 = OpLabel + %71 = OpPhi %uint %76 %70 %60 %66 + %73 = OpAccessChain %_ptr_Workgroup_v4float %7 %71 + %74 = OpIAdd %uint %68 %71 + %75 = OpPtrAccessChain %_ptr_StorageBuffer_v4float %45 %74 + %76 = OpIAdd %uint %71 %62 + %77 = OpLoad %v4float %75 + OpStore %73 %77 + %78 = OpUGreaterThanEqual %bool %76 %uint_64 + OpLoopMerge %81 %70 None + OpBranchConditional %78 %81 %70 + %81 = OpLabel + OpBranch %83 + %83 = OpLabel + OpBranch %85 + %85 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %88 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %89 = OpLoad %uint %88 + %90 = OpAccessChain %_ptr_Workgroup_v4float %7 %89 + %91 = OpLoad %v4float %90 + %94 = OpFMul %v4float %91 %93 + %95 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %96 = OpLoad %uint %95 + %97 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_0 %uint_0 + %98 = OpLoad %uint %97 + %99 = OpIAdd %uint %96 %98 + %100 = OpPtrAccessChain %_ptr_StorageBuffer_v4float %45 %99 + OpStore %100 %94 + OpReturn + OpFunctionEnd + %112 = OpExtInst %void %101 PushConstantRegionOffset %uint_0 %uint_12 + %114 = OpExtInst %void %101 PushConstantRegionGroupOffset %uint_16 %uint_12 + %104 = OpExtInst %void %101 Kernel %29 %102 %uint_2 %uint_0 %103 + %106 = OpExtInst %void %101 ArgumentInfo %105 + %107 = OpExtInst %void %101 ArgumentStorageBuffer %104 %uint_0 %uint_0 %uint_0 %106 + %109 = OpExtInst %void %101 ArgumentInfo %108 + %110 = OpExtInst %void %101 ArgumentStorageBuffer %104 %uint_1 %uint_0 %uint_1 %109 + %115 = OpExtInst %void %101 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test7.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test7.spv.dis new file mode 100644 index 0000000000..47f9ecf726 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test7.spv.dis @@ -0,0 +1,148 @@ +; @Input: %25 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 113 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointersStorageBuffer + %101 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %28 "foo" %7 %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %21 %25 %11 + OpSource OpenCL_C 200 + %102 = OpString "foo" + %103 = OpString " kernel" + %105 = OpString "p" + OpMemberDecorate %_struct_9 0 Offset 0 + OpMemberDecorate %_struct_9 1 Offset 16 + OpDecorate %_struct_9 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %_struct_23 0 Offset 0 + OpDecorate %_struct_23 Block + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 0 + OpDecorate %25 Coherent + OpDecorate %94 NoContraction + OpDecorate %_ptr_StorageBuffer_v4float ArrayStride 16 + OpDecorate %16 SpecId 0 + OpDecorate %17 SpecId 1 + OpDecorate %18 SpecId 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_v4float_uint_64 = OpTypeArray %v4float %uint_64 +%_ptr_Workgroup__arr_v4float_uint_64 = OpTypePointer Workgroup %_arr_v4float_uint_64 + %v3uint = OpTypeVector %uint 3 + %_struct_9 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_9 = OpTypePointer PushConstant %_struct_9 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %16 = OpSpecConstant %uint 1 + %17 = OpSpecConstant %uint 1 + %18 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %16 %17 %18 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %_struct_23 = OpTypeStruct %_runtimearr_v4float +%_ptr_StorageBuffer__struct_23 = OpTypePointer StorageBuffer %_struct_23 + %void = OpTypeVoid + %27 = OpTypeFunction %void +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_128 = OpConstant %uint 128 + %44 = OpConstantNull %_ptr_StorageBuffer_v4float + %uint_2 = OpConstant %uint 2 + %uint_6 = OpConstant %uint 6 +%_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float + %uint_264 = OpConstant %uint 264 + %uint_328 = OpConstant %uint 328 + %float_2 = OpConstant %float 2 + %93 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %7 = OpVariable %_ptr_Workgroup__arr_v4float_uint_64 Workgroup + %11 = OpVariable %_ptr_PushConstant__struct_9 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %21 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %25 = OpVariable %_ptr_StorageBuffer__struct_23 StorageBuffer + %28 = OpFunction %void None %27 + %29 = OpLabel + %32 = OpAccessChain %_ptr_StorageBuffer_v4float %25 %uint_0 %uint_0 + %34 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %35 = OpLoad %uint %34 + %38 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_1 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpIAdd %uint %39 %35 + %43 = OpULessThan %bool %40 %uint_128 + %45 = OpSelect %_ptr_StorageBuffer_v4float %43 %32 %44 + %46 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %47 = OpLoad %uint %46 + %48 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %49 = OpLoad %uint %48 + %51 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %52 = OpLoad %uint %51 + %53 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %54 = OpCompositeExtract %uint %53 0 + %55 = OpCompositeExtract %uint %53 1 + %56 = OpCompositeExtract %uint %53 2 + %57 = OpIMul %uint %55 %52 + %58 = OpIAdd %uint %57 %49 + %59 = OpIMul %uint %58 %54 + %60 = OpIAdd %uint %59 %47 + %61 = OpIMul %uint %54 %55 + %62 = OpIMul %uint %61 %56 + %63 = OpULessThan %bool %60 %uint_64 + OpSelectionMerge %83 None + OpBranchConditional %63 %66 %83 + %66 = OpLabel + %68 = OpShiftLeftLogical %uint %40 %uint_6 + OpBranch %70 + %70 = OpLabel + %71 = OpPhi %uint %76 %70 %60 %66 + %73 = OpAccessChain %_ptr_Workgroup_v4float %7 %71 + %74 = OpIAdd %uint %68 %71 + %75 = OpPtrAccessChain %_ptr_StorageBuffer_v4float %45 %74 + %76 = OpIAdd %uint %71 %62 + %77 = OpLoad %v4float %75 + OpStore %73 %77 + %78 = OpUGreaterThanEqual %bool %76 %uint_64 + OpLoopMerge %81 %70 None + OpBranchConditional %78 %81 %70 + %81 = OpLabel + OpBranch %83 + %83 = OpLabel + OpBranch %85 + %85 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %88 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %89 = OpLoad %uint %88 + %90 = OpAccessChain %_ptr_Workgroup_v4float %7 %89 + %91 = OpLoad %v4float %90 + %94 = OpFMul %v4float %91 %93 + %95 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %96 = OpLoad %uint %95 + %97 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_0 %uint_0 + %98 = OpLoad %uint %97 + %99 = OpIAdd %uint %96 %98 + %100 = OpPtrAccessChain %_ptr_StorageBuffer_v4float %45 %99 + OpStore %100 %94 + OpReturn + OpFunctionEnd + %109 = OpExtInst %void %101 PushConstantRegionOffset %uint_0 %uint_12 + %111 = OpExtInst %void %101 PushConstantRegionGroupOffset %uint_16 %uint_12 + %104 = OpExtInst %void %101 Kernel %28 %102 %uint_1 %uint_0 %103 + %106 = OpExtInst %void %101 ArgumentInfo %105 + %107 = OpExtInst %void %101 ArgumentStorageBuffer %104 %uint_0 %uint_0 %uint_0 %106 + %112 = OpExtInst %void %101 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test8.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test8.spv.dis new file mode 100644 index 0000000000..810435d8d1 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test8.spv.dis @@ -0,0 +1,161 @@ +; @Input: %26 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %27 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 121 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointersStorageBuffer + OpCapability VariablePointers + %106 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %30 "foo" %7 %8 %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %22 %26 %27 %12 + OpSource OpenCL_C 200 + %107 = OpString "foo" + %108 = OpString " kernel" + %110 = OpString "p" + %113 = OpString "q" + OpMemberDecorate %_struct_10 0 Offset 0 + OpMemberDecorate %_struct_10 1 Offset 16 + OpDecorate %_struct_10 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %_struct_24 0 Offset 0 + OpDecorate %_struct_24 Block + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 0 + OpDecorate %26 Coherent + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 1 + OpDecorate %27 Coherent + OpDecorate %99 NoContraction + OpDecorate %_ptr_StorageBuffer_v4float ArrayStride 16 + OpDecorate %17 SpecId 0 + OpDecorate %18 SpecId 1 + OpDecorate %19 SpecId 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_v4float_uint_64 = OpTypeArray %v4float %uint_64 +%_ptr_Workgroup__arr_v4float_uint_64 = OpTypePointer Workgroup %_arr_v4float_uint_64 + %v3uint = OpTypeVector %uint 3 + %_struct_10 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_10 = OpTypePointer PushConstant %_struct_10 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %17 = OpSpecConstant %uint 1 + %18 = OpSpecConstant %uint 1 + %19 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %17 %18 %19 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %_struct_24 = OpTypeStruct %_runtimearr_v4float +%_ptr_StorageBuffer__struct_24 = OpTypePointer StorageBuffer %_struct_24 + %void = OpTypeVoid + %29 = OpTypeFunction %void +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 + %uint_6 = OpConstant %uint 6 +%_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float + %uint_264 = OpConstant %uint 264 + %uint_328 = OpConstant %uint 328 + %uint_63 = OpConstant %uint 63 + %float_2 = OpConstant %float 2 + %98 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %7 = OpVariable %_ptr_Workgroup__arr_v4float_uint_64 Workgroup + %8 = OpVariable %_ptr_Workgroup__arr_v4float_uint_64 Workgroup + %12 = OpVariable %_ptr_PushConstant__struct_10 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %22 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %26 = OpVariable %_ptr_StorageBuffer__struct_24 StorageBuffer + %27 = OpVariable %_ptr_StorageBuffer__struct_24 StorageBuffer + %30 = OpFunction %void None %29 + %31 = OpLabel + %34 = OpAccessChain %_ptr_StorageBuffer_v4float %26 %uint_0 %uint_0 + %35 = OpAccessChain %_ptr_StorageBuffer_v4float %27 %uint_0 %uint_0 + %37 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %38 = OpLoad %uint %37 + %41 = OpAccessChain %_ptr_PushConstant_uint %12 %uint_1 %uint_0 + %42 = OpLoad %uint %41 + %43 = OpIAdd %uint %42 %38 + %45 = OpIEqual %bool %43 %uint_1 + %46 = OpSelect %_ptr_Workgroup__arr_v4float_uint_64 %45 %7 %8 + %47 = OpSelect %_ptr_StorageBuffer_v4float %45 %34 %35 + %48 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %49 = OpLoad %uint %48 + %50 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %51 = OpLoad %uint %50 + %53 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %54 = OpLoad %uint %53 + %55 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %56 = OpCompositeExtract %uint %55 0 + %57 = OpCompositeExtract %uint %55 1 + %58 = OpCompositeExtract %uint %55 2 + %59 = OpIMul %uint %57 %54 + %60 = OpIAdd %uint %59 %51 + %61 = OpIMul %uint %60 %56 + %62 = OpIAdd %uint %61 %49 + %63 = OpIMul %uint %56 %57 + %64 = OpIMul %uint %63 %58 + %65 = OpULessThan %bool %62 %uint_64 + OpSelectionMerge %85 None + OpBranchConditional %65 %68 %85 + %68 = OpLabel + %70 = OpShiftLeftLogical %uint %43 %uint_6 + OpBranch %72 + %72 = OpLabel + %73 = OpPhi %uint %78 %72 %62 %68 + %75 = OpAccessChain %_ptr_Workgroup_v4float %46 %73 + %76 = OpIAdd %uint %70 %73 + %77 = OpPtrAccessChain %_ptr_StorageBuffer_v4float %47 %76 + %78 = OpIAdd %uint %73 %64 + %79 = OpLoad %v4float %77 + OpStore %75 %79 + %80 = OpUGreaterThanEqual %bool %78 %uint_64 + OpLoopMerge %83 %72 None + OpBranchConditional %80 %83 %72 + %83 = OpLabel + OpBranch %85 + %85 = OpLabel + OpBranch %87 + %87 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %90 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %91 = OpLoad %uint %90 + %92 = OpShiftRightLogical %uint %91 %uint_6 + %94 = OpBitwiseAnd %uint %91 %uint_63 + %95 = OpPtrAccessChain %_ptr_Workgroup_v4float %46 %92 %94 + %96 = OpLoad %v4float %95 + %99 = OpFMul %v4float %96 %98 + %100 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %101 = OpLoad %uint %100 + %102 = OpAccessChain %_ptr_PushConstant_uint %12 %uint_0 %uint_0 + %103 = OpLoad %uint %102 + %104 = OpIAdd %uint %101 %103 + %105 = OpPtrAccessChain %_ptr_StorageBuffer_v4float %47 %104 + OpStore %105 %99 + OpReturn + OpFunctionEnd + %117 = OpExtInst %void %106 PushConstantRegionOffset %uint_0 %uint_12 + %119 = OpExtInst %void %106 PushConstantRegionGroupOffset %uint_16 %uint_12 + %109 = OpExtInst %void %106 Kernel %30 %107 %uint_2 %uint_0 %108 + %111 = OpExtInst %void %106 ArgumentInfo %110 + %112 = OpExtInst %void %106 ArgumentStorageBuffer %109 %uint_0 %uint_0 %uint_0 %111 + %114 = OpExtInst %void %106 ArgumentInfo %113 + %115 = OpExtInst %void %106 ArgumentStorageBuffer %109 %uint_1 %uint_0 %uint_1 %114 + %120 = OpExtInst %void %106 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test9.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test9.spv.dis new file mode 100644 index 0000000000..1d92750efd --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/async_work_group_copy/pass/test9.spv.dis @@ -0,0 +1,148 @@ +; @Input: %26 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 114 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointers + %102 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %29 "foo" %7 %8 %gl_GlobalInvocationID %gl_LocalInvocationID %gl_WorkGroupID %22 %26 %12 + OpSource OpenCL_C 200 + %103 = OpString "foo" + %104 = OpString " kernel" + %106 = OpString "p" + OpMemberDecorate %_struct_10 0 Offset 0 + OpMemberDecorate %_struct_10 1 Offset 16 + OpDecorate %_struct_10 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %_struct_24 0 Offset 0 + OpDecorate %_struct_24 Block + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 0 + OpDecorate %26 Coherent + OpDecorate %95 NoContraction + OpDecorate %17 SpecId 0 + OpDecorate %18 SpecId 1 + OpDecorate %19 SpecId 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_v4float_uint_64 = OpTypeArray %v4float %uint_64 +%_ptr_Workgroup__arr_v4float_uint_64 = OpTypePointer Workgroup %_arr_v4float_uint_64 + %v3uint = OpTypeVector %uint 3 + %_struct_10 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_10 = OpTypePointer PushConstant %_struct_10 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %17 = OpSpecConstant %uint 1 + %18 = OpSpecConstant %uint 1 + %19 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %17 %18 %19 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %_struct_24 = OpTypeStruct %_runtimearr_v4float +%_ptr_StorageBuffer__struct_24 = OpTypePointer StorageBuffer %_struct_24 + %void = OpTypeVoid + %28 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 + %uint_6 = OpConstant %uint 6 +%_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float + %uint_264 = OpConstant %uint 264 + %uint_328 = OpConstant %uint 328 + %uint_63 = OpConstant %uint 63 + %float_2 = OpConstant %float 2 + %94 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %7 = OpVariable %_ptr_Workgroup__arr_v4float_uint_64 Workgroup + %8 = OpVariable %_ptr_Workgroup__arr_v4float_uint_64 Workgroup + %12 = OpVariable %_ptr_PushConstant__struct_10 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %22 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %26 = OpVariable %_ptr_StorageBuffer__struct_24 StorageBuffer + %29 = OpFunction %void None %28 + %30 = OpLabel + %33 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %34 = OpLoad %uint %33 + %37 = OpAccessChain %_ptr_PushConstant_uint %12 %uint_1 %uint_0 + %38 = OpLoad %uint %37 + %39 = OpIAdd %uint %38 %34 + %41 = OpIEqual %bool %39 %uint_1 + %42 = OpSelect %_ptr_Workgroup__arr_v4float_uint_64 %41 %7 %8 + %43 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %44 = OpLoad %uint %43 + %45 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %46 = OpLoad %uint %45 + %48 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_2 + %49 = OpLoad %uint %48 + %50 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %51 = OpCompositeExtract %uint %50 0 + %52 = OpCompositeExtract %uint %50 1 + %53 = OpCompositeExtract %uint %50 2 + %54 = OpIMul %uint %52 %49 + %55 = OpIAdd %uint %54 %46 + %56 = OpIMul %uint %55 %51 + %57 = OpIAdd %uint %56 %44 + %58 = OpIMul %uint %51 %52 + %59 = OpIMul %uint %58 %53 + %60 = OpULessThan %bool %57 %uint_64 + OpSelectionMerge %81 None + OpBranchConditional %60 %63 %81 + %63 = OpLabel + %65 = OpShiftLeftLogical %uint %39 %uint_6 + OpBranch %67 + %67 = OpLabel + %68 = OpPhi %uint %74 %67 %57 %63 + %70 = OpAccessChain %_ptr_Workgroup_v4float %42 %68 + %71 = OpIAdd %uint %65 %68 + %73 = OpAccessChain %_ptr_StorageBuffer_v4float %26 %uint_0 %71 + %74 = OpIAdd %uint %68 %59 + %75 = OpLoad %v4float %73 + OpStore %70 %75 + %76 = OpUGreaterThanEqual %bool %74 %uint_64 + OpLoopMerge %79 %67 None + OpBranchConditional %76 %79 %67 + %79 = OpLabel + OpBranch %81 + %81 = OpLabel + OpBranch %83 + %83 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %86 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %87 = OpLoad %uint %86 + %88 = OpShiftRightLogical %uint %87 %uint_6 + %90 = OpBitwiseAnd %uint %87 %uint_63 + %91 = OpPtrAccessChain %_ptr_Workgroup_v4float %42 %88 %90 + %92 = OpLoad %v4float %91 + %95 = OpFMul %v4float %92 %94 + %96 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %97 = OpLoad %uint %96 + %98 = OpAccessChain %_ptr_PushConstant_uint %12 %uint_0 %uint_0 + %99 = OpLoad %uint %98 + %100 = OpIAdd %uint %97 %99 + %101 = OpAccessChain %_ptr_StorageBuffer_v4float %26 %uint_0 %100 + OpStore %101 %95 + OpReturn + OpFunctionEnd + %110 = OpExtInst %void %102 PushConstantRegionOffset %uint_0 %uint_12 + %112 = OpExtInst %void %102 PushConstantRegionGroupOffset %uint_16 %uint_12 + %105 = OpExtInst %void %102 Kernel %29 %103 %uint_1 %uint_0 %104 + %107 = OpExtInst %void %102 ArgumentInfo %106 + %108 = OpExtInst %void %102 ArgumentStorageBuffer %105 %uint_0 %uint_0 %uint_0 %107 + %113 = OpExtInst %void %102 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/atomics/atomic_read_race.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/atomics/atomic_read_race.spv.dis new file mode 100644 index 0000000000..0d0c8ff496 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/atomics/atomic_read_race.spv.dis @@ -0,0 +1,61 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %32 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "atomic" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %33 = OpString "atomic" + %34 = OpString " __kernel" + %36 = OpString "A" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_1 = OpConstant %uint 1 + %uint_80 = OpConstant %uint 80 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %20 = OpVariable %_ptr_Function_uint Function + %23 = OpAccessChain %_ptr_Workgroup_uint %14 %uint_0 + %25 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %27 = OpAccessChain %_ptr_Workgroup_uint %14 %26 + %28 = OpLoad %uint %27 + OpStore %20 %28 + %31 = OpAtomicIIncrement %uint %23 %uint_1 %uint_80 + OpReturn + OpFunctionEnd + %35 = OpExtInst %void %32 Kernel %17 %33 %uint_1 %uint_0 %34 + %37 = OpExtInst %void %32 ArgumentInfo %36 + %40 = OpExtInst %void %32 ArgumentWorkgroup %35 %uint_0 %uint_3 %uint_4 %37 + %42 = OpExtInst %void %32 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/atomics/counter.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/atomics/counter.spv.dis new file mode 100644 index 0000000000..c25d4c4df9 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/atomics/counter.spv.dis @@ -0,0 +1,70 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %40 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %19 "counter" %3 %gl_LocalInvocationID %12 %16 + OpSource OpenCL_C 200 + %41 = OpString "counter" + %42 = OpString " kernel" + %44 = OpString "A" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %13 SpecId 3 + OpDecorate %7 SpecId 0 + OpDecorate %8 SpecId 1 + OpDecorate %9 SpecId 2 + %uint = OpTypeInt 32 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %7 = OpSpecConstant %uint 1 + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %7 %8 %9 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %13 = OpSpecConstant %uint 1 +%_arr_uint_13 = OpTypeArray %uint %13 +%_ptr_Workgroup__arr_uint_13 = OpTypePointer Workgroup %_arr_uint_13 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %uint_1 = OpConstant %uint 1 + %uint_80 = OpConstant %uint 80 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %3 = OpVariable %_ptr_Workgroup_uint Workgroup +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %12 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %16 = OpVariable %_ptr_Workgroup__arr_uint_13 Workgroup + %19 = OpFunction %void None %18 + %20 = OpLabel + %23 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %24 = OpLoad %uint %23 + %26 = OpIEqual %bool %24 %uint_0 + OpSelectionMerge %31 None + OpBranchConditional %26 %29 %31 + %29 = OpLabel + OpStore %3 %uint_0 + OpBranch %31 + %31 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %34 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %35 = OpLoad %uint %34 + %38 = OpAtomicIIncrement %uint %3 %uint_1 %uint_80 + %39 = OpAccessChain %_ptr_Workgroup_uint %16 %38 + OpStore %39 %35 + OpReturn + OpFunctionEnd + %43 = OpExtInst %void %40 Kernel %19 %41 %uint_1 %uint_0 %42 + %45 = OpExtInst %void %40 ArgumentInfo %44 + %48 = OpExtInst %void %40 ArgumentWorkgroup %43 %uint_0 %uint_3 %uint_4 %45 + %49 = OpExtInst %void %40 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/atomics/definitions_atom_int.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/atomics/definitions_atom_int.spv.dis new file mode 100644 index 0000000000..245900a659 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/atomics/definitions_atom_int.spv.dis @@ -0,0 +1,126 @@ +; @Input: %12 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %13 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 100 +; Schema: 0 + OpCapability Shader + %80 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "definitions" %8 %12 %13 %17 %21 + OpSource OpenCL_C 200 + %81 = OpString "definitions" + %82 = OpString " kernel" + %85 = OpString "C" + %89 = OpString "D" + %93 = OpString "A" + %96 = OpString "B" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_10 0 Offset 0 + OpDecorate %_struct_10 Block + OpDecorate %12 DescriptorSet 0 + OpDecorate %12 Binding 0 + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 1 + OpDecorate %14 SpecId 3 + OpDecorate %18 SpecId 4 + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_10 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_10 = OpTypePointer StorageBuffer %_struct_10 + %14 = OpSpecConstant %uint 1 +%_arr_uint_14 = OpTypeArray %uint %14 +%_ptr_Workgroup__arr_uint_14 = OpTypePointer Workgroup %_arr_uint_14 + %18 = OpSpecConstant %uint 1 +%_arr_uint_18 = OpTypeArray %uint %18 +%_ptr_Workgroup__arr_uint_18 = OpTypePointer Workgroup %_arr_uint_18 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_1 = OpConstant %uint 1 + %uint_80 = OpConstant %uint 80 + %uint_10 = OpConstant %uint 10 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %12 = OpVariable %_ptr_StorageBuffer__struct_10 StorageBuffer + %13 = OpVariable %_ptr_StorageBuffer__struct_10 StorageBuffer + %17 = OpVariable %_ptr_Workgroup__arr_uint_14 Workgroup + %21 = OpVariable %_ptr_Workgroup__arr_uint_18 Workgroup + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Workgroup_uint %17 %uint_0 + %29 = OpAccessChain %_ptr_Workgroup_uint %21 %uint_0 + %31 = OpAccessChain %_ptr_StorageBuffer_uint %12 %uint_0 %uint_0 + %32 = OpAccessChain %_ptr_StorageBuffer_uint %13 %uint_0 %uint_0 + %36 = OpAtomicIAdd %uint %28 %uint_1 %uint_80 %uint_10 + %37 = OpAtomicISub %uint %28 %uint_1 %uint_80 %uint_10 + %38 = OpAtomicExchange %uint %28 %uint_1 %uint_80 %uint_10 + %39 = OpAtomicSMin %uint %28 %uint_1 %uint_80 %uint_10 + %40 = OpAtomicSMax %uint %28 %uint_1 %uint_80 %uint_10 + %41 = OpAtomicAnd %uint %28 %uint_1 %uint_80 %uint_10 + %42 = OpAtomicOr %uint %28 %uint_1 %uint_80 %uint_10 + %43 = OpAtomicXor %uint %28 %uint_1 %uint_80 %uint_10 + %44 = OpAtomicIIncrement %uint %28 %uint_1 %uint_80 + %45 = OpAtomicIDecrement %uint %28 %uint_1 %uint_80 + %46 = OpAtomicCompareExchange %uint %28 %uint_1 %uint_80 %uint_80 %uint_10 %uint_10 + %47 = OpAtomicIAdd %uint %29 %uint_1 %uint_80 %uint_10 + %48 = OpAtomicISub %uint %29 %uint_1 %uint_80 %uint_10 + %49 = OpAtomicExchange %uint %29 %uint_1 %uint_80 %uint_10 + %50 = OpAtomicUMin %uint %29 %uint_1 %uint_80 %uint_10 + %51 = OpAtomicUMax %uint %29 %uint_1 %uint_80 %uint_10 + %52 = OpAtomicAnd %uint %29 %uint_1 %uint_80 %uint_10 + %53 = OpAtomicOr %uint %29 %uint_1 %uint_80 %uint_10 + %54 = OpAtomicXor %uint %29 %uint_1 %uint_80 %uint_10 + %55 = OpAtomicIIncrement %uint %29 %uint_1 %uint_80 + %56 = OpAtomicIDecrement %uint %29 %uint_1 %uint_80 + %57 = OpAtomicCompareExchange %uint %29 %uint_1 %uint_80 %uint_80 %uint_10 %uint_10 + %58 = OpAtomicIAdd %uint %31 %uint_1 %uint_80 %uint_10 + %59 = OpAtomicISub %uint %31 %uint_1 %uint_80 %uint_10 + %60 = OpAtomicExchange %uint %31 %uint_1 %uint_80 %uint_10 + %61 = OpAtomicSMin %uint %31 %uint_1 %uint_80 %uint_10 + %62 = OpAtomicSMax %uint %31 %uint_1 %uint_80 %uint_10 + %63 = OpAtomicAnd %uint %31 %uint_1 %uint_80 %uint_10 + %64 = OpAtomicOr %uint %31 %uint_1 %uint_80 %uint_10 + %65 = OpAtomicXor %uint %31 %uint_1 %uint_80 %uint_10 + %66 = OpAtomicIIncrement %uint %31 %uint_1 %uint_80 + %67 = OpAtomicIDecrement %uint %31 %uint_1 %uint_80 + %68 = OpAtomicCompareExchange %uint %31 %uint_1 %uint_80 %uint_80 %uint_10 %uint_10 + %69 = OpAtomicIAdd %uint %32 %uint_1 %uint_80 %uint_10 + %70 = OpAtomicISub %uint %32 %uint_1 %uint_80 %uint_10 + %71 = OpAtomicExchange %uint %32 %uint_1 %uint_80 %uint_10 + %72 = OpAtomicUMin %uint %32 %uint_1 %uint_80 %uint_10 + %73 = OpAtomicUMax %uint %32 %uint_1 %uint_80 %uint_10 + %74 = OpAtomicAnd %uint %32 %uint_1 %uint_80 %uint_10 + %75 = OpAtomicOr %uint %32 %uint_1 %uint_80 %uint_10 + %76 = OpAtomicXor %uint %32 %uint_1 %uint_80 %uint_10 + %77 = OpAtomicIIncrement %uint %32 %uint_1 %uint_80 + %78 = OpAtomicIDecrement %uint %32 %uint_1 %uint_80 + %79 = OpAtomicCompareExchange %uint %32 %uint_1 %uint_80 %uint_80 %uint_10 %uint_10 + OpReturn + OpFunctionEnd + %84 = OpExtInst %void %80 Kernel %24 %81 %uint_4 %uint_0 %82 + %86 = OpExtInst %void %80 ArgumentInfo %85 + %88 = OpExtInst %void %80 ArgumentStorageBuffer %84 %uint_2 %uint_0 %uint_0 %86 + %90 = OpExtInst %void %80 ArgumentInfo %89 + %92 = OpExtInst %void %80 ArgumentStorageBuffer %84 %uint_3 %uint_0 %uint_1 %90 + %94 = OpExtInst %void %80 ArgumentInfo %93 + %95 = OpExtInst %void %80 ArgumentWorkgroup %84 %uint_0 %uint_3 %uint_4 %94 + %97 = OpExtInst %void %80 ArgumentInfo %96 + %98 = OpExtInst %void %80 ArgumentWorkgroup %84 %uint_1 %uint_4 %uint_4 %97 + %99 = OpExtInst %void %80 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/atomics/definitions_float.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/atomics/definitions_float.spv.dis new file mode 100644 index 0000000000..f6cde7ea9a --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/atomics/definitions_float.spv.dis @@ -0,0 +1,68 @@ +; @Input: %13 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + %32 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %20 "definitions" %8 %13 %17 + OpSource OpenCL_C 200 + %33 = OpString "definitions" + %34 = OpString " kernel" + %37 = OpString "F" + %40 = OpString "E" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_11 0 Offset 0 + OpDecorate %_struct_11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 0 + OpDecorate %14 SpecId 3 + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_11 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_11 = OpTypePointer StorageBuffer %_struct_11 + %14 = OpSpecConstant %uint 1 +%_arr_float_14 = OpTypeArray %float %14 +%_ptr_Workgroup__arr_float_14 = OpTypePointer Workgroup %_arr_float_14 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Workgroup_float = OpTypePointer Workgroup %float + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %uint_1 = OpConstant %uint 1 + %uint_80 = OpConstant %uint 80 + %float_10 = OpConstant %float 10 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %13 = OpVariable %_ptr_StorageBuffer__struct_11 StorageBuffer + %17 = OpVariable %_ptr_Workgroup__arr_float_14 Workgroup + %20 = OpFunction %void None %19 + %21 = OpLabel + %24 = OpAccessChain %_ptr_Workgroup_float %17 %uint_0 + %26 = OpAccessChain %_ptr_StorageBuffer_float %13 %uint_0 %uint_0 + %30 = OpAtomicExchange %float %24 %uint_1 %uint_80 %float_10 + %31 = OpAtomicExchange %float %26 %uint_1 %uint_80 %float_10 + OpReturn + OpFunctionEnd + %36 = OpExtInst %void %32 Kernel %20 %33 %uint_2 %uint_0 %34 + %38 = OpExtInst %void %32 ArgumentInfo %37 + %39 = OpExtInst %void %32 ArgumentStorageBuffer %36 %uint_1 %uint_0 %uint_0 %38 + %41 = OpExtInst %void %32 ArgumentInfo %40 + %44 = OpExtInst %void %32 ArgumentWorkgroup %36 %uint_0 %uint_3 %uint_4 %41 + %45 = OpExtInst %void %32 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/atomics/definitions_int.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/atomics/definitions_int.spv.dis new file mode 100644 index 0000000000..245900a659 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/atomics/definitions_int.spv.dis @@ -0,0 +1,126 @@ +; @Input: %12 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %13 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 100 +; Schema: 0 + OpCapability Shader + %80 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "definitions" %8 %12 %13 %17 %21 + OpSource OpenCL_C 200 + %81 = OpString "definitions" + %82 = OpString " kernel" + %85 = OpString "C" + %89 = OpString "D" + %93 = OpString "A" + %96 = OpString "B" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_10 0 Offset 0 + OpDecorate %_struct_10 Block + OpDecorate %12 DescriptorSet 0 + OpDecorate %12 Binding 0 + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 1 + OpDecorate %14 SpecId 3 + OpDecorate %18 SpecId 4 + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_10 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_10 = OpTypePointer StorageBuffer %_struct_10 + %14 = OpSpecConstant %uint 1 +%_arr_uint_14 = OpTypeArray %uint %14 +%_ptr_Workgroup__arr_uint_14 = OpTypePointer Workgroup %_arr_uint_14 + %18 = OpSpecConstant %uint 1 +%_arr_uint_18 = OpTypeArray %uint %18 +%_ptr_Workgroup__arr_uint_18 = OpTypePointer Workgroup %_arr_uint_18 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_1 = OpConstant %uint 1 + %uint_80 = OpConstant %uint 80 + %uint_10 = OpConstant %uint 10 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %12 = OpVariable %_ptr_StorageBuffer__struct_10 StorageBuffer + %13 = OpVariable %_ptr_StorageBuffer__struct_10 StorageBuffer + %17 = OpVariable %_ptr_Workgroup__arr_uint_14 Workgroup + %21 = OpVariable %_ptr_Workgroup__arr_uint_18 Workgroup + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Workgroup_uint %17 %uint_0 + %29 = OpAccessChain %_ptr_Workgroup_uint %21 %uint_0 + %31 = OpAccessChain %_ptr_StorageBuffer_uint %12 %uint_0 %uint_0 + %32 = OpAccessChain %_ptr_StorageBuffer_uint %13 %uint_0 %uint_0 + %36 = OpAtomicIAdd %uint %28 %uint_1 %uint_80 %uint_10 + %37 = OpAtomicISub %uint %28 %uint_1 %uint_80 %uint_10 + %38 = OpAtomicExchange %uint %28 %uint_1 %uint_80 %uint_10 + %39 = OpAtomicSMin %uint %28 %uint_1 %uint_80 %uint_10 + %40 = OpAtomicSMax %uint %28 %uint_1 %uint_80 %uint_10 + %41 = OpAtomicAnd %uint %28 %uint_1 %uint_80 %uint_10 + %42 = OpAtomicOr %uint %28 %uint_1 %uint_80 %uint_10 + %43 = OpAtomicXor %uint %28 %uint_1 %uint_80 %uint_10 + %44 = OpAtomicIIncrement %uint %28 %uint_1 %uint_80 + %45 = OpAtomicIDecrement %uint %28 %uint_1 %uint_80 + %46 = OpAtomicCompareExchange %uint %28 %uint_1 %uint_80 %uint_80 %uint_10 %uint_10 + %47 = OpAtomicIAdd %uint %29 %uint_1 %uint_80 %uint_10 + %48 = OpAtomicISub %uint %29 %uint_1 %uint_80 %uint_10 + %49 = OpAtomicExchange %uint %29 %uint_1 %uint_80 %uint_10 + %50 = OpAtomicUMin %uint %29 %uint_1 %uint_80 %uint_10 + %51 = OpAtomicUMax %uint %29 %uint_1 %uint_80 %uint_10 + %52 = OpAtomicAnd %uint %29 %uint_1 %uint_80 %uint_10 + %53 = OpAtomicOr %uint %29 %uint_1 %uint_80 %uint_10 + %54 = OpAtomicXor %uint %29 %uint_1 %uint_80 %uint_10 + %55 = OpAtomicIIncrement %uint %29 %uint_1 %uint_80 + %56 = OpAtomicIDecrement %uint %29 %uint_1 %uint_80 + %57 = OpAtomicCompareExchange %uint %29 %uint_1 %uint_80 %uint_80 %uint_10 %uint_10 + %58 = OpAtomicIAdd %uint %31 %uint_1 %uint_80 %uint_10 + %59 = OpAtomicISub %uint %31 %uint_1 %uint_80 %uint_10 + %60 = OpAtomicExchange %uint %31 %uint_1 %uint_80 %uint_10 + %61 = OpAtomicSMin %uint %31 %uint_1 %uint_80 %uint_10 + %62 = OpAtomicSMax %uint %31 %uint_1 %uint_80 %uint_10 + %63 = OpAtomicAnd %uint %31 %uint_1 %uint_80 %uint_10 + %64 = OpAtomicOr %uint %31 %uint_1 %uint_80 %uint_10 + %65 = OpAtomicXor %uint %31 %uint_1 %uint_80 %uint_10 + %66 = OpAtomicIIncrement %uint %31 %uint_1 %uint_80 + %67 = OpAtomicIDecrement %uint %31 %uint_1 %uint_80 + %68 = OpAtomicCompareExchange %uint %31 %uint_1 %uint_80 %uint_80 %uint_10 %uint_10 + %69 = OpAtomicIAdd %uint %32 %uint_1 %uint_80 %uint_10 + %70 = OpAtomicISub %uint %32 %uint_1 %uint_80 %uint_10 + %71 = OpAtomicExchange %uint %32 %uint_1 %uint_80 %uint_10 + %72 = OpAtomicUMin %uint %32 %uint_1 %uint_80 %uint_10 + %73 = OpAtomicUMax %uint %32 %uint_1 %uint_80 %uint_10 + %74 = OpAtomicAnd %uint %32 %uint_1 %uint_80 %uint_10 + %75 = OpAtomicOr %uint %32 %uint_1 %uint_80 %uint_10 + %76 = OpAtomicXor %uint %32 %uint_1 %uint_80 %uint_10 + %77 = OpAtomicIIncrement %uint %32 %uint_1 %uint_80 + %78 = OpAtomicIDecrement %uint %32 %uint_1 %uint_80 + %79 = OpAtomicCompareExchange %uint %32 %uint_1 %uint_80 %uint_80 %uint_10 %uint_10 + OpReturn + OpFunctionEnd + %84 = OpExtInst %void %80 Kernel %24 %81 %uint_4 %uint_0 %82 + %86 = OpExtInst %void %80 ArgumentInfo %85 + %88 = OpExtInst %void %80 ArgumentStorageBuffer %84 %uint_2 %uint_0 %uint_0 %86 + %90 = OpExtInst %void %80 ArgumentInfo %89 + %92 = OpExtInst %void %80 ArgumentStorageBuffer %84 %uint_3 %uint_0 %uint_1 %90 + %94 = OpExtInst %void %80 ArgumentInfo %93 + %95 = OpExtInst %void %80 ArgumentWorkgroup %84 %uint_0 %uint_3 %uint_4 %94 + %97 = OpExtInst %void %80 ArgumentInfo %96 + %98 = OpExtInst %void %80 ArgumentWorkgroup %84 %uint_1 %uint_4 %uint_4 %97 + %99 = OpExtInst %void %80 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/atomics/definitions_long.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/atomics/definitions_long.spv.dis new file mode 100644 index 0000000000..76672efd1e --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/atomics/definitions_long.spv.dis @@ -0,0 +1,129 @@ +; @Input: %13 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %14 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 102 +; Schema: 0 + OpCapability Shader + OpCapability Int64 + %81 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %25 "definitions" %8 %13 %14 %18 %22 + OpSource OpenCL_C 200 + %82 = OpString "definitions" + %83 = OpString " kernel" + %86 = OpString "I" + %90 = OpString "J" + %94 = OpString "G" + %98 = OpString "H" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_ulong ArrayStride 8 + OpMemberDecorate %_struct_11 0 Offset 0 + OpDecorate %_struct_11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 0 + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 1 + OpDecorate %15 SpecId 3 + OpDecorate %19 SpecId 4 + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %ulong = OpTypeInt 64 0 +%_runtimearr_ulong = OpTypeRuntimeArray %ulong + %_struct_11 = OpTypeStruct %_runtimearr_ulong +%_ptr_StorageBuffer__struct_11 = OpTypePointer StorageBuffer %_struct_11 + %15 = OpSpecConstant %uint 1 +%_arr_ulong_15 = OpTypeArray %ulong %15 +%_ptr_Workgroup__arr_ulong_15 = OpTypePointer Workgroup %_arr_ulong_15 + %19 = OpSpecConstant %uint 1 +%_arr_ulong_19 = OpTypeArray %ulong %19 +%_ptr_Workgroup__arr_ulong_19 = OpTypePointer Workgroup %_arr_ulong_19 + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Workgroup_ulong = OpTypePointer Workgroup %ulong + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_ulong = OpTypePointer StorageBuffer %ulong + %uint_1 = OpConstant %uint 1 + %uint_80 = OpConstant %uint 80 + %ulong_10 = OpConstant %ulong 10 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_8 = OpConstant %uint 8 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %13 = OpVariable %_ptr_StorageBuffer__struct_11 StorageBuffer + %14 = OpVariable %_ptr_StorageBuffer__struct_11 StorageBuffer + %18 = OpVariable %_ptr_Workgroup__arr_ulong_15 Workgroup + %22 = OpVariable %_ptr_Workgroup__arr_ulong_19 Workgroup + %25 = OpFunction %void None %24 + %26 = OpLabel + %29 = OpAccessChain %_ptr_Workgroup_ulong %18 %uint_0 + %30 = OpAccessChain %_ptr_Workgroup_ulong %22 %uint_0 + %32 = OpAccessChain %_ptr_StorageBuffer_ulong %13 %uint_0 %uint_0 + %33 = OpAccessChain %_ptr_StorageBuffer_ulong %14 %uint_0 %uint_0 + %37 = OpAtomicIAdd %ulong %29 %uint_1 %uint_80 %ulong_10 + %38 = OpAtomicISub %ulong %29 %uint_1 %uint_80 %ulong_10 + %39 = OpAtomicExchange %ulong %29 %uint_1 %uint_80 %ulong_10 + %40 = OpAtomicSMin %ulong %29 %uint_1 %uint_80 %ulong_10 + %41 = OpAtomicSMax %ulong %29 %uint_1 %uint_80 %ulong_10 + %42 = OpAtomicAnd %ulong %29 %uint_1 %uint_80 %ulong_10 + %43 = OpAtomicOr %ulong %29 %uint_1 %uint_80 %ulong_10 + %44 = OpAtomicXor %ulong %29 %uint_1 %uint_80 %ulong_10 + %45 = OpAtomicIIncrement %ulong %29 %uint_1 %uint_80 + %46 = OpAtomicIDecrement %ulong %29 %uint_1 %uint_80 + %47 = OpAtomicCompareExchange %ulong %29 %uint_1 %uint_80 %uint_80 %ulong_10 %ulong_10 + %48 = OpAtomicIAdd %ulong %30 %uint_1 %uint_80 %ulong_10 + %49 = OpAtomicISub %ulong %30 %uint_1 %uint_80 %ulong_10 + %50 = OpAtomicExchange %ulong %30 %uint_1 %uint_80 %ulong_10 + %51 = OpAtomicUMin %ulong %30 %uint_1 %uint_80 %ulong_10 + %52 = OpAtomicUMax %ulong %30 %uint_1 %uint_80 %ulong_10 + %53 = OpAtomicAnd %ulong %30 %uint_1 %uint_80 %ulong_10 + %54 = OpAtomicOr %ulong %30 %uint_1 %uint_80 %ulong_10 + %55 = OpAtomicXor %ulong %30 %uint_1 %uint_80 %ulong_10 + %56 = OpAtomicIIncrement %ulong %30 %uint_1 %uint_80 + %57 = OpAtomicIDecrement %ulong %30 %uint_1 %uint_80 + %58 = OpAtomicCompareExchange %ulong %30 %uint_1 %uint_80 %uint_80 %ulong_10 %ulong_10 + %59 = OpAtomicIAdd %ulong %32 %uint_1 %uint_80 %ulong_10 + %60 = OpAtomicISub %ulong %32 %uint_1 %uint_80 %ulong_10 + %61 = OpAtomicExchange %ulong %32 %uint_1 %uint_80 %ulong_10 + %62 = OpAtomicSMin %ulong %32 %uint_1 %uint_80 %ulong_10 + %63 = OpAtomicSMax %ulong %32 %uint_1 %uint_80 %ulong_10 + %64 = OpAtomicAnd %ulong %32 %uint_1 %uint_80 %ulong_10 + %65 = OpAtomicOr %ulong %32 %uint_1 %uint_80 %ulong_10 + %66 = OpAtomicXor %ulong %32 %uint_1 %uint_80 %ulong_10 + %67 = OpAtomicIIncrement %ulong %32 %uint_1 %uint_80 + %68 = OpAtomicIDecrement %ulong %32 %uint_1 %uint_80 + %69 = OpAtomicCompareExchange %ulong %32 %uint_1 %uint_80 %uint_80 %ulong_10 %ulong_10 + %70 = OpAtomicIAdd %ulong %33 %uint_1 %uint_80 %ulong_10 + %71 = OpAtomicISub %ulong %33 %uint_1 %uint_80 %ulong_10 + %72 = OpAtomicExchange %ulong %33 %uint_1 %uint_80 %ulong_10 + %73 = OpAtomicUMin %ulong %33 %uint_1 %uint_80 %ulong_10 + %74 = OpAtomicUMax %ulong %33 %uint_1 %uint_80 %ulong_10 + %75 = OpAtomicAnd %ulong %33 %uint_1 %uint_80 %ulong_10 + %76 = OpAtomicOr %ulong %33 %uint_1 %uint_80 %ulong_10 + %77 = OpAtomicXor %ulong %33 %uint_1 %uint_80 %ulong_10 + %78 = OpAtomicIIncrement %ulong %33 %uint_1 %uint_80 + %79 = OpAtomicIDecrement %ulong %33 %uint_1 %uint_80 + %80 = OpAtomicCompareExchange %ulong %33 %uint_1 %uint_80 %uint_80 %ulong_10 %ulong_10 + OpReturn + OpFunctionEnd + %85 = OpExtInst %void %81 Kernel %25 %82 %uint_4 %uint_0 %83 + %87 = OpExtInst %void %81 ArgumentInfo %86 + %89 = OpExtInst %void %81 ArgumentStorageBuffer %85 %uint_2 %uint_0 %uint_0 %87 + %91 = OpExtInst %void %81 ArgumentInfo %90 + %93 = OpExtInst %void %81 ArgumentStorageBuffer %85 %uint_3 %uint_0 %uint_1 %91 + %95 = OpExtInst %void %81 ArgumentInfo %94 + %97 = OpExtInst %void %81 ArgumentWorkgroup %85 %uint_0 %uint_3 %uint_8 %95 + %99 = OpExtInst %void %81 ArgumentInfo %98 + %100 = OpExtInst %void %81 ArgumentWorkgroup %85 %uint_1 %uint_4 %uint_8 %99 + %101 = OpExtInst %void %81 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/atomics/displaced.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/atomics/displaced.spv.dis new file mode 100644 index 0000000000..20b7ee9eda --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/atomics/displaced.spv.dis @@ -0,0 +1,92 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + OpCapability Int8 + %55 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "atomicTest" %gl_LocalInvocationID %10 %14 %19 + OpSource OpenCL_C 200 + %56 = OpString "atomicTest" + %57 = OpString " __kernel" + %59 = OpString "A" + %63 = OpString "B" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_12 0 Offset 0 + OpDecorate %_struct_12 Block + OpDecorate %15 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint + %_struct_12 = OpTypeStruct %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 + %15 = OpSpecConstant %uint 1 + %uchar = OpTypeInt 8 0 +%_arr_uchar_15 = OpTypeArray %uchar %15 +%_ptr_Workgroup__arr_uchar_15 = OpTypePointer Workgroup %_arr_uchar_15 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_PushConstant__struct_11 = OpTypePointer PushConstant %_struct_11 + %uint_0 = OpConstant %uint 0 + %_struct_28 = OpTypeStruct %uint +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_2 = OpConstant %uint 2 + %uint_4 = OpConstant %uint 4 +%_ptr_Workgroup_uchar = OpTypePointer Workgroup %uchar + %uchar_42 = OpConstant %uchar 42 + %uint_5 = OpConstant %uint 5 + %uchar_0 = OpConstant %uchar 0 + %uint_6 = OpConstant %uint 6 + %uint_7 = OpConstant %uint 7 + %uint_1 = OpConstant %uint 1 + %uint_80 = OpConstant %uint 80 + %uint_3 = OpConstant %uint 3 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %19 = OpVariable %_ptr_Workgroup__arr_uchar_15 Workgroup + %22 = OpFunction %void None %21 + %23 = OpLabel + %26 = OpAccessChain %_ptr_PushConstant__struct_11 %14 %uint_0 + %27 = OpLoad %_struct_11 %26 + %29 = OpCopyLogical %_struct_28 %27 + %30 = OpCompositeExtract %uint %29 0 + %32 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %33 = OpLoad %uint %32 + %35 = OpShiftLeftLogical %uint %33 %uint_2 + %37 = OpIAdd %uint %35 %uint_4 + %39 = OpAccessChain %_ptr_Workgroup_uchar %19 %37 + OpStore %39 %uchar_42 + %42 = OpIAdd %uint %35 %uint_5 + %43 = OpAccessChain %_ptr_Workgroup_uchar %19 %42 + OpStore %43 %uchar_0 + %46 = OpIAdd %uint %35 %uint_6 + %47 = OpAccessChain %_ptr_Workgroup_uchar %19 %46 + OpStore %47 %uchar_0 + %49 = OpIAdd %uint %35 %uint_7 + %50 = OpAccessChain %_ptr_Workgroup_uchar %19 %49 + OpStore %50 %uchar_0 + %52 = OpAccessChain %_ptr_Workgroup_uchar %19 %uint_1 + %54 = OpAtomicIAdd %uint %52 %uint_1 %uint_80 %30 + OpReturn + OpFunctionEnd + %58 = OpExtInst %void %55 Kernel %22 %56 %uint_2 %uint_0 %57 + %60 = OpExtInst %void %55 ArgumentInfo %59 + %62 = OpExtInst %void %55 ArgumentWorkgroup %58 %uint_0 %uint_3 %uint_1 %60 + %64 = OpExtInst %void %55 ArgumentInfo %63 + %65 = OpExtInst %void %55 ArgumentPodPushConstant %58 %uint_1 %uint_0 %uint_4 %64 + %66 = OpExtInst %void %55 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/atomics/equality_fail.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/atomics/equality_fail.spv.dis new file mode 100644 index 0000000000..6eb6cbd581 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/atomics/equality_fail.spv.dis @@ -0,0 +1,50 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %23 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %15 "simple" %8 %12 + OpSource OpenCL_C 200 + %24 = OpString "simple" + %25 = OpString " kernel" + %27 = OpString "A" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %9 SpecId 3 + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %9 = OpSpecConstant %uint 1 +%_arr_uint_9 = OpTypeArray %uint %9 +%_ptr_Workgroup__arr_uint_9 = OpTypePointer Workgroup %_arr_uint_9 + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_80 = OpConstant %uint 80 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %12 = OpVariable %_ptr_Workgroup__arr_uint_9 Workgroup + %15 = OpFunction %void None %14 + %16 = OpLabel + %19 = OpAccessChain %_ptr_Workgroup_uint %12 %uint_0 + %22 = OpAtomicIIncrement %uint %19 %uint_1 %uint_80 + OpReturn + OpFunctionEnd + %26 = OpExtInst %void %23 Kernel %15 %24 %uint_1 %uint_0 %25 + %28 = OpExtInst %void %23 ArgumentInfo %27 + %31 = OpExtInst %void %23 ArgumentWorkgroup %26 %uint_0 %uint_3 %uint_4 %28 + %33 = OpExtInst %void %23 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/atomics/forloop.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/atomics/forloop.spv.dis new file mode 100644 index 0000000000..e51de29be6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/atomics/forloop.spv.dis @@ -0,0 +1,98 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %54 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "blarp" %gl_GlobalInvocationID %10 %18 %14 + OpSource OpenCL_C 200 + %55 = OpString "blarp" + %56 = OpString " __kernel" + %59 = OpString "B" + %62 = OpString "x" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_12 0 Offset 0 + OpMemberDecorate %_struct_12 1 Offset 16 + OpDecorate %_struct_12 Block + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint + %_struct_12 = OpTypeStruct %v3uint %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %bool = OpTypeBool +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_80 = OpConstant %uint 80 + %uint_4 = OpConstant %uint 4 + %uint_3 = OpConstant %uint 3 + %uint_16 = OpConstant %uint 16 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %26 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_1 %uint_0 + %27 = OpLoad %uint %26 + %29 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %30 = OpLoad %uint %29 + %31 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %32 = OpLoad %uint %31 + %34 = OpSGreaterThan %bool %27 %uint_0 + OpSelectionMerge %50 None + OpBranchConditional %34 %37 %50 + %37 = OpLabel + %38 = OpPhi %uint %44 %37 %uint_0 %22 + %39 = OpPhi %uint %43 %37 %uint_0 %22 + %41 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %38 + %43 = OpAtomicIAdd %uint %41 %uint_1 %uint_80 %39 + %44 = OpIAdd %uint %38 %uint_1 + %45 = OpSGreaterThanEqual %bool %44 %27 + OpLoopMerge %48 %37 None + OpBranchConditional %45 %48 %37 + %48 = OpLabel + OpBranch %50 + %50 = OpLabel + %51 = OpPhi %uint %uint_0 %22 %43 %48 + %52 = OpIAdd %uint %30 %32 + %53 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %52 + OpStore %53 %51 + OpReturn + OpFunctionEnd + %68 = OpExtInst %void %54 PushConstantRegionOffset %uint_0 %uint_12 + %58 = OpExtInst %void %54 Kernel %21 %55 %uint_4 %uint_0 %56 + %60 = OpExtInst %void %54 ArgumentInfo %59 + %61 = OpExtInst %void %54 ArgumentStorageBuffer %58 %uint_1 %uint_0 %uint_0 %60 + %63 = OpExtInst %void %54 ArgumentInfo %62 + %66 = OpExtInst %void %54 ArgumentPodPushConstant %58 %uint_3 %uint_16 %uint_4 %63 + %70 = OpExtInst %void %54 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/atomics/histo.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/atomics/histo.spv.dis new file mode 100644 index 0000000000..7941656cc2 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/atomics/histo.spv.dis @@ -0,0 +1,66 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + %34 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "atomic" %gl_LocalInvocationID %10 %14 %18 + OpSource OpenCL_C 200 + %35 = OpString "atomic" + %36 = OpString " __kernel" + %39 = OpString "A" + %44 = OpString "B" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %15 SpecId 4 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %15 = OpSpecConstant %uint 1 +%_arr_uint_15 = OpTypeArray %uint %15 +%_ptr_Workgroup__arr_uint_15 = OpTypePointer Workgroup %_arr_uint_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_1 = OpConstant %uint 1 + %uint_80 = OpConstant %uint 80 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %18 = OpVariable %_ptr_Workgroup__arr_uint_15 Workgroup + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_Workgroup_uint %14 %26 + %29 = OpLoad %uint %28 + %30 = OpAccessChain %_ptr_Workgroup_uint %18 %29 + %33 = OpAtomicIIncrement %uint %30 %uint_1 %uint_80 + OpReturn + OpFunctionEnd + %38 = OpExtInst %void %34 Kernel %21 %35 %uint_2 %uint_0 %36 + %40 = OpExtInst %void %34 ArgumentInfo %39 + %43 = OpExtInst %void %34 ArgumentWorkgroup %38 %uint_0 %uint_3 %uint_4 %40 + %45 = OpExtInst %void %34 ArgumentInfo %44 + %46 = OpExtInst %void %34 ArgumentWorkgroup %38 %uint_1 %uint_4 %uint_4 %45 + %47 = OpExtInst %void %34 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/atomics/mismatched_types/int_add_with_float.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/atomics/mismatched_types/int_add_with_float.spv.dis new file mode 100644 index 0000000000..9ec825f040 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/atomics/mismatched_types/int_add_with_float.spv.dis @@ -0,0 +1,76 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 55 +; Schema: 0 + OpCapability Shader + %41 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "atomicTest" %gl_LocalInvocationID %10 %14 %18 + OpSource OpenCL_C 200 + %42 = OpString "atomicTest" + %43 = OpString " __kernel" + %46 = OpString "A" + %51 = OpString "B" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_12 0 Offset 0 + OpDecorate %_struct_12 Block + OpDecorate %15 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint + %_struct_12 = OpTypeStruct %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 + %15 = OpSpecConstant %uint 1 +%_arr_uint_15 = OpTypeArray %uint %15 +%_ptr_Workgroup__arr_uint_15 = OpTypePointer Workgroup %_arr_uint_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant__struct_11 = OpTypePointer PushConstant %_struct_11 + %_struct_29 = OpTypeStruct %uint +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_1 = OpConstant %uint 1 +%uint_1109917696 = OpConstant %uint 1109917696 + %uint_80 = OpConstant %uint 80 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %18 = OpVariable %_ptr_Workgroup__arr_uint_15 Workgroup + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Workgroup_uint %18 %uint_0 + %27 = OpAccessChain %_ptr_PushConstant__struct_11 %14 %uint_0 + %28 = OpLoad %_struct_11 %27 + %30 = OpCopyLogical %_struct_29 %28 + %31 = OpCompositeExtract %uint %30 0 + %33 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %34 = OpLoad %uint %33 + %36 = OpIAdd %uint %34 %uint_1 + %37 = OpAccessChain %_ptr_Workgroup_uint %18 %36 + OpStore %37 %uint_1109917696 + %40 = OpAtomicIAdd %uint %25 %uint_1 %uint_80 %31 + OpReturn + OpFunctionEnd + %45 = OpExtInst %void %41 Kernel %21 %42 %uint_2 %uint_0 %43 + %47 = OpExtInst %void %41 ArgumentInfo %46 + %50 = OpExtInst %void %41 ArgumentWorkgroup %45 %uint_0 %uint_3 %uint_4 %47 + %52 = OpExtInst %void %41 ArgumentInfo %51 + %53 = OpExtInst %void %41 ArgumentPodPushConstant %45 %uint_1 %uint_0 %uint_4 %52 + %54 = OpExtInst %void %41 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/atomics/mismatched_types/int_add_with_long.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/atomics/mismatched_types/int_add_with_long.spv.dis new file mode 100644 index 0000000000..3f6bdd4e81 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/atomics/mismatched_types/int_add_with_long.spv.dis @@ -0,0 +1,80 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + %46 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "atomicTest" %gl_LocalInvocationID %10 %14 %18 + OpSource OpenCL_C 200 + %47 = OpString "atomicTest" + %48 = OpString " __kernel" + %50 = OpString "A" + %54 = OpString "B" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_12 0 Offset 0 + OpDecorate %_struct_12 Block + OpDecorate %15 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint + %_struct_12 = OpTypeStruct %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 + %15 = OpSpecConstant %uint 1 +%_arr_uint_15 = OpTypeArray %uint %15 +%_ptr_Workgroup__arr_uint_15 = OpTypePointer Workgroup %_arr_uint_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant__struct_11 = OpTypePointer PushConstant %_struct_11 + %_struct_29 = OpTypeStruct %uint +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_42 = OpConstant %uint 42 + %uint_3 = OpConstant %uint 3 + %uint_80 = OpConstant %uint 80 + %uint_4 = OpConstant %uint 4 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %18 = OpVariable %_ptr_Workgroup__arr_uint_15 Workgroup + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Workgroup_uint %18 %uint_0 + %27 = OpAccessChain %_ptr_PushConstant__struct_11 %14 %uint_0 + %28 = OpLoad %_struct_11 %27 + %30 = OpCopyLogical %_struct_29 %28 + %31 = OpCompositeExtract %uint %30 0 + %33 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %34 = OpLoad %uint %33 + %36 = OpShiftLeftLogical %uint %34 %uint_1 + %38 = OpIAdd %uint %36 %uint_2 + %39 = OpAccessChain %_ptr_Workgroup_uint %18 %38 + OpStore %39 %uint_42 + %42 = OpIAdd %uint %36 %uint_3 + %43 = OpAccessChain %_ptr_Workgroup_uint %18 %42 + OpStore %43 %uint_0 + %45 = OpAtomicIAdd %uint %25 %uint_1 %uint_80 %31 + OpReturn + OpFunctionEnd + %49 = OpExtInst %void %46 Kernel %21 %47 %uint_2 %uint_0 %48 + %51 = OpExtInst %void %46 ArgumentInfo %50 + %53 = OpExtInst %void %46 ArgumentWorkgroup %49 %uint_0 %uint_3 %uint_4 %51 + %55 = OpExtInst %void %46 ArgumentInfo %54 + %56 = OpExtInst %void %46 ArgumentPodPushConstant %49 %uint_1 %uint_0 %uint_4 %55 + %57 = OpExtInst %void %46 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/atomics/mismatched_types/int_add_with_short.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/atomics/mismatched_types/int_add_with_short.spv.dis new file mode 100644 index 0000000000..24a5e0fb7a --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/atomics/mismatched_types/int_add_with_short.spv.dis @@ -0,0 +1,81 @@ +; @Input: %19 = {0, 0, 0} +; @Config: 3, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpCapability Int16 + %45 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "atomicTest" %gl_LocalInvocationID %10 %14 %19 + OpSource OpenCL_C 200 + %46 = OpString "atomicTest" + %47 = OpString " __kernel" + %49 = OpString "A" + %53 = OpString "B" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_12 0 Offset 0 + OpDecorate %_struct_12 Block + OpDecorate %15 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint + %_struct_12 = OpTypeStruct %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 + %15 = OpSpecConstant %uint 1 + %ushort = OpTypeInt 16 0 +%_arr_ushort_15 = OpTypeArray %ushort %15 +%_ptr_Workgroup__arr_ushort_15 = OpTypePointer Workgroup %_arr_ushort_15 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_runtimearr_ushort = OpTypeRuntimeArray %ushort +%_ptr_Workgroup__runtimearr_ushort = OpTypePointer Workgroup %_runtimearr_ushort +%_ptr_PushConstant__struct_11 = OpTypePointer PushConstant %_struct_11 + %uint_0 = OpConstant %uint 0 + %_struct_31 = OpTypeStruct %uint +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_2 = OpConstant %uint 2 +%_ptr_Workgroup_ushort = OpTypePointer Workgroup %ushort + %ushort_42 = OpConstant %ushort 42 + %uint_1 = OpConstant %uint 1 + %uint_80 = OpConstant %uint 80 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %19 = OpVariable %_ptr_Workgroup__arr_ushort_15 Workgroup + %22 = OpFunction %void None %21 + %23 = OpLabel + %26 = OpAccessChain %_ptr_Workgroup__runtimearr_ushort %19 + %29 = OpAccessChain %_ptr_PushConstant__struct_11 %14 %uint_0 + %30 = OpLoad %_struct_11 %29 + %32 = OpCopyLogical %_struct_31 %30 + %33 = OpCompositeExtract %uint %32 0 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpIAdd %uint %36 %uint_2 + %40 = OpAccessChain %_ptr_Workgroup_ushort %19 %38 + OpStore %40 %ushort_42 + %44 = OpAtomicIAdd %uint %26 %uint_1 %uint_80 %33 + OpReturn + OpFunctionEnd + %48 = OpExtInst %void %45 Kernel %22 %46 %uint_2 %uint_0 %47 + %50 = OpExtInst %void %45 ArgumentInfo %49 + %52 = OpExtInst %void %45 ArgumentWorkgroup %48 %uint_0 %uint_3 %uint_2 %50 + %54 = OpExtInst %void %45 ArgumentInfo %53 + %56 = OpExtInst %void %45 ArgumentPodPushConstant %48 %uint_1 %uint_0 %uint_4 %54 + %57 = OpExtInst %void %45 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/atomics/pointers.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/atomics/pointers.spv.dis new file mode 100644 index 0000000000..5d37ee75af --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/atomics/pointers.spv.dis @@ -0,0 +1,88 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 65 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointers + %49 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %25 "pointers" %gl_LocalInvocationID %10 %14 %18 %22 + OpSource OpenCL_C 200 + %50 = OpString "pointers" + %51 = OpString " kernel" + %53 = OpString "A" + %57 = OpString "B" + %60 = OpString "c" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_12 0 Offset 0 + OpDecorate %_struct_12 Block + OpDecorate %15 SpecId 3 + OpDecorate %19 SpecId 4 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint + %_struct_12 = OpTypeStruct %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 + %15 = OpSpecConstant %uint 1 +%_arr_uint_15 = OpTypeArray %uint %15 +%_ptr_Workgroup__arr_uint_15 = OpTypePointer Workgroup %_arr_uint_15 + %19 = OpSpecConstant %uint 1 +%_arr_uint_19 = OpTypeArray %uint %19 +%_ptr_Workgroup__arr_uint_19 = OpTypePointer Workgroup %_arr_uint_19 + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_PushConstant__struct_11 = OpTypePointer PushConstant %_struct_11 + %uint_0 = OpConstant %uint 0 + %_struct_31 = OpTypeStruct %uint +%_ptr_Input_uint = OpTypePointer Input %uint + %bool = OpTypeBool +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %uint_1 = OpConstant %uint 1 + %uint_80 = OpConstant %uint 80 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %18 = OpVariable %_ptr_Workgroup__arr_uint_15 Workgroup + %22 = OpVariable %_ptr_Workgroup__arr_uint_19 Workgroup + %25 = OpFunction %void None %24 + %26 = OpLabel + %29 = OpAccessChain %_ptr_PushConstant__struct_11 %14 %uint_0 + %30 = OpLoad %_struct_11 %29 + %32 = OpCopyLogical %_struct_31 %30 + %33 = OpCompositeExtract %uint %32 0 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %38 = OpIEqual %bool %33 %uint_0 + %41 = OpAccessChain %_ptr_Workgroup_uint %22 %uint_3 + %43 = OpAccessChain %_ptr_Workgroup_uint %18 %uint_12 + %44 = OpSelect %_ptr_Workgroup_uint %38 %43 %41 + %47 = OpAtomicIIncrement %uint %44 %uint_1 %uint_80 + %48 = OpAccessChain %_ptr_Workgroup_uint %18 %36 + OpStore %48 %47 + OpReturn + OpFunctionEnd + %52 = OpExtInst %void %49 Kernel %25 %50 %uint_3 %uint_0 %51 + %54 = OpExtInst %void %49 ArgumentInfo %53 + %56 = OpExtInst %void %49 ArgumentWorkgroup %52 %uint_0 %uint_3 %uint_4 %54 + %58 = OpExtInst %void %49 ArgumentInfo %57 + %59 = OpExtInst %void %49 ArgumentWorkgroup %52 %uint_1 %uint_4 %uint_4 %58 + %61 = OpExtInst %void %49 ArgumentInfo %60 + %63 = OpExtInst %void %49 ArgumentPodPushConstant %52 %uint_2 %uint_0 %uint_4 %61 + %64 = OpExtInst %void %49 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/atomics/refined_atomic_abstraction/bad_local_counters.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/atomics/refined_atomic_abstraction/bad_local_counters.spv.dis new file mode 100644 index 0000000000..b634d9c8ab --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/atomics/refined_atomic_abstraction/bad_local_counters.spv.dis @@ -0,0 +1,83 @@ +; @Input: %17 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 57 +; Schema: 0 + OpCapability Shader + %41 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "foo" %gl_GlobalInvocationID %13 %17 %21 %5 + OpSource OpenCL_C 200 + %42 = OpString "foo" + %43 = OpString " __kernel" + %46 = OpString "globalArray" + %49 = OpString "localCounter" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 SpecId 3 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %18 = OpSpecConstant %uint 1 +%_arr_uint_18 = OpTypeArray %uint %18 +%_ptr_Workgroup__arr_uint_18 = OpTypePointer Workgroup %_arr_uint_18 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_80 = OpConstant %uint 80 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %21 = OpVariable %_ptr_Workgroup__arr_uint_18 Workgroup + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Workgroup_uint %21 %uint_0 + %31 = OpAtomicIIncrement %uint %28 %uint_1 %uint_80 + %33 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %34 = OpLoad %uint %33 + %36 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %37 = OpLoad %uint %36 + %38 = OpIAdd %uint %37 %34 + %40 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %31 + OpStore %40 %38 + OpReturn + OpFunctionEnd + %55 = OpExtInst %void %41 PushConstantRegionOffset %uint_0 %uint_12 + %45 = OpExtInst %void %41 Kernel %24 %42 %uint_2 %uint_0 %43 + %47 = OpExtInst %void %41 ArgumentInfo %46 + %48 = OpExtInst %void %41 ArgumentStorageBuffer %45 %uint_1 %uint_0 %uint_0 %47 + %50 = OpExtInst %void %41 ArgumentInfo %49 + %53 = OpExtInst %void %41 ArgumentWorkgroup %45 %uint_0 %uint_3 %uint_4 %50 + %56 = OpExtInst %void %41 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/atomics/refined_atomic_abstraction/intra_local_counters.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/atomics/refined_atomic_abstraction/intra_local_counters.spv.dis new file mode 100644 index 0000000000..b634d9c8ab --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/atomics/refined_atomic_abstraction/intra_local_counters.spv.dis @@ -0,0 +1,83 @@ +; @Input: %17 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 57 +; Schema: 0 + OpCapability Shader + %41 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "foo" %gl_GlobalInvocationID %13 %17 %21 %5 + OpSource OpenCL_C 200 + %42 = OpString "foo" + %43 = OpString " __kernel" + %46 = OpString "globalArray" + %49 = OpString "localCounter" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 SpecId 3 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %18 = OpSpecConstant %uint 1 +%_arr_uint_18 = OpTypeArray %uint %18 +%_ptr_Workgroup__arr_uint_18 = OpTypePointer Workgroup %_arr_uint_18 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_80 = OpConstant %uint 80 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %21 = OpVariable %_ptr_Workgroup__arr_uint_18 Workgroup + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Workgroup_uint %21 %uint_0 + %31 = OpAtomicIIncrement %uint %28 %uint_1 %uint_80 + %33 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %34 = OpLoad %uint %33 + %36 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %37 = OpLoad %uint %36 + %38 = OpIAdd %uint %37 %34 + %40 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %31 + OpStore %40 %38 + OpReturn + OpFunctionEnd + %55 = OpExtInst %void %41 PushConstantRegionOffset %uint_0 %uint_12 + %45 = OpExtInst %void %41 Kernel %24 %42 %uint_2 %uint_0 %43 + %47 = OpExtInst %void %41 ArgumentInfo %46 + %48 = OpExtInst %void %41 ArgumentStorageBuffer %45 %uint_1 %uint_0 %uint_0 %47 + %50 = OpExtInst %void %41 ArgumentInfo %49 + %53 = OpExtInst %void %41 ArgumentWorkgroup %45 %uint_0 %uint_3 %uint_4 %50 + %56 = OpExtInst %void %41 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/atomics/refined_atomic_abstraction/many_accesses.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/atomics/refined_atomic_abstraction/many_accesses.spv.dis new file mode 100644 index 0000000000..43ec01d5c8 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/atomics/refined_atomic_abstraction/many_accesses.spv.dis @@ -0,0 +1,176 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 134 +; Schema: 0 + OpCapability Shader + %112 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %34 "foo" %gl_GlobalInvocationID %gl_LocalInvocationID %14 %18 %23 %27 %31 %5 + OpSource OpenCL_C 200 + %113 = OpString "foo" + %114 = OpString " __kernel" + %117 = OpString "globalCounter" + %120 = OpString "globalArray" + %124 = OpString "localCounter" + %128 = OpString "localArray" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_21 0 Offset 0 + OpDecorate %_struct_21 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 1 + OpDecorate %24 SpecId 3 + OpDecorate %28 SpecId 4 + OpDecorate %9 SpecId 0 + OpDecorate %10 SpecId 1 + OpDecorate %11 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %9 %10 %11 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_21 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_21 = OpTypePointer StorageBuffer %_struct_21 + %24 = OpSpecConstant %uint 1 +%_arr_uint_24 = OpTypeArray %uint %24 +%_ptr_Workgroup__arr_uint_24 = OpTypePointer Workgroup %_arr_uint_24 + %28 = OpSpecConstant %uint 1 +%_arr_float_28 = OpTypeArray %float %28 +%_ptr_Workgroup__arr_float_28 = OpTypePointer Workgroup %_arr_float_28 + %void = OpTypeVoid + %33 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_1 = OpConstant %uint 1 + %uint_80 = OpConstant %uint 80 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float +%_ptr_Workgroup_float = OpTypePointer Workgroup %float + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %23 = OpVariable %_ptr_StorageBuffer__struct_21 StorageBuffer + %27 = OpVariable %_ptr_Workgroup__arr_uint_24 Workgroup + %31 = OpVariable %_ptr_Workgroup__arr_float_28 Workgroup + %34 = OpFunction %void None %33 + %35 = OpLabel + %38 = OpAccessChain %_ptr_Workgroup_uint %27 %uint_0 + %40 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + %43 = OpAtomicIIncrement %uint %40 %uint_1 %uint_80 + %44 = OpAtomicIIncrement %uint %38 %uint_1 %uint_80 + %46 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %50 = OpLoad %uint %49 + %51 = OpIAdd %uint %50 %47 + %52 = OpConvertUToF %float %51 + %54 = OpAccessChain %_ptr_StorageBuffer_float %23 %uint_0 %43 + OpStore %54 %52 + %55 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %56 = OpLoad %uint %55 + %57 = OpConvertUToF %float %56 + %59 = OpAccessChain %_ptr_Workgroup_float %31 %44 + OpStore %59 %57 + %60 = OpAtomicIIncrement %uint %40 %uint_1 %uint_80 + %61 = OpAtomicIIncrement %uint %38 %uint_1 %uint_80 + %62 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %63 = OpLoad %uint %62 + %64 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %65 = OpLoad %uint %64 + %66 = OpIAdd %uint %65 %63 + %67 = OpConvertUToF %float %66 + %68 = OpAccessChain %_ptr_StorageBuffer_float %23 %uint_0 %60 + OpStore %68 %67 + %69 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %70 = OpLoad %uint %69 + %71 = OpConvertUToF %float %70 + %72 = OpAccessChain %_ptr_Workgroup_float %31 %61 + OpStore %72 %71 + %73 = OpAtomicIIncrement %uint %40 %uint_1 %uint_80 + %74 = OpAtomicIIncrement %uint %38 %uint_1 %uint_80 + %75 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %76 = OpLoad %uint %75 + %77 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %78 = OpLoad %uint %77 + %79 = OpIAdd %uint %78 %76 + %80 = OpConvertUToF %float %79 + %81 = OpAccessChain %_ptr_StorageBuffer_float %23 %uint_0 %73 + OpStore %81 %80 + %82 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %83 = OpLoad %uint %82 + %84 = OpConvertUToF %float %83 + %85 = OpAccessChain %_ptr_Workgroup_float %31 %74 + OpStore %85 %84 + %86 = OpAtomicIIncrement %uint %40 %uint_1 %uint_80 + %87 = OpAtomicIIncrement %uint %38 %uint_1 %uint_80 + %88 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %89 = OpLoad %uint %88 + %90 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %91 = OpLoad %uint %90 + %92 = OpIAdd %uint %91 %89 + %93 = OpConvertUToF %float %92 + %94 = OpAccessChain %_ptr_StorageBuffer_float %23 %uint_0 %86 + OpStore %94 %93 + %95 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %96 = OpLoad %uint %95 + %97 = OpConvertUToF %float %96 + %98 = OpAccessChain %_ptr_Workgroup_float %31 %87 + OpStore %98 %97 + %99 = OpAtomicIIncrement %uint %40 %uint_1 %uint_80 + %100 = OpAtomicIIncrement %uint %38 %uint_1 %uint_80 + %101 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %102 = OpLoad %uint %101 + %103 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %104 = OpLoad %uint %103 + %105 = OpIAdd %uint %104 %102 + %106 = OpConvertUToF %float %105 + %107 = OpAccessChain %_ptr_StorageBuffer_float %23 %uint_0 %99 + OpStore %107 %106 + %108 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %109 = OpLoad %uint %108 + %110 = OpConvertUToF %float %109 + %111 = OpAccessChain %_ptr_Workgroup_float %31 %100 + OpStore %111 %110 + OpReturn + OpFunctionEnd + %132 = OpExtInst %void %112 PushConstantRegionOffset %uint_0 %uint_12 + %116 = OpExtInst %void %112 Kernel %34 %113 %uint_4 %uint_0 %114 + %118 = OpExtInst %void %112 ArgumentInfo %117 + %119 = OpExtInst %void %112 ArgumentStorageBuffer %116 %uint_0 %uint_0 %uint_0 %118 + %121 = OpExtInst %void %112 ArgumentInfo %120 + %123 = OpExtInst %void %112 ArgumentStorageBuffer %116 %uint_2 %uint_0 %uint_1 %121 + %125 = OpExtInst %void %112 ArgumentInfo %124 + %127 = OpExtInst %void %112 ArgumentWorkgroup %116 %uint_1 %uint_3 %uint_4 %125 + %129 = OpExtInst %void %112 ArgumentInfo %128 + %130 = OpExtInst %void %112 ArgumentWorkgroup %116 %uint_3 %uint_4 %uint_4 %129 + %133 = OpExtInst %void %112 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/atomics/refined_atomic_abstraction/one_access.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/atomics/refined_atomic_abstraction/one_access.spv.dis new file mode 100644 index 0000000000..9b2eb14918 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/atomics/refined_atomic_abstraction/one_access.spv.dis @@ -0,0 +1,116 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 82 +; Schema: 0 + OpCapability Shader + %60 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %34 "foo" %gl_GlobalInvocationID %gl_LocalInvocationID %14 %18 %23 %27 %31 %5 + OpSource OpenCL_C 200 + %61 = OpString "foo" + %62 = OpString " __kernel" + %65 = OpString "globalCounter" + %68 = OpString "globalArray" + %72 = OpString "localCounter" + %76 = OpString "localArray" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_21 0 Offset 0 + OpDecorate %_struct_21 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 1 + OpDecorate %24 SpecId 3 + OpDecorate %28 SpecId 4 + OpDecorate %9 SpecId 0 + OpDecorate %10 SpecId 1 + OpDecorate %11 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %9 %10 %11 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_21 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_21 = OpTypePointer StorageBuffer %_struct_21 + %24 = OpSpecConstant %uint 1 +%_arr_uint_24 = OpTypeArray %uint %24 +%_ptr_Workgroup__arr_uint_24 = OpTypePointer Workgroup %_arr_uint_24 + %28 = OpSpecConstant %uint 1 +%_arr_float_28 = OpTypeArray %float %28 +%_ptr_Workgroup__arr_float_28 = OpTypePointer Workgroup %_arr_float_28 + %void = OpTypeVoid + %33 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_1 = OpConstant %uint 1 + %uint_80 = OpConstant %uint 80 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float +%_ptr_Workgroup_float = OpTypePointer Workgroup %float + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %23 = OpVariable %_ptr_StorageBuffer__struct_21 StorageBuffer + %27 = OpVariable %_ptr_Workgroup__arr_uint_24 Workgroup + %31 = OpVariable %_ptr_Workgroup__arr_float_28 Workgroup + %34 = OpFunction %void None %33 + %35 = OpLabel + %38 = OpAccessChain %_ptr_Workgroup_uint %27 %uint_0 + %40 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + %43 = OpAtomicIIncrement %uint %40 %uint_1 %uint_80 + %44 = OpAtomicIIncrement %uint %38 %uint_1 %uint_80 + %46 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %47 = OpLoad %uint %46 + %49 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %50 = OpLoad %uint %49 + %51 = OpIAdd %uint %50 %47 + %52 = OpConvertUToF %float %51 + %54 = OpAccessChain %_ptr_StorageBuffer_float %23 %uint_0 %43 + OpStore %54 %52 + %55 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %56 = OpLoad %uint %55 + %57 = OpConvertUToF %float %56 + %59 = OpAccessChain %_ptr_Workgroup_float %31 %44 + OpStore %59 %57 + OpReturn + OpFunctionEnd + %80 = OpExtInst %void %60 PushConstantRegionOffset %uint_0 %uint_12 + %64 = OpExtInst %void %60 Kernel %34 %61 %uint_4 %uint_0 %62 + %66 = OpExtInst %void %60 ArgumentInfo %65 + %67 = OpExtInst %void %60 ArgumentStorageBuffer %64 %uint_0 %uint_0 %uint_0 %66 + %69 = OpExtInst %void %60 ArgumentInfo %68 + %71 = OpExtInst %void %60 ArgumentStorageBuffer %64 %uint_2 %uint_0 %uint_1 %69 + %73 = OpExtInst %void %60 ArgumentInfo %72 + %75 = OpExtInst %void %60 ArgumentWorkgroup %64 %uint_1 %uint_3 %uint_4 %73 + %77 = OpExtInst %void %60 ArgumentInfo %76 + %78 = OpExtInst %void %60 ArgumentWorkgroup %64 %uint_3 %uint_4 %uint_4 %77 + %81 = OpExtInst %void %60 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/atomics/refined_atomic_abstraction/predication.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/atomics/refined_atomic_abstraction/predication.spv.dis new file mode 100644 index 0000000000..480caf2765 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/atomics/refined_atomic_abstraction/predication.spv.dis @@ -0,0 +1,101 @@ +; @Input: %17 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %58 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %25 "foo" %gl_GlobalInvocationID %13 %17 %22 %5 + OpSource OpenCL_C 200 + %59 = OpString "foo" + %60 = OpString " __kernel" + %63 = OpString "globalCounter" + %66 = OpString "globalArray" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_20 0 Offset 0 + OpDecorate %_struct_20 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 1 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_20 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_20 = OpTypePointer StorageBuffer %_struct_20 + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %uint_13 = OpConstant %uint 13 + %uint_1 = OpConstant %uint 1 + %uint_80 = OpConstant %uint 80 +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %22 = OpVariable %_ptr_StorageBuffer__struct_20 StorageBuffer + %25 = OpFunction %void None %24 + %26 = OpLabel + %29 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %31 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %32 = OpLoad %uint %31 + %34 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %35 = OpLoad %uint %34 + %36 = OpIAdd %uint %35 %32 + %39 = OpINotEqual %bool %36 %uint_13 + OpSelectionMerge %47 None + OpBranchConditional %39 %42 %47 + %42 = OpLabel + %45 = OpAtomicIIncrement %uint %29 %uint_1 %uint_80 + OpBranch %47 + %47 = OpLabel + %48 = OpPhi %uint %uint_12 %26 %45 %42 + %49 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %50 = OpLoad %uint %49 + %51 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %52 = OpLoad %uint %51 + %53 = OpIAdd %uint %52 %50 + %54 = OpConvertUToF %float %53 + %56 = OpAccessChain %_ptr_StorageBuffer_float %22 %uint_0 %48 + OpStore %56 %54 + OpReturn + OpFunctionEnd + %69 = OpExtInst %void %58 PushConstantRegionOffset %uint_0 %uint_12 + %62 = OpExtInst %void %58 Kernel %25 %59 %uint_2 %uint_0 %60 + %64 = OpExtInst %void %58 ArgumentInfo %63 + %65 = OpExtInst %void %58 ArgumentStorageBuffer %62 %uint_0 %uint_0 %uint_0 %64 + %67 = OpExtInst %void %58 ArgumentInfo %66 + %68 = OpExtInst %void %58 ArgumentStorageBuffer %62 %uint_1 %uint_0 %uint_1 %67 + %70 = OpExtInst %void %58 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/barrier_intervals/test1.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/barrier_intervals/test1.spv.dis new file mode 100644 index 0000000000..02f2218e11 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/barrier_intervals/test1.spv.dis @@ -0,0 +1,66 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + %33 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "simple_kernel" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %34 = OpString "simple_kernel" + %35 = OpString " __kernel" + %38 = OpString "p" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %22 = OpLoad %uint %21 + %24 = OpAccessChain %_ptr_Workgroup_uint %14 %22 + OpStore %24 %22 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %27 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %28 = OpLoad %uint %27 + %29 = OpAccessChain %_ptr_Workgroup_uint %14 %28 + OpStore %29 %28 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %31 = OpLoad %uint %30 + %32 = OpAccessChain %_ptr_Workgroup_uint %14 %31 + OpStore %32 %31 + OpReturn + OpFunctionEnd + %37 = OpExtInst %void %33 Kernel %17 %34 %uint_1 %uint_0 %35 + %39 = OpExtInst %void %33 ArgumentInfo %38 + %42 = OpExtInst %void %33 ArgumentWorkgroup %37 %uint_0 %uint_3 %uint_4 %39 + %43 = OpExtInst %void %33 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/barrier_intervals/test2.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/barrier_intervals/test2.spv.dis new file mode 100644 index 0000000000..263b66ca90 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/barrier_intervals/test2.spv.dis @@ -0,0 +1,73 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %40 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "simple_kernel" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %41 = OpString "simple_kernel" + %42 = OpString " __kernel" + %45 = OpString "p" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %22 = OpLoad %uint %21 + %24 = OpAccessChain %_ptr_Workgroup_uint %14 %22 + OpStore %24 %22 + %26 = OpIEqual %bool %22 %uint_0 + OpSelectionMerge %33 None + OpBranchConditional %26 %29 %33 + %29 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %33 + %33 = OpLabel + %34 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %35 = OpLoad %uint %34 + %36 = OpAccessChain %_ptr_Workgroup_uint %14 %35 + OpStore %36 %35 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %37 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %38 = OpLoad %uint %37 + %39 = OpAccessChain %_ptr_Workgroup_uint %14 %38 + OpStore %39 %38 + OpReturn + OpFunctionEnd + %44 = OpExtInst %void %40 Kernel %17 %41 %uint_1 %uint_0 %42 + %46 = OpExtInst %void %40 ArgumentInfo %45 + %49 = OpExtInst %void %40 ArgumentWorkgroup %44 %uint_0 %uint_3 %uint_4 %46 + %50 = OpExtInst %void %40 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/barrier_intervals/test3.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/barrier_intervals/test3.spv.dis new file mode 100644 index 0000000000..dee2bcecaf --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/barrier_intervals/test3.spv.dis @@ -0,0 +1,89 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 66 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "simple_kernel" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %57 = OpString "simple_kernel" + %58 = OpString " __kernel" + %60 = OpString "p" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %uint_328 = OpConstant %uint 328 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_99 = OpConstant %uint 99 + %uint_22 = OpConstant %uint 22 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Workgroup_uint %14 %uint_0 + OpBranch %23 + %23 = OpLabel + %24 = OpPhi %uint %uint_0 %18 %32 %23 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %28 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %29 = OpLoad %uint %28 + %30 = OpAccessChain %_ptr_Workgroup_uint %14 %29 + OpStore %30 %29 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %32 = OpIAdd %uint %24 %uint_1 + %35 = OpUGreaterThanEqual %bool %24 %uint_99 + OpLoopMerge %38 %23 None + OpBranchConditional %35 %38 %23 + %38 = OpLabel + %39 = OpLoad %uint %21 + %41 = OpIEqual %bool %39 %uint_22 + OpSelectionMerge %55 None + OpBranchConditional %41 %44 %55 + %44 = OpLabel + %45 = OpPhi %uint %49 %44 %uint_0 %38 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %46 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %47 = OpLoad %uint %46 + %48 = OpAccessChain %_ptr_Workgroup_uint %14 %47 + OpStore %48 %47 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %49 = OpIAdd %uint %45 %uint_1 + %50 = OpUGreaterThanEqual %bool %45 %uint_99 + OpLoopMerge %53 %44 None + OpBranchConditional %50 %53 %44 + %53 = OpLabel + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd + %59 = OpExtInst %void %56 Kernel %17 %57 %uint_1 %uint_0 %58 + %61 = OpExtInst %void %56 ArgumentInfo %60 + %64 = OpExtInst %void %56 ArgumentWorkgroup %59 %uint_0 %uint_3 %uint_4 %61 + %65 = OpExtInst %void %56 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/barrier_intervals/test4.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/barrier_intervals/test4.spv.dis new file mode 100644 index 0000000000..721fac4a92 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/barrier_intervals/test4.spv.dis @@ -0,0 +1,114 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 88 +; Schema: 0 + OpCapability Shader + %78 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "simple_kernel" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %79 = OpString "simple_kernel" + %80 = OpString " __kernel" + %82 = OpString "p" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_2 = OpConstant %uint 2 + %uint_328 = OpConstant %uint 328 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_99 = OpConstant %uint 99 + %uint_22 = OpConstant %uint 22 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Workgroup_uint %14 %uint_0 + OpBranch %23 + %23 = OpLabel + %24 = OpPhi %uint %uint_0 %18 %32 %23 + %26 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %27 = OpLoad %uint %26 + %28 = OpAccessChain %_ptr_Workgroup_uint %14 %27 + OpStore %28 %27 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %32 = OpIAdd %uint %24 %uint_1 + %35 = OpUGreaterThanEqual %bool %24 %uint_99 + OpLoopMerge %38 %23 None + OpBranchConditional %35 %38 %23 + %38 = OpLabel + %39 = OpLoad %uint %21 + %41 = OpIEqual %bool %39 %uint_22 + OpSelectionMerge %75 None + OpBranchConditional %41 %44 %75 + %44 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_328 + OpBranch %46 + %46 = OpLabel + %47 = OpPhi %uint %51 %46 %uint_0 %44 + %48 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %49 = OpLoad %uint %48 + %50 = OpAccessChain %_ptr_Workgroup_uint %14 %49 + OpStore %50 %49 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %51 = OpIAdd %uint %47 %uint_1 + %52 = OpUGreaterThanEqual %bool %47 %uint_99 + OpLoopMerge %55 %46 None + OpBranchConditional %52 %55 %46 + %55 = OpLabel + %56 = OpPhi %uint %60 %55 %uint_0 %46 + %57 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %58 = OpLoad %uint %57 + %59 = OpAccessChain %_ptr_Workgroup_uint %14 %58 + OpStore %59 %58 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %60 = OpIAdd %uint %56 %uint_1 + %61 = OpUGreaterThanEqual %bool %56 %uint_99 + OpLoopMerge %64 %55 None + OpBranchConditional %61 %64 %55 + %64 = OpLabel + %65 = OpPhi %uint %69 %64 %uint_0 %55 + %66 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %67 = OpLoad %uint %66 + %68 = OpAccessChain %_ptr_Workgroup_uint %14 %67 + OpStore %68 %67 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %69 = OpIAdd %uint %65 %uint_1 + %70 = OpUGreaterThanEqual %bool %65 %uint_99 + OpLoopMerge %73 %64 None + OpBranchConditional %70 %73 %64 + %73 = OpLabel + OpBranch %75 + %75 = OpLabel + OpBranch %77 + %77 = OpLabel + OpReturn + OpFunctionEnd + %81 = OpExtInst %void %78 Kernel %17 %79 %uint_1 %uint_0 %80 + %83 = OpExtInst %void %78 ArgumentInfo %82 + %86 = OpExtInst %void %78 ArgumentWorkgroup %81 %uint_0 %uint_3 %uint_4 %83 + %87 = OpExtInst %void %78 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/barrierconditionalkernelparam.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/barrierconditionalkernelparam.spv.dis new file mode 100644 index 0000000000..523dc96bf1 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/barrierconditionalkernelparam.spv.dis @@ -0,0 +1,63 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + %34 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %15 "foo" %8 %12 + OpSource OpenCL_C 200 + %35 = OpString "foo" + %36 = OpString " __kernel" + %39 = OpString "x" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_9 0 Offset 0 + OpMemberDecorate %_struct_10 0 Offset 0 + OpDecorate %_struct_10 Block + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_9 = OpTypeStruct %uint + %_struct_10 = OpTypeStruct %_struct_9 +%_ptr_PushConstant__struct_10 = OpTypePointer PushConstant %_struct_10 + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_PushConstant__struct_9 = OpTypePointer PushConstant %_struct_9 + %uint_0 = OpConstant %uint 0 + %_struct_21 = OpTypeStruct %uint + %bool = OpTypeBool + %uint_10 = OpConstant %uint 10 + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %uint_1 = OpConstant %uint 1 + %uint_4 = OpConstant %uint 4 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %12 = OpVariable %_ptr_PushConstant__struct_10 PushConstant + %15 = OpFunction %void None %14 + %16 = OpLabel + %19 = OpAccessChain %_ptr_PushConstant__struct_9 %12 %uint_0 + %20 = OpLoad %_struct_9 %19 + %22 = OpCopyLogical %_struct_21 %20 + %23 = OpCompositeExtract %uint %22 0 + %26 = OpIEqual %bool %23 %uint_10 + OpSelectionMerge %33 None + OpBranchConditional %26 %29 %33 + %29 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd + %38 = OpExtInst %void %34 Kernel %15 %35 %uint_1 %uint_0 %36 + %40 = OpExtInst %void %34 ArgumentInfo %39 + %42 = OpExtInst %void %34 ArgumentPodPushConstant %38 %uint_0 %uint_0 %uint_4 %40 + %43 = OpExtInst %void %34 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/basic1.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/basic1.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/basic1.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/basicbarrier.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/basicbarrier.spv.dis new file mode 100644 index 0000000000..648eda0289 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/basicbarrier.spv.dis @@ -0,0 +1,38 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 22 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %16 = OpString "foo" + %17 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void None %10 + %12 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpReturn + OpFunctionEnd + %19 = OpExtInst %void %15 Kernel %11 %16 %uint_0 %uint_0 %17 + %21 = OpExtInst %void %15 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/basicglobalarray.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/basicglobalarray.spv.dis new file mode 100644 index 0000000000..fa2cacd239 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/basicglobalarray.spv.dis @@ -0,0 +1,73 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + %35 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %gl_LocalInvocationID %14 %18 %5 + OpSource OpenCL_C 200 + %36 = OpString "foo" + %37 = OpString " __kernel" + %40 = OpString "p" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %9 SpecId 0 + OpDecorate %10 SpecId 1 + OpDecorate %11 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %9 %10 %11 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %27 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %28 = OpLoad %uint %27 + %30 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %31 = OpLoad %uint %30 + %32 = OpIAdd %uint %28 %31 + %34 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %32 + OpStore %34 %26 + OpReturn + OpFunctionEnd + %44 = OpExtInst %void %35 PushConstantRegionOffset %uint_0 %uint_12 + %39 = OpExtInst %void %35 Kernel %21 %36 %uint_1 %uint_0 %37 + %41 = OpExtInst %void %35 ArgumentInfo %40 + %42 = OpExtInst %void %35 ArgumentStorageBuffer %39 %uint_0 %uint_0 %uint_0 %41 + %46 = OpExtInst %void %35 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/fail/writeafterread_addition.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/fail/writeafterread_addition.spv.dis new file mode 100644 index 0000000000..89e47d828f --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/fail/writeafterread_addition.spv.dis @@ -0,0 +1,51 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %23 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %15 "foo" %8 %12 + OpSource OpenCL_C 200 + %24 = OpString "foo" + %25 = OpString " __kernel" + %27 = OpString "A" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %9 SpecId 3 + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %9 = OpSpecConstant %uint 1 +%_arr_uint_9 = OpTypeArray %uint %9 +%_ptr_Workgroup__arr_uint_9 = OpTypePointer Workgroup %_arr_uint_9 + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %12 = OpVariable %_ptr_Workgroup__arr_uint_9 Workgroup + %15 = OpFunction %void None %14 + %16 = OpLabel + %19 = OpAccessChain %_ptr_Workgroup_uint %12 %uint_0 + %20 = OpLoad %uint %19 + %22 = OpIAdd %uint %20 %uint_1 + OpStore %19 %22 + OpReturn + OpFunctionEnd + %26 = OpExtInst %void %23 Kernel %15 %24 %uint_1 %uint_0 %25 + %28 = OpExtInst %void %23 ArgumentInfo %27 + %31 = OpExtInst %void %23 ArgumentWorkgroup %26 %uint_0 %uint_3 %uint_4 %28 + %33 = OpExtInst %void %23 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/fail/writeafterread_otherval.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/fail/writeafterread_otherval.spv.dis new file mode 100644 index 0000000000..389314def6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/fail/writeafterread_otherval.spv.dis @@ -0,0 +1,67 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + %32 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_LocalInvocationID %10 %14 %18 + OpSource OpenCL_C 200 + %33 = OpString "foo" + %34 = OpString " __kernel" + %37 = OpString "A" + %42 = OpString "B" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %15 SpecId 4 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %15 = OpSpecConstant %uint 1 +%_arr_uint_15 = OpTypeArray %uint %15 +%_ptr_Workgroup__arr_uint_15 = OpTypePointer Workgroup %_arr_uint_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_5 = OpConstant %uint 5 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_1 = OpConstant %uint 1 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %18 = OpVariable %_ptr_Workgroup__arr_uint_15 Workgroup + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Workgroup_uint %14 %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %29 = OpLoad %uint %28 + %30 = OpAccessChain %_ptr_Workgroup_uint %18 %29 + OpStore %30 %26 + OpStore %25 %uint_5 + OpReturn + OpFunctionEnd + %36 = OpExtInst %void %32 Kernel %21 %33 %uint_2 %uint_0 %34 + %38 = OpExtInst %void %32 ArgumentInfo %37 + %41 = OpExtInst %void %32 ArgumentWorkgroup %36 %uint_0 %uint_3 %uint_4 %38 + %43 = OpExtInst %void %32 ArgumentInfo %42 + %45 = OpExtInst %void %32 ArgumentWorkgroup %36 %uint_1 %uint_4 %uint_4 %43 + %46 = OpExtInst %void %32 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/fail/writetiddiv64_offbyone.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/fail/writetiddiv64_offbyone.spv.dis new file mode 100644 index 0000000000..8c94c4cac1 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/fail/writetiddiv64_offbyone.spv.dis @@ -0,0 +1,73 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + %37 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_LocalInvocationID %10 %14 %18 + OpSource OpenCL_C 200 + %38 = OpString "foo" + %39 = OpString " __kernel" + %42 = OpString "A" + %47 = OpString "i" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_12 0 Offset 0 + OpDecorate %_struct_12 Block + OpDecorate %15 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint + %_struct_12 = OpTypeStruct %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 + %15 = OpSpecConstant %uint 1 +%_arr_uint_15 = OpTypeArray %uint %15 +%_ptr_Workgroup__arr_uint_15 = OpTypePointer Workgroup %_arr_uint_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_PushConstant__struct_11 = OpTypePointer PushConstant %_struct_11 + %uint_0 = OpConstant %uint 0 + %_struct_27 = OpTypeStruct %uint +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_6 = OpConstant %uint 6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_1 = OpConstant %uint 1 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %18 = OpVariable %_ptr_Workgroup__arr_uint_15 Workgroup + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_PushConstant__struct_11 %14 %uint_0 + %26 = OpLoad %_struct_11 %25 + %28 = OpCopyLogical %_struct_27 %26 + %29 = OpCompositeExtract %uint %28 0 + %31 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %32 = OpLoad %uint %31 + %34 = OpShiftRightLogical %uint %32 %uint_6 + %36 = OpAccessChain %_ptr_Workgroup_uint %18 %29 + OpStore %36 %34 + OpReturn + OpFunctionEnd + %41 = OpExtInst %void %37 Kernel %21 %38 %uint_2 %uint_0 %39 + %43 = OpExtInst %void %37 ArgumentInfo %42 + %46 = OpExtInst %void %37 ArgumentWorkgroup %41 %uint_0 %uint_3 %uint_4 %43 + %48 = OpExtInst %void %37 ArgumentInfo %47 + %50 = OpExtInst %void %37 ArgumentPodPushConstant %41 %uint_1 %uint_0 %uint_4 %48 + %51 = OpExtInst %void %37 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/fail/writewritearray_adversarial.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/fail/writewritearray_adversarial.spv.dis new file mode 100644 index 0000000000..adc42bfcf3 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/fail/writewritearray_adversarial.spv.dis @@ -0,0 +1,80 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + %37 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %23 "foo" %8 %12 %16 %20 + OpSource OpenCL_C 200 + %38 = OpString "foo" + %39 = OpString " __kernel" + %42 = OpString "A" + %46 = OpString "B" + %50 = OpString "i" + %54 = OpString "j" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_9 0 Offset 0 + OpMemberDecorate %_struct_9 1 Offset 4 + OpMemberDecorate %_struct_10 0 Offset 0 + OpDecorate %_struct_10 Block + OpDecorate %13 SpecId 3 + OpDecorate %17 SpecId 4 + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_9 = OpTypeStruct %uint %uint + %_struct_10 = OpTypeStruct %_struct_9 +%_ptr_PushConstant__struct_10 = OpTypePointer PushConstant %_struct_10 + %13 = OpSpecConstant %uint 1 +%_arr_uint_13 = OpTypeArray %uint %13 +%_ptr_Workgroup__arr_uint_13 = OpTypePointer Workgroup %_arr_uint_13 + %17 = OpSpecConstant %uint 1 +%_arr_uint_17 = OpTypeArray %uint %17 +%_ptr_Workgroup__arr_uint_17 = OpTypePointer Workgroup %_arr_uint_17 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_PushConstant__struct_9 = OpTypePointer PushConstant %_struct_9 + %uint_0 = OpConstant %uint 0 + %_struct_29 = OpTypeStruct %uint %uint +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_4 = OpConstant %uint 4 + %uint_3 = OpConstant %uint 3 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %12 = OpVariable %_ptr_PushConstant__struct_10 PushConstant + %16 = OpVariable %_ptr_Workgroup__arr_uint_13 Workgroup + %20 = OpVariable %_ptr_Workgroup__arr_uint_17 Workgroup + %23 = OpFunction %void None %22 + %24 = OpLabel + %27 = OpAccessChain %_ptr_PushConstant__struct_9 %12 %uint_0 + %28 = OpLoad %_struct_9 %27 + %30 = OpCopyLogical %_struct_29 %28 + %31 = OpCompositeExtract %uint %30 0 + %32 = OpCompositeExtract %uint %30 1 + %34 = OpAccessChain %_ptr_Workgroup_uint %20 %32 + %35 = OpLoad %uint %34 + %36 = OpAccessChain %_ptr_Workgroup_uint %16 %31 + OpStore %36 %35 + OpReturn + OpFunctionEnd + %41 = OpExtInst %void %37 Kernel %23 %38 %uint_4 %uint_0 %39 + %43 = OpExtInst %void %37 ArgumentInfo %42 + %45 = OpExtInst %void %37 ArgumentWorkgroup %41 %uint_0 %uint_3 %uint_4 %43 + %47 = OpExtInst %void %37 ArgumentInfo %46 + %49 = OpExtInst %void %37 ArgumentWorkgroup %41 %uint_1 %uint_4 %uint_4 %47 + %51 = OpExtInst %void %37 ArgumentInfo %50 + %53 = OpExtInst %void %37 ArgumentPodPushConstant %41 %uint_2 %uint_0 %uint_4 %51 + %55 = OpExtInst %void %37 ArgumentInfo %54 + %56 = OpExtInst %void %37 ArgumentPodPushConstant %41 %uint_3 %uint_4 %uint_4 %55 + %57 = OpExtInst %void %37 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/fail/writezero_nobenign.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/fail/writezero_nobenign.spv.dis new file mode 100644 index 0000000000..d7aa67d2ac --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/fail/writezero_nobenign.spv.dis @@ -0,0 +1,49 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %15 "foo" %8 %12 + OpSource OpenCL_C 200 + %21 = OpString "foo" + %22 = OpString " __kernel" + %25 = OpString "A" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %9 SpecId 3 + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %9 = OpSpecConstant %uint 1 +%_arr_uint_9 = OpTypeArray %uint %9 +%_ptr_Workgroup__arr_uint_9 = OpTypePointer Workgroup %_arr_uint_9 + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 + %uint_4 = OpConstant %uint 4 + %uint_3 = OpConstant %uint 3 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %12 = OpVariable %_ptr_Workgroup__arr_uint_9 Workgroup + %15 = OpFunction %void None %14 + %16 = OpLabel + %19 = OpAccessChain %_ptr_Workgroup_uint %12 %uint_0 + OpStore %19 %uint_0 + OpReturn + OpFunctionEnd + %24 = OpExtInst %void %20 Kernel %15 %21 %uint_4 %uint_0 %22 + %26 = OpExtInst %void %20 ArgumentInfo %25 + %28 = OpExtInst %void %20 ArgumentWorkgroup %24 %uint_0 %uint_3 %uint_4 %26 + %31 = OpExtInst %void %20 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/pass/writeafterread.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/pass/writeafterread.spv.dis new file mode 100644 index 0000000000..5d349c8d5b --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/pass/writeafterread.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %18 = OpExtInst %void %13 Kernel %11 %14 %uint_1 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/pass/writeinloop.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/pass/writeinloop.spv.dis new file mode 100644 index 0000000000..e9e06b1758 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/pass/writeinloop.spv.dis @@ -0,0 +1,78 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 57 +; Schema: 0 + OpCapability Shader + %39 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %19 "foo" %8 %12 %16 + OpSource OpenCL_C 200 + %40 = OpString "foo" + %41 = OpString " __kernel" + %44 = OpString "A" + %48 = OpString "start" + %52 = OpString "end" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_9 0 Offset 0 + OpMemberDecorate %_struct_9 1 Offset 4 + OpMemberDecorate %_struct_10 0 Offset 0 + OpDecorate %_struct_10 Block + OpDecorate %13 SpecId 3 + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_9 = OpTypeStruct %uint %uint + %_struct_10 = OpTypeStruct %_struct_9 +%_ptr_PushConstant__struct_10 = OpTypePointer PushConstant %_struct_10 + %13 = OpSpecConstant %uint 1 +%_arr_uint_13 = OpTypeArray %uint %13 +%_ptr_Workgroup__arr_uint_13 = OpTypePointer Workgroup %_arr_uint_13 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant__struct_9 = OpTypePointer PushConstant %_struct_9 + %_struct_27 = OpTypeStruct %uint %uint + %bool = OpTypeBool + %uint_42 = OpConstant %uint 42 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %12 = OpVariable %_ptr_PushConstant__struct_10 PushConstant + %16 = OpVariable %_ptr_Workgroup__arr_uint_13 Workgroup + %19 = OpFunction %void None %18 + %20 = OpLabel + %23 = OpAccessChain %_ptr_Workgroup_uint %16 %uint_0 + %25 = OpAccessChain %_ptr_PushConstant__struct_9 %12 %uint_0 + %26 = OpLoad %_struct_9 %25 + %28 = OpCopyLogical %_struct_27 %26 + %29 = OpCompositeExtract %uint %28 0 + %30 = OpCompositeExtract %uint %28 1 + %32 = OpULessThan %bool %29 %30 + OpSelectionMerge %38 None + OpBranchConditional %32 %35 %38 + %35 = OpLabel + OpStore %23 %uint_42 + OpBranch %38 + %38 = OpLabel + OpReturn + OpFunctionEnd + %43 = OpExtInst %void %39 Kernel %19 %40 %uint_3 %uint_0 %41 + %45 = OpExtInst %void %39 ArgumentInfo %44 + %47 = OpExtInst %void %39 ArgumentWorkgroup %43 %uint_0 %uint_3 %uint_4 %45 + %49 = OpExtInst %void %39 ArgumentInfo %48 + %51 = OpExtInst %void %39 ArgumentPodPushConstant %43 %uint_1 %uint_0 %uint_4 %49 + %53 = OpExtInst %void %39 ArgumentInfo %52 + %55 = OpExtInst %void %39 ArgumentPodPushConstant %43 %uint_2 %uint_4 %uint_4 %53 + %56 = OpExtInst %void %39 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/pass/writezero.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/pass/writezero.spv.dis new file mode 100644 index 0000000000..5597fa1a94 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/benign_race_tests/pass/writezero.spv.dis @@ -0,0 +1,49 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %15 "foo" %8 %12 + OpSource OpenCL_C 200 + %21 = OpString "foo" + %22 = OpString " __kernel" + %25 = OpString "A" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %9 SpecId 3 + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %9 = OpSpecConstant %uint 1 +%_arr_uint_9 = OpTypeArray %uint %9 +%_ptr_Workgroup__arr_uint_9 = OpTypePointer Workgroup %_arr_uint_9 + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 + %uint_4 = OpConstant %uint 4 + %uint_3 = OpConstant %uint 3 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %12 = OpVariable %_ptr_Workgroup__arr_uint_9 Workgroup + %15 = OpFunction %void None %14 + %16 = OpLabel + %19 = OpAccessChain %_ptr_Workgroup_uint %12 %uint_0 + OpStore %19 %uint_0 + OpReturn + OpFunctionEnd + %24 = OpExtInst %void %20 Kernel %15 %21 %uint_4 %uint_0 %22 + %26 = OpExtInst %void %20 ArgumentInfo %25 + %28 = OpExtInst %void %20 ArgumentWorkgroup %24 %uint_0 %uint_3 %uint_4 %26 + %31 = OpExtInst %void %20 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/bitand.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/bitand.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/bitand.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/bitnot.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/bitnot.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/bitnot.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/bitor.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/bitor.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/bitor.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/bitxor.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/bitxor.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/bitxor.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/bool_bv_test.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/bool_bv_test.spv.dis new file mode 100644 index 0000000000..31e32b91a4 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/bool_bv_test.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %18 = OpExtInst %void %13 Kernel %11 %14 %uint_1 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/casttofloat.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/casttofloat.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/casttofloat.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/ceil.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/ceil.spv.dis new file mode 100644 index 0000000000..d2262d8974 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/ceil.spv.dis @@ -0,0 +1,63 @@ +; @Input: %16 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %28 = OpExtInstImport "GLSL.std.450" + %30 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %19 "test" %gl_LocalInvocationID %10 %16 + OpSource OpenCL_C 200 + %31 = OpString "test" + %32 = OpString " __kernel" + %35 = OpString "io" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %_struct_14 0 Offset 0 + OpDecorate %_struct_14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %_struct_14 = OpTypeStruct %_runtimearr_v4float +%_ptr_StorageBuffer__struct_14 = OpTypePointer StorageBuffer %_struct_14 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %16 = OpVariable %_ptr_StorageBuffer__struct_14 StorageBuffer + %19 = OpFunction %void None %18 + %20 = OpLabel + %23 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %24 = OpLoad %uint %23 + %26 = OpAccessChain %_ptr_StorageBuffer_v4float %16 %uint_0 %24 + %27 = OpLoad %v4float %26 + %29 = OpExtInst %v4float %28 Ceil %27 + OpStore %26 %29 + OpReturn + OpFunctionEnd + %34 = OpExtInst %void %30 Kernel %19 %31 %uint_1 %uint_0 %32 + %36 = OpExtInst %void %30 ArgumentInfo %35 + %37 = OpExtInst %void %30 ArgumentStorageBuffer %34 %uint_0 %uint_0 %uint_0 %36 + %39 = OpExtInst %void %30 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/checkarrays/fail/arraydoesnotexist1.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/checkarrays/fail/arraydoesnotexist1.spv.dis new file mode 100644 index 0000000000..d2349d29f4 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/checkarrays/fail/arraydoesnotexist1.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %18 = OpExtInst %void %13 Kernel %11 %14 %uint_1 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/checkarrays/fail/arraydoesnotexist2.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/checkarrays/fail/arraydoesnotexist2.spv.dis new file mode 100644 index 0000000000..7df43d526d --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/checkarrays/fail/arraydoesnotexist2.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %18 = OpExtInst %void %13 Kernel %11 %14 %uint_2 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/checkarrays/pass/specifyall.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/checkarrays/pass/specifyall.spv.dis new file mode 100644 index 0000000000..b8513645d4 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/checkarrays/pass/specifyall.spv.dis @@ -0,0 +1,93 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 63 +; Schema: 0 + OpCapability Shader + %48 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "foo" %gl_GlobalInvocationID %gl_LocalInvocationID %14 %18 %19 %5 + OpSource OpenCL_C 200 + %49 = OpString "foo" + %50 = OpString " kernel" + %53 = OpString "A" + %56 = OpString "B" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 1 + OpDecorate %9 SpecId 0 + OpDecorate %10 SpecId 1 + OpDecorate %11 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %9 %10 %11 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + %26 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %27 = OpLoad %uint %26 + %29 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %30 = OpLoad %uint %29 + %31 = OpIAdd %uint %27 %30 + %33 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %31 + %34 = OpLoad %uint %33 + %35 = OpIAdd %uint %27 %30 + %36 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %35 + OpStore %36 %34 + %37 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %38 = OpLoad %uint %37 + %39 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %40 = OpLoad %uint %39 + %41 = OpIAdd %uint %38 %40 + %42 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %41 + %43 = OpLoad %uint %42 + %44 = OpIAdd %uint %38 %40 + %45 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %44 + %46 = OpLoad %uint %45 + %47 = OpIAdd %uint %46 %43 + OpStore %45 %47 + OpReturn + OpFunctionEnd + %61 = OpExtInst %void %48 PushConstantRegionOffset %uint_0 %uint_12 + %52 = OpExtInst %void %48 Kernel %22 %49 %uint_2 %uint_0 %50 + %54 = OpExtInst %void %48 ArgumentInfo %53 + %55 = OpExtInst %void %48 ArgumentStorageBuffer %52 %uint_0 %uint_0 %uint_0 %54 + %57 = OpExtInst %void %48 ArgumentInfo %56 + %59 = OpExtInst %void %48 ArgumentStorageBuffer %52 %uint_1 %uint_0 %uint_1 %57 + %62 = OpExtInst %void %48 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/conditional_int_test.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/conditional_int_test.spv.dis new file mode 100644 index 0000000000..76fefda694 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/conditional_int_test.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %18 = OpExtInst %void %13 Kernel %11 %14 %uint_2 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/constantnotparam.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/constantnotparam.spv.dis new file mode 100644 index 0000000000..170897f5db --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/constantnotparam.spv.dis @@ -0,0 +1,62 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %4 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %23 "foo" %3 %16 %21 + OpSource OpenCL_C 200 + %34 = OpString "foo" + %35 = OpString " __kernel" + %38 = OpString "matrixA" + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %21 DescriptorSet 1 + OpDecorate %21 Binding 0 + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %1 = OpTypeSampler +%_ptr_UniformConstant_1 = OpTypePointer UniformConstant %1 + %void = OpTypeVoid + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_20 = OpConstant %uint 20 + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 + %18 = OpTypeImage %float 2D 0 0 0 1 Unknown + %19 = OpTypeSampledImage %18 +%_ptr_UniformConstant_18 = OpTypePointer UniformConstant %18 + %22 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %31 = OpConstantComposite %v2float %float_1 %float_1 + %float_0 = OpConstant %float 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %3 = OpVariable %_ptr_UniformConstant_1 UniformConstant + %16 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %21 = OpVariable %_ptr_UniformConstant_18 UniformConstant + %23 = OpFunction %void None %22 + %24 = OpLabel + %25 = OpLoad %18 %21 + %26 = OpLoad %1 %3 + %27 = OpSampledImage %19 %25 %26 + %33 = OpImageSampleExplicitLod %v4float %27 %31 Lod %float_0 + OpReturn + OpFunctionEnd + %9 = OpExtInst %void %4 LiteralSampler %uint_0 %uint_0 %uint_20 + %37 = OpExtInst %void %4 Kernel %23 %34 %uint_1 %uint_0 %35 + %39 = OpExtInst %void %4 ArgumentInfo %38 + %40 = OpExtInst %void %4 ArgumentSampledImage %37 %uint_0 %uint_1 %uint_0 %39 + %42 = OpExtInst %void %4 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/derived_from_uniformity_analysis_bug.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/derived_from_uniformity_analysis_bug.spv.dis new file mode 100644 index 0000000000..894e0e2bf1 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/derived_from_uniformity_analysis_bug.spv.dis @@ -0,0 +1,39 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %13 "foo" %gl_LocalInvocationID %10 + OpSource OpenCL_C 200 + %16 = OpString "foo" + %17 = OpString " __kernel" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %13 = OpFunction %void Pure|Const %12 + %14 = OpLabel + OpReturn + OpFunctionEnd + %20 = OpExtInst %void %15 Kernel %13 %16 %uint_1 %uint_0 %17 + %22 = OpExtInst %void %15 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/derivedfrombinomialoptions.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/derivedfrombinomialoptions.spv.dis new file mode 100644 index 0000000000..19f971d505 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/derivedfrombinomialoptions.spv.dis @@ -0,0 +1,112 @@ +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %22 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 76 +; Schema: 0 + OpCapability Shader + %51 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %25 "binomial_options_kernel" %gl_GlobalInvocationID %gl_LocalInvocationID %14 %19 %20 %21 %22 %5 + OpSource OpenCL_C 200 + %52 = OpString "binomial_options_kernel" + %53 = OpString " __kernel" + %56 = OpString "s" + %59 = OpString "pu_by_df" + %64 = OpString "call_value" + %69 = OpString "call_buffer" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 3 + OpDecorate %9 SpecId 0 + OpDecorate %10 SpecId 1 + OpDecorate %11 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %9 %10 %11 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_17 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_7 = OpConstant %uint 7 + %uint_3 = OpConstant %uint 3 + %uint_1 = OpConstant %uint 1 + %uint_5 = OpConstant %uint 5 + %uint_2 = OpConstant %uint 2 + %uint_6 = OpConstant %uint 6 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %22 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %25 = OpFunction %void None %24 + %26 = OpLabel + %29 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %30 = OpLoad %uint %29 + %32 = OpAccessChain %_ptr_StorageBuffer_float %19 %uint_0 %30 + %33 = OpLoad %float %32 + %34 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %35 = OpLoad %uint %34 + %37 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %38 = OpLoad %uint %37 + %39 = OpIAdd %uint %35 %38 + %40 = OpAccessChain %_ptr_StorageBuffer_float %21 %uint_0 %39 + OpStore %40 %33 + %41 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %42 = OpLoad %uint %41 + %43 = OpAccessChain %_ptr_StorageBuffer_float %20 %uint_0 %42 + %44 = OpLoad %float %43 + %45 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %46 = OpLoad %uint %45 + %47 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %48 = OpLoad %uint %47 + %49 = OpIAdd %uint %46 %48 + %50 = OpAccessChain %_ptr_StorageBuffer_float %22 %uint_0 %49 + OpStore %50 %44 + OpReturn + OpFunctionEnd + %74 = OpExtInst %void %51 PushConstantRegionOffset %uint_0 %uint_12 + %55 = OpExtInst %void %51 Kernel %25 %52 %uint_7 %uint_0 %53 + %57 = OpExtInst %void %51 ArgumentInfo %56 + %58 = OpExtInst %void %51 ArgumentStorageBuffer %55 %uint_0 %uint_0 %uint_0 %57 + %60 = OpExtInst %void %51 ArgumentInfo %59 + %63 = OpExtInst %void %51 ArgumentStorageBuffer %55 %uint_3 %uint_0 %uint_1 %60 + %65 = OpExtInst %void %51 ArgumentInfo %64 + %68 = OpExtInst %void %51 ArgumentStorageBuffer %55 %uint_5 %uint_0 %uint_2 %65 + %70 = OpExtInst %void %51 ArgumentInfo %69 + %72 = OpExtInst %void %51 ArgumentStorageBuffer %55 %uint_6 %uint_0 %uint_3 %70 + %75 = OpExtInst %void %51 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/derivedfrombinomialoptions2.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/derivedfrombinomialoptions2.spv.dis new file mode 100644 index 0000000000..95812a733f --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/derivedfrombinomialoptions2.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "binomial_options_kernel" %8 + OpSource OpenCL_C 200 + %14 = OpString "binomial_options_kernel" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %18 = OpExtInst %void %13 Kernel %11 %14 %uint_1 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/divergence/race_and_divergence.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/divergence/race_and_divergence.spv.dis new file mode 100644 index 0000000000..43c05bda14 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/divergence/race_and_divergence.spv.dis @@ -0,0 +1,87 @@ +; @Input: %17 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + %44 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %13 %17 %18 %5 + OpSource OpenCL_C 200 + %45 = OpString "foo" + %46 = OpString " kernel" + %48 = OpString "A" + %51 = OpString "B" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 + %uint_72 = OpConstant %uint 72 + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + %27 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %28 = OpLoad %uint %27 + %30 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %31 = OpLoad %uint %30 + %32 = OpIAdd %uint %28 %31 + %33 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %32 + %34 = OpLoad %uint %33 + %36 = OpIEqual %bool %34 %uint_0 + OpSelectionMerge %43 None + OpBranchConditional %36 %39 %43 + %39 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpBranch %43 + %43 = OpLabel + OpStore %25 %34 + OpReturn + OpFunctionEnd + %56 = OpExtInst %void %44 PushConstantRegionOffset %uint_0 %uint_12 + %47 = OpExtInst %void %44 Kernel %21 %45 %uint_2 %uint_0 %46 + %49 = OpExtInst %void %44 ArgumentInfo %48 + %50 = OpExtInst %void %44 ArgumentStorageBuffer %47 %uint_0 %uint_0 %uint_0 %49 + %52 = OpExtInst %void %44 ArgumentInfo %51 + %54 = OpExtInst %void %44 ArgumentStorageBuffer %47 %uint_1 %uint_0 %uint_1 %52 + %57 = OpExtInst %void %44 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/divergence/race_no_divergence.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/divergence/race_no_divergence.spv.dis new file mode 100644 index 0000000000..1c973404e9 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/divergence/race_no_divergence.spv.dis @@ -0,0 +1,80 @@ +; @Input: %17 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %37 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %13 %17 %18 %5 + OpSource OpenCL_C 200 + %38 = OpString "foo" + %39 = OpString " kernel" + %41 = OpString "A" + %44 = OpString "B" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_2 = OpConstant %uint 2 + %uint_72 = OpConstant %uint 72 + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + %27 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %28 = OpLoad %uint %27 + %30 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %31 = OpLoad %uint %30 + %32 = OpIAdd %uint %28 %31 + %33 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %32 + %34 = OpLoad %uint %33 + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpStore %25 %34 + OpReturn + OpFunctionEnd + %49 = OpExtInst %void %37 PushConstantRegionOffset %uint_0 %uint_12 + %40 = OpExtInst %void %37 Kernel %21 %38 %uint_2 %uint_0 %39 + %42 = OpExtInst %void %37 ArgumentInfo %41 + %43 = OpExtInst %void %37 ArgumentStorageBuffer %40 %uint_0 %uint_0 %uint_0 %42 + %45 = OpExtInst %void %37 ArgumentInfo %44 + %47 = OpExtInst %void %37 ArgumentStorageBuffer %40 %uint_1 %uint_0 %uint_1 %45 + %50 = OpExtInst %void %37 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/fail_equality_and_adversarial.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/fail_equality_and_adversarial.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/fail_equality_and_adversarial.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/float_constant_test2.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/float_constant_test2.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/float_constant_test2.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/floatcastrequired.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/floatcastrequired.spv.dis new file mode 100644 index 0000000000..17e6954ee5 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/floatcastrequired.spv.dis @@ -0,0 +1,40 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %18 = OpString "foo" + %19 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %bool = OpTypeBool + %float = OpTypeFloat 32 + %float_2 = OpConstant %float 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + %16 = OpIsNan %bool %float_2 + OpReturn + OpFunctionEnd + %21 = OpExtInst %void %17 Kernel %11 %18 %uint_0 %uint_0 %19 + %24 = OpExtInst %void %17 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/floatrelationalop.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/floatrelationalop.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/floatrelationalop.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/get_global_id.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/get_global_id.spv.dis new file mode 100644 index 0000000000..a6d209f747 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/get_global_id.spv.dis @@ -0,0 +1,74 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + %36 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %13 %18 %5 + OpSource OpenCL_C 200 + %37 = OpString "foo" + %38 = OpString " __kernel" + %41 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %35 NoContraction + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_16 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %26 %29 + %32 = OpAccessChain %_ptr_StorageBuffer_float %18 %uint_0 %30 + %33 = OpLoad %float %32 + %35 = OpFAdd %float %33 %float_1 + OpStore %32 %35 + OpReturn + OpFunctionEnd + %45 = OpExtInst %void %36 PushConstantRegionOffset %uint_0 %uint_12 + %40 = OpExtInst %void %36 Kernel %21 %37 %uint_1 %uint_0 %38 + %42 = OpExtInst %void %36 ArgumentInfo %41 + %43 = OpExtInst %void %36 ArgumentStorageBuffer %40 %uint_0 %uint_0 %uint_0 %42 + %47 = OpExtInst %void %36 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/global_size/local_size_fail_divide_global_size.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/global_size/local_size_fail_divide_global_size.spv.dis new file mode 100644 index 0000000000..4ae4bd5f0c --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/global_size/local_size_fail_divide_global_size.spv.dis @@ -0,0 +1,72 @@ +; @Input: %17 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + %35 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %20 "a" %gl_GlobalInvocationID %13 %17 %5 + OpSource OpenCL_C 200 + %36 = OpString "a" + %37 = OpString " __kernel" + %40 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_5 = OpConstant %uint 5 + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %20 = OpFunction %void None %19 + %21 = OpLabel + %24 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %25 = OpLoad %uint %24 + %27 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %28 = OpLoad %uint %27 + %29 = OpIAdd %uint %25 %28 + %31 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %29 + %32 = OpLoad %uint %31 + %34 = OpIAdd %uint %32 %uint_5 + OpStore %31 %34 + OpReturn + OpFunctionEnd + %44 = OpExtInst %void %35 PushConstantRegionOffset %uint_0 %uint_12 + %39 = OpExtInst %void %35 Kernel %20 %36 %uint_1 %uint_0 %37 + %41 = OpExtInst %void %35 ArgumentInfo %40 + %42 = OpExtInst %void %35 ArgumentStorageBuffer %39 %uint_0 %uint_0 %uint_0 %41 + %46 = OpExtInst %void %35 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/global_size/mismatch_dims.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/global_size/mismatch_dims.spv.dis new file mode 100644 index 0000000000..4ae4bd5f0c --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/global_size/mismatch_dims.spv.dis @@ -0,0 +1,72 @@ +; @Input: %17 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + %35 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %20 "a" %gl_GlobalInvocationID %13 %17 %5 + OpSource OpenCL_C 200 + %36 = OpString "a" + %37 = OpString " __kernel" + %40 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_5 = OpConstant %uint 5 + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %20 = OpFunction %void None %19 + %21 = OpLabel + %24 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %25 = OpLoad %uint %24 + %27 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %28 = OpLoad %uint %27 + %29 = OpIAdd %uint %25 %28 + %31 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %29 + %32 = OpLoad %uint %31 + %34 = OpIAdd %uint %32 %uint_5 + OpStore %31 %34 + OpReturn + OpFunctionEnd + %44 = OpExtInst %void %35 PushConstantRegionOffset %uint_0 %uint_12 + %39 = OpExtInst %void %35 Kernel %20 %36 %uint_1 %uint_0 %37 + %41 = OpExtInst %void %35 ArgumentInfo %40 + %42 = OpExtInst %void %35 ArgumentStorageBuffer %39 %uint_0 %uint_0 %uint_0 %41 + %46 = OpExtInst %void %35 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/global_size/num_groups_and_global_size.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/global_size/num_groups_and_global_size.spv.dis new file mode 100644 index 0000000000..4ae4bd5f0c --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/global_size/num_groups_and_global_size.spv.dis @@ -0,0 +1,72 @@ +; @Input: %17 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + %35 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %20 "a" %gl_GlobalInvocationID %13 %17 %5 + OpSource OpenCL_C 200 + %36 = OpString "a" + %37 = OpString " __kernel" + %40 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_5 = OpConstant %uint 5 + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %20 = OpFunction %void None %19 + %21 = OpLabel + %24 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %25 = OpLoad %uint %24 + %27 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %28 = OpLoad %uint %27 + %29 = OpIAdd %uint %25 %28 + %31 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %29 + %32 = OpLoad %uint %31 + %34 = OpIAdd %uint %32 %uint_5 + OpStore %31 %34 + OpReturn + OpFunctionEnd + %44 = OpExtInst %void %35 PushConstantRegionOffset %uint_0 %uint_12 + %39 = OpExtInst %void %35 Kernel %20 %36 %uint_1 %uint_0 %37 + %41 = OpExtInst %void %35 ArgumentInfo %40 + %42 = OpExtInst %void %35 ArgumentStorageBuffer %39 %uint_0 %uint_0 %uint_0 %41 + %46 = OpExtInst %void %35 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/globalarray/fail.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/globalarray/fail.spv.dis new file mode 100644 index 0000000000..2fbdbffe62 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/globalarray/fail.spv.dis @@ -0,0 +1,78 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + %41 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "globalarray" %gl_GlobalInvocationID %13 %18 %5 + OpSource OpenCL_C 200 + %42 = OpString "globalarray" + %43 = OpString " __kernel" + %46 = OpString "p" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_16 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_StorageBuffer_float %18 %uint_0 %uint_0 + %27 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %28 = OpLoad %uint %27 + %30 = OpIEqual %bool %uint_0 %uint_0 + OpSelectionMerge %40 None + OpBranchConditional %30 %33 %40 + %33 = OpLabel + %35 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %37 = OpIAdd %uint %36 %28 + %38 = OpConvertUToF %float %37 + OpStore %25 %38 + OpBranch %40 + %40 = OpLabel + OpReturn + OpFunctionEnd + %50 = OpExtInst %void %41 PushConstantRegionOffset %uint_0 %uint_12 + %45 = OpExtInst %void %41 Kernel %21 %42 %uint_1 %uint_0 %43 + %47 = OpExtInst %void %41 ArgumentInfo %46 + %48 = OpExtInst %void %41 ArgumentStorageBuffer %45 %uint_0 %uint_0 %uint_0 %47 + %52 = OpExtInst %void %41 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/globalarray/pass.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/globalarray/pass.spv.dis new file mode 100644 index 0000000000..a21eb97581 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/globalarray/pass.spv.dis @@ -0,0 +1,78 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + %41 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "globalarray" %gl_GlobalInvocationID %13 %18 %5 + OpSource OpenCL_C 200 + %42 = OpString "globalarray" + %43 = OpString " __kernel" + %46 = OpString "p" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_16 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_StorageBuffer_float %18 %uint_0 %uint_0 + %27 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %28 = OpLoad %uint %27 + %30 = OpINotEqual %bool %uint_0 %uint_0 + OpSelectionMerge %40 None + OpBranchConditional %30 %33 %40 + %33 = OpLabel + %35 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %37 = OpIAdd %uint %36 %28 + %38 = OpConvertUToF %float %37 + OpStore %25 %38 + OpBranch %40 + %40 = OpLabel + OpReturn + OpFunctionEnd + %50 = OpExtInst %void %41 PushConstantRegionOffset %uint_0 %uint_12 + %45 = OpExtInst %void %41 Kernel %21 %42 %uint_1 %uint_0 %43 + %47 = OpExtInst %void %41 ArgumentInfo %46 + %48 = OpExtInst %void %41 ArgumentStorageBuffer %45 %uint_0 %uint_0 %uint_0 %47 + %52 = OpExtInst %void %41 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/imagetests/fail2dimagecopy.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/imagetests/fail2dimagecopy.spv.dis new file mode 100644 index 0000000000..03d2160f9d --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/imagetests/fail2dimagecopy.spv.dis @@ -0,0 +1,99 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 73 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageWriteWithoutFormat + %4 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %31 "k" %3 %gl_GlobalInvocationID %21 %25 %29 %13 + OpSource OpenCL_C 200 + %60 = OpString "k" + %61 = OpString " __kernel" + %64 = OpString "dest" + %67 = OpString "src" + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 0 + OpMemberDecorate %_struct_11 0 Offset 0 + OpDecorate %_struct_11 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %25 DescriptorSet 1 + OpDecorate %25 Binding 0 + OpDecorate %29 DescriptorSet 1 + OpDecorate %29 Binding 1 + OpDecorate %16 SpecId 0 + OpDecorate %17 SpecId 1 + OpDecorate %18 SpecId 2 + %1 = OpTypeSampler +%_ptr_UniformConstant_1 = OpTypePointer UniformConstant %1 + %void = OpTypeVoid + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_18 = OpConstant %uint 18 + %v3uint = OpTypeVector %uint 3 + %_struct_11 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_11 = OpTypePointer PushConstant %_struct_11 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %16 = OpSpecConstant %uint 1 + %17 = OpSpecConstant %uint 1 + %18 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %16 %17 %18 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 + %23 = OpTypeImage %float 2D 0 0 0 2 Unknown +%_ptr_UniformConstant_23 = OpTypePointer UniformConstant %23 + %26 = OpTypeImage %float 2D 0 0 0 1 Unknown + %27 = OpTypeSampledImage %26 +%_ptr_UniformConstant_26 = OpTypePointer UniformConstant %26 + %30 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_1 = OpConstant %uint 1 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %v2uint = OpTypeVector %uint 2 + %45 = OpUndef %uint + %46 = OpConstantComposite %v2uint %uint_0 %45 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 + %float_0 = OpConstant %float 0 + %uint_2 = OpConstant %uint 2 + %uint_12 = OpConstant %uint 12 + %3 = OpVariable %_ptr_UniformConstant_1 UniformConstant + %13 = OpVariable %_ptr_PushConstant__struct_11 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %21 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %25 = OpVariable %_ptr_UniformConstant_23 UniformConstant + %29 = OpVariable %_ptr_UniformConstant_26 UniformConstant + %31 = OpFunction %void None %30 + %32 = OpLabel + %33 = OpLoad %23 %25 + %34 = OpLoad %26 %29 + %35 = OpLoad %1 %3 + %38 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_1 + %39 = OpLoad %uint %38 + %41 = OpAccessChain %_ptr_PushConstant_uint %13 %uint_0 %uint_1 + %42 = OpLoad %uint %41 + %43 = OpIAdd %uint %42 %39 + %47 = OpCompositeInsert %v2uint %43 %46 1 + %48 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %49 = OpLoad %uint %48 + %50 = OpAccessChain %_ptr_PushConstant_uint %13 %uint_0 %uint_0 + %51 = OpLoad %uint %50 + %52 = OpIAdd %uint %51 %49 + %53 = OpCompositeConstruct %v2uint %52 %43 + %55 = OpConvertSToF %v2float %53 + %56 = OpSampledImage %27 %34 %35 + %59 = OpImageSampleExplicitLod %v4float %56 %55 Lod %float_0 + OpImageWrite %33 %47 %59 + OpReturn + OpFunctionEnd + %71 = OpExtInst %void %4 PushConstantRegionOffset %uint_0 %uint_12 + %9 = OpExtInst %void %4 LiteralSampler %uint_0 %uint_0 %uint_18 + %63 = OpExtInst %void %4 Kernel %31 %60 %uint_2 %uint_0 %61 + %65 = OpExtInst %void %4 ArgumentInfo %64 + %66 = OpExtInst %void %4 ArgumentStorageImage %63 %uint_0 %uint_1 %uint_0 %65 + %68 = OpExtInst %void %4 ArgumentInfo %67 + %69 = OpExtInst %void %4 ArgumentSampledImage %63 %uint_1 %uint_1 %uint_1 %68 + %72 = OpExtInst %void %4 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/imagetests/test2dimagecopy.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/imagetests/test2dimagecopy.spv.dis new file mode 100644 index 0000000000..80d29bca59 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/imagetests/test2dimagecopy.spv.dis @@ -0,0 +1,96 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 70 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageWriteWithoutFormat + %4 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %31 "k" %3 %gl_GlobalInvocationID %21 %25 %29 %13 + OpSource OpenCL_C 200 + %57 = OpString "k" + %58 = OpString " __kernel" + %61 = OpString "dest" + %64 = OpString "src" + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 0 + OpMemberDecorate %_struct_11 0 Offset 0 + OpDecorate %_struct_11 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %25 DescriptorSet 1 + OpDecorate %25 Binding 0 + OpDecorate %29 DescriptorSet 1 + OpDecorate %29 Binding 1 + OpDecorate %16 SpecId 0 + OpDecorate %17 SpecId 1 + OpDecorate %18 SpecId 2 + %1 = OpTypeSampler +%_ptr_UniformConstant_1 = OpTypePointer UniformConstant %1 + %void = OpTypeVoid + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_18 = OpConstant %uint 18 + %v3uint = OpTypeVector %uint 3 + %_struct_11 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_11 = OpTypePointer PushConstant %_struct_11 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %16 = OpSpecConstant %uint 1 + %17 = OpSpecConstant %uint 1 + %18 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %16 %17 %18 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 + %23 = OpTypeImage %float 2D 0 0 0 2 Unknown +%_ptr_UniformConstant_23 = OpTypePointer UniformConstant %23 + %26 = OpTypeImage %float 2D 0 0 0 1 Unknown + %27 = OpTypeSampledImage %26 +%_ptr_UniformConstant_26 = OpTypePointer UniformConstant %26 + %30 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 + %float_0 = OpConstant %float 0 + %v2uint = OpTypeVector %uint 2 + %uint_2 = OpConstant %uint 2 + %uint_12 = OpConstant %uint 12 + %3 = OpVariable %_ptr_UniformConstant_1 UniformConstant + %13 = OpVariable %_ptr_PushConstant__struct_11 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %21 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %25 = OpVariable %_ptr_UniformConstant_23 UniformConstant + %29 = OpVariable %_ptr_UniformConstant_26 UniformConstant + %31 = OpFunction %void None %30 + %32 = OpLabel + %33 = OpLoad %23 %25 + %34 = OpLoad %26 %29 + %35 = OpLoad %1 %3 + %37 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %38 = OpLoad %uint %37 + %40 = OpAccessChain %_ptr_PushConstant_uint %13 %uint_0 %uint_0 + %41 = OpLoad %uint %40 + %42 = OpIAdd %uint %41 %38 + %44 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_1 + %45 = OpLoad %uint %44 + %46 = OpAccessChain %_ptr_PushConstant_uint %13 %uint_0 %uint_1 + %47 = OpLoad %uint %46 + %48 = OpIAdd %uint %47 %45 + %49 = OpCompositeConstruct %v2uint %42 %48 + %51 = OpConvertSToF %v2float %49 + %52 = OpSampledImage %27 %34 %35 + %55 = OpImageSampleExplicitLod %v4float %52 %51 Lod %float_0 + OpImageWrite %33 %49 %55 + OpReturn + OpFunctionEnd + %68 = OpExtInst %void %4 PushConstantRegionOffset %uint_0 %uint_12 + %9 = OpExtInst %void %4 LiteralSampler %uint_0 %uint_0 %uint_18 + %60 = OpExtInst %void %4 Kernel %31 %57 %uint_2 %uint_0 %58 + %62 = OpExtInst %void %4 ArgumentInfo %61 + %63 = OpExtInst %void %4 ArgumentStorageImage %60 %uint_0 %uint_1 %uint_0 %62 + %65 = OpExtInst %void %4 ArgumentInfo %64 + %66 = OpExtInst %void %4 ArgumentSampledImage %60 %uint_1 %uint_1 %uint_1 %65 + %69 = OpExtInst %void %4 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/imagetests/testsampler.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/imagetests/testsampler.spv.dis new file mode 100644 index 0000000000..926675a377 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/imagetests/testsampler.spv.dis @@ -0,0 +1,86 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 64 +; Schema: 0 + OpCapability Shader + %50 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "foo" %gl_GlobalInvocationID %13 %18 %21 %5 + OpSource OpenCL_C 200 + %51 = OpString "foo" + %52 = OpString " __kernel" + %55 = OpString "img" + %58 = OpString "samp" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 1 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 + %15 = OpTypeImage %float 2D 0 0 0 1 Unknown + %16 = OpTypeSampledImage %15 +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %19 = OpTypeSampler +%_ptr_UniformConstant_19 = OpTypePointer UniformConstant %19 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 + %float_0 = OpConstant %float 0 + %v2uint = OpTypeVector %uint 2 + %uint_2 = OpConstant %uint 2 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %21 = OpVariable %_ptr_UniformConstant_19 UniformConstant + %24 = OpFunction %void None %23 + %25 = OpLabel + %26 = OpLoad %15 %18 + %27 = OpLoad %19 %21 + %30 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %31 = OpLoad %uint %30 + %33 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %34 = OpLoad %uint %33 + %35 = OpIAdd %uint %34 %31 + %37 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_1 + %38 = OpLoad %uint %37 + %39 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_1 + %40 = OpLoad %uint %39 + %41 = OpIAdd %uint %40 %38 + %42 = OpCompositeConstruct %v2uint %35 %41 + %44 = OpConvertSToF %v2float %42 + %45 = OpSampledImage %16 %26 %27 + %48 = OpImageSampleExplicitLod %v4float %45 %44 Lod %float_0 + OpReturn + OpFunctionEnd + %62 = OpExtInst %void %50 PushConstantRegionOffset %uint_0 %uint_12 + %54 = OpExtInst %void %50 Kernel %24 %51 %uint_2 %uint_0 %52 + %56 = OpExtInst %void %50 ArgumentInfo %55 + %57 = OpExtInst %void %50 ArgumentSampledImage %54 %uint_0 %uint_0 %uint_0 %56 + %59 = OpExtInst %void %50 ArgumentInfo %58 + %60 = OpExtInst %void %50 ArgumentSampler %54 %uint_1 %uint_0 %uint_1 %59 + %63 = OpExtInst %void %50 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/imagetests/testsampler2.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/imagetests/testsampler2.spv.dis new file mode 100644 index 0000000000..207824b428 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/imagetests/testsampler2.spv.dis @@ -0,0 +1,85 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 63 +; Schema: 0 + OpCapability Shader + %4 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %28 "foo" %3 %gl_GlobalInvocationID %21 %26 %13 + OpSource OpenCL_C 200 + %53 = OpString "foo" + %54 = OpString " __kernel" + %56 = OpString "img" + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 0 + OpMemberDecorate %_struct_11 0 Offset 0 + OpDecorate %_struct_11 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %26 DescriptorSet 1 + OpDecorate %26 Binding 0 + OpDecorate %16 SpecId 0 + OpDecorate %17 SpecId 1 + OpDecorate %18 SpecId 2 + %1 = OpTypeSampler +%_ptr_UniformConstant_1 = OpTypePointer UniformConstant %1 + %void = OpTypeVoid + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_23 = OpConstant %uint 23 + %v3uint = OpTypeVector %uint 3 + %_struct_11 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_11 = OpTypePointer PushConstant %_struct_11 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %16 = OpSpecConstant %uint 1 + %17 = OpSpecConstant %uint 1 + %18 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %16 %17 %18 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 + %23 = OpTypeImage %float 2D 0 0 0 1 Unknown + %24 = OpTypeSampledImage %23 +%_ptr_UniformConstant_23 = OpTypePointer UniformConstant %23 + %27 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 + %float_0 = OpConstant %float 0 + %v2uint = OpTypeVector %uint 2 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %3 = OpVariable %_ptr_UniformConstant_1 UniformConstant + %13 = OpVariable %_ptr_PushConstant__struct_11 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %21 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %26 = OpVariable %_ptr_UniformConstant_23 UniformConstant + %28 = OpFunction %void None %27 + %29 = OpLabel + %30 = OpLoad %23 %26 + %32 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %33 = OpLoad %uint %32 + %35 = OpAccessChain %_ptr_PushConstant_uint %13 %uint_0 %uint_0 + %36 = OpLoad %uint %35 + %37 = OpIAdd %uint %36 %33 + %39 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_1 + %40 = OpLoad %uint %39 + %41 = OpAccessChain %_ptr_PushConstant_uint %13 %uint_0 %uint_1 + %42 = OpLoad %uint %41 + %43 = OpIAdd %uint %42 %40 + %44 = OpCompositeConstruct %v2uint %37 %43 + %45 = OpLoad %1 %3 + %47 = OpConvertSToF %v2float %44 + %48 = OpSampledImage %24 %30 %45 + %51 = OpImageSampleExplicitLod %v4float %48 %47 Lod %float_0 + OpReturn + OpFunctionEnd + %60 = OpExtInst %void %4 PushConstantRegionOffset %uint_0 %uint_12 + %9 = OpExtInst %void %4 LiteralSampler %uint_0 %uint_0 %uint_23 + %55 = OpExtInst %void %4 Kernel %28 %53 %uint_1 %uint_0 %54 + %57 = OpExtInst %void %4 ArgumentInfo %56 + %58 = OpExtInst %void %4 ArgumentSampledImage %55 %uint_0 %uint_1 %uint_0 %57 + %62 = OpExtInst %void %4 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/induction_variable.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/induction_variable.spv.dis new file mode 100644 index 0000000000..ac11046675 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/induction_variable.spv.dis @@ -0,0 +1,116 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 89 +; Schema: 0 + OpCapability Shader + %77 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %8 %gl_LocalInvocationID %14 + OpSource OpenCL_C 200 + %78 = OpString "foo" + %79 = OpString " __kernel" + %82 = OpString "data" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %11 SpecId 3 + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %22 = OpLoad %uint %21 + %24 = OpAccessChain %_ptr_Workgroup_uint %14 %22 + OpStore %24 %22 + %25 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %26 = OpCompositeExtract %uint %25 0 + %27 = OpIAdd %uint %26 %22 + %28 = OpAccessChain %_ptr_Workgroup_uint %14 %27 + OpStore %28 %22 + %29 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %30 = OpCompositeExtract %uint %29 0 + %31 = OpIAdd %uint %30 %26 + %32 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %31 %33 + %35 = OpAccessChain %_ptr_Workgroup_uint %14 %34 + OpStore %35 %33 + %36 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %37 = OpCompositeExtract %uint %36 0 + %38 = OpIAdd %uint %37 %31 + %39 = OpIAdd %uint %38 %33 + %40 = OpAccessChain %_ptr_Workgroup_uint %14 %39 + OpStore %40 %33 + %41 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %42 = OpCompositeExtract %uint %41 0 + %43 = OpIAdd %uint %42 %38 + %44 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %45 = OpLoad %uint %44 + %46 = OpIAdd %uint %43 %45 + %47 = OpAccessChain %_ptr_Workgroup_uint %14 %46 + OpStore %47 %45 + %48 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %49 = OpCompositeExtract %uint %48 0 + %50 = OpIAdd %uint %49 %43 + %51 = OpIAdd %uint %50 %45 + %52 = OpAccessChain %_ptr_Workgroup_uint %14 %51 + OpStore %52 %45 + %53 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %54 = OpCompositeExtract %uint %53 0 + %55 = OpIAdd %uint %54 %50 + %56 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %57 = OpLoad %uint %56 + %58 = OpIAdd %uint %55 %57 + %59 = OpAccessChain %_ptr_Workgroup_uint %14 %58 + OpStore %59 %57 + %60 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %61 = OpCompositeExtract %uint %60 0 + %62 = OpIAdd %uint %61 %55 + %63 = OpIAdd %uint %62 %57 + %64 = OpAccessChain %_ptr_Workgroup_uint %14 %63 + OpStore %64 %57 + %65 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %66 = OpCompositeExtract %uint %65 0 + %67 = OpIAdd %uint %66 %62 + %68 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %69 = OpLoad %uint %68 + %70 = OpIAdd %uint %67 %69 + %71 = OpAccessChain %_ptr_Workgroup_uint %14 %70 + OpStore %71 %69 + %72 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %73 = OpCompositeExtract %uint %72 0 + %74 = OpIAdd %uint %73 %67 + %75 = OpIAdd %uint %74 %69 + %76 = OpAccessChain %_ptr_Workgroup_uint %14 %75 + OpStore %76 %69 + OpReturn + OpFunctionEnd + %81 = OpExtInst %void %77 Kernel %17 %78 %uint_1 %uint_0 %79 + %83 = OpExtInst %void %77 ArgumentInfo %82 + %86 = OpExtInst %void %77 ArgumentWorkgroup %81 %uint_0 %uint_3 %uint_4 %83 + %88 = OpExtInst %void %77 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/bad_read_then_write.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/bad_read_then_write.spv.dis new file mode 100644 index 0000000000..4857d7e22d --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/bad_read_then_write.spv.dis @@ -0,0 +1,89 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 68 +; Schema: 0 + OpCapability Shader + %58 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %59 = OpString "foo" + %60 = OpString " __kernel" + %62 = OpString "p" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %uint_8 = OpConstant %uint 8 + %uint_256 = OpConstant %uint 256 + %uint_5 = OpConstant %uint 5 + %uint_64 = OpConstant %uint 64 + %uint_9 = OpConstant %uint 9 + %uint_2048 = OpConstant %uint 2048 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %20 = OpVariable %_ptr_Function_uint Function + %21 = OpVariable %_ptr_Function_uint Function + %24 = OpAccessChain %_ptr_Workgroup_uint %14 %uint_0 + %26 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %27 = OpLoad %uint %26 + %29 = OpIEqual %bool %27 %uint_0 + %31 = OpSelect %uint %29 %uint_1 %uint_0 + OpStore %20 %31 + %32 = OpLoad %uint %24 + OpStore %21 %32 + %33 = OpLoad %uint %20 + %35 = OpShiftLeftLogical %uint %33 %uint_8 + %37 = OpBitwiseAnd %uint %35 %uint_256 + %39 = OpShiftLeftLogical %uint %33 %uint_5 + %41 = OpBitwiseAnd %uint %39 %uint_64 + %43 = OpShiftLeftLogical %uint %33 %uint_9 + %45 = OpBitwiseAnd %uint %43 %uint_2048 + %46 = OpBitwiseOr %uint %45 %41 + %47 = OpBitwiseOr %uint %46 %37 + %48 = OpBitwiseOr %uint %47 %uint_8 + OpControlBarrier %uint_2 %uint_2 %48 + %50 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %51 = OpLoad %uint %50 + %52 = OpIEqual %bool %51 %uint_1 + OpSelectionMerge %57 None + OpBranchConditional %52 %55 %57 + %55 = OpLabel + OpStore %24 %uint_0 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd + %61 = OpExtInst %void %58 Kernel %17 %59 %uint_1 %uint_0 %60 + %63 = OpExtInst %void %58 ArgumentInfo %62 + %66 = OpExtInst %void %58 ArgumentWorkgroup %61 %uint_0 %uint_3 %uint_4 %63 + %67 = OpExtInst %void %58 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/bad_write_then_read.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/bad_write_then_read.spv.dis new file mode 100644 index 0000000000..68d70331a3 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/bad_write_then_read.spv.dis @@ -0,0 +1,95 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 74 +; Schema: 0 + OpCapability Shader + %64 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %65 = OpString "foo" + %66 = OpString " __kernel" + %68 = OpString "p" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %uint_8 = OpConstant %uint 8 + %uint_256 = OpConstant %uint 256 + %uint_5 = OpConstant %uint 5 + %uint_64 = OpConstant %uint 64 + %uint_9 = OpConstant %uint 9 + %uint_2048 = OpConstant %uint 2048 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %20 = OpVariable %_ptr_Function_uint Function + %21 = OpVariable %_ptr_Function_uint Function + %24 = OpAccessChain %_ptr_Workgroup_uint %14 %uint_0 + %26 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %27 = OpLoad %uint %26 + %29 = OpINotEqual %bool %27 %uint_0 + %31 = OpSelect %uint %29 %uint_1 %uint_0 + OpStore %20 %31 + %32 = OpIEqual %bool %27 %uint_0 + OpSelectionMerge %37 None + OpBranchConditional %32 %35 %37 + %35 = OpLabel + OpStore %24 %uint_0 + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %uint %20 + %40 = OpShiftLeftLogical %uint %38 %uint_8 + %42 = OpBitwiseAnd %uint %40 %uint_256 + %44 = OpShiftLeftLogical %uint %38 %uint_5 + %46 = OpBitwiseAnd %uint %44 %uint_64 + %48 = OpShiftLeftLogical %uint %38 %uint_9 + %50 = OpBitwiseAnd %uint %48 %uint_2048 + %51 = OpBitwiseOr %uint %50 %46 + %52 = OpBitwiseOr %uint %51 %42 + %53 = OpBitwiseOr %uint %52 %uint_8 + OpControlBarrier %uint_2 %uint_2 %53 + %55 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %56 = OpLoad %uint %55 + %57 = OpIEqual %bool %56 %uint_1 + OpSelectionMerge %63 None + OpBranchConditional %57 %60 %63 + %60 = OpLabel + %61 = OpLoad %uint %24 + OpStore %21 %61 + OpBranch %63 + %63 = OpLabel + OpReturn + OpFunctionEnd + %67 = OpExtInst %void %64 Kernel %17 %65 %uint_1 %uint_0 %66 + %69 = OpExtInst %void %64 ArgumentInfo %68 + %72 = OpExtInst %void %64 ArgumentWorkgroup %67 %uint_0 %uint_3 %uint_4 %69 + %73 = OpExtInst %void %64 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/local_id.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/local_id.spv.dis new file mode 100644 index 0000000000..dd4f93db6e --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/local_id.spv.dis @@ -0,0 +1,73 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + %35 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_LocalInvocationID %gl_WorkGroupID %14 %18 %5 + OpSource OpenCL_C 200 + %36 = OpString "foo" + %37 = OpString " __kernel" + %40 = OpString "p" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %9 SpecId 0 + OpDecorate %10 SpecId 1 + OpDecorate %11 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %9 %10 %11 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %26 + %31 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %32 = OpLoad %uint %31 + %34 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %32 + OpStore %34 %30 + OpReturn + OpFunctionEnd + %44 = OpExtInst %void %35 PushConstantRegionGroupOffset %uint_0 %uint_12 + %39 = OpExtInst %void %35 Kernel %21 %36 %uint_1 %uint_0 %37 + %41 = OpExtInst %void %35 ArgumentInfo %40 + %42 = OpExtInst %void %35 ArgumentStorageBuffer %39 %uint_0 %uint_0 %uint_0 %41 + %46 = OpExtInst %void %35 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/missing_global_barrier_flag.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/missing_global_barrier_flag.spv.dis new file mode 100644 index 0000000000..d86b94cc70 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/missing_global_barrier_flag.spv.dis @@ -0,0 +1,96 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 68 +; Schema: 0 + OpCapability Shader + %58 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %13 %gl_LocalInvocationID %18 %5 + OpSource OpenCL_C 200 + %59 = OpString "foo" + %60 = OpString " __kernel" + %62 = OpString "p" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 +%uint_4294967295 = OpConstant %uint 4294967295 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %26 + %31 = OpIAdd %uint %26 %29 + %33 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %31 + OpStore %33 %30 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %36 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %37 = OpLoad %uint %36 + %38 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %39 = OpCompositeExtract %uint %38 0 + %41 = OpIAdd %uint %39 %uint_4294967295 + %43 = OpULessThan %bool %37 %41 + OpSelectionMerge %57 None + OpBranchConditional %43 %46 %57 + %46 = OpLabel + %47 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %48 = OpLoad %uint %47 + %49 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %50 = OpLoad %uint %49 + %51 = OpIAdd %uint %50 %48 + %52 = OpIAdd %uint %48 %50 + %54 = OpIAdd %uint %52 %uint_1 + %55 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %54 + OpStore %55 %51 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd + %66 = OpExtInst %void %58 PushConstantRegionOffset %uint_0 %uint_12 + %61 = OpExtInst %void %58 Kernel %21 %59 %uint_1 %uint_0 %60 + %63 = OpExtInst %void %58 ArgumentInfo %62 + %64 = OpExtInst %void %58 ArgumentStorageBuffer %61 %uint_0 %uint_0 %uint_0 %63 + %67 = OpExtInst %void %58 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/missing_local_barrier_flag.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/missing_local_barrier_flag.spv.dis new file mode 100644 index 0000000000..0c7ed7cd51 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/missing_local_barrier_flag.spv.dis @@ -0,0 +1,82 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %47 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %gl_LocalInvocationID %14 %18 %5 + OpSource OpenCL_C 200 + %48 = OpString "foo" + %49 = OpString " __kernel" + %51 = OpString "p" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %15 SpecId 3 + OpDecorate %9 SpecId 0 + OpDecorate %10 SpecId 1 + OpDecorate %11 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %9 %10 %11 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %15 = OpSpecConstant %uint 1 +%_arr_uint_15 = OpTypeArray %uint %15 +%_ptr_Workgroup__arr_uint_15 = OpTypePointer Workgroup %_arr_uint_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_2 = OpConstant %uint 2 + %uint_72 = OpConstant %uint 72 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_Workgroup__arr_uint_15 Workgroup + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %26 + %31 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %32 = OpLoad %uint %31 + %34 = OpAccessChain %_ptr_Workgroup_uint %18 %32 + OpStore %34 %30 + OpControlBarrier %uint_2 %uint_2 %uint_72 + %37 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %38 = OpLoad %uint %37 + %39 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %40 = OpLoad %uint %39 + %41 = OpIAdd %uint %40 %38 + %42 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %43 = OpLoad %uint %42 + %45 = OpIAdd %uint %43 %uint_1 + %46 = OpAccessChain %_ptr_Workgroup_uint %18 %45 + OpStore %46 %41 + OpReturn + OpFunctionEnd + %57 = OpExtInst %void %47 PushConstantRegionOffset %uint_0 %uint_12 + %50 = OpExtInst %void %47 Kernel %21 %48 %uint_1 %uint_0 %49 + %52 = OpExtInst %void %47 ArgumentInfo %51 + %55 = OpExtInst %void %47 ArgumentWorkgroup %50 %uint_0 %uint_3 %uint_4 %52 + %58 = OpExtInst %void %47 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/no_barrier_flags.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/no_barrier_flags.spv.dis new file mode 100644 index 0000000000..cacadc19f0 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/no_barrier_flags.spv.dis @@ -0,0 +1,82 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %47 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %gl_LocalInvocationID %14 %18 %5 + OpSource OpenCL_C 200 + %48 = OpString "foo" + %49 = OpString " __kernel" + %51 = OpString "p" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %15 SpecId 3 + OpDecorate %9 SpecId 0 + OpDecorate %10 SpecId 1 + OpDecorate %11 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %9 %10 %11 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %15 = OpSpecConstant %uint 1 +%_arr_uint_15 = OpTypeArray %uint %15 +%_ptr_Workgroup__arr_uint_15 = OpTypePointer Workgroup %_arr_uint_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_2 = OpConstant %uint 2 + %uint_8 = OpConstant %uint 8 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_Workgroup__arr_uint_15 Workgroup + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %26 + %31 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %32 = OpLoad %uint %31 + %34 = OpAccessChain %_ptr_Workgroup_uint %18 %32 + OpStore %34 %30 + OpControlBarrier %uint_2 %uint_2 %uint_8 + %37 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %38 = OpLoad %uint %37 + %39 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %40 = OpLoad %uint %39 + %41 = OpIAdd %uint %40 %38 + %42 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %43 = OpLoad %uint %42 + %45 = OpIAdd %uint %43 %uint_1 + %46 = OpAccessChain %_ptr_Workgroup_uint %18 %45 + OpStore %46 %41 + OpReturn + OpFunctionEnd + %57 = OpExtInst %void %47 PushConstantRegionOffset %uint_0 %uint_12 + %50 = OpExtInst %void %47 Kernel %21 %48 %uint_1 %uint_0 %49 + %52 = OpExtInst %void %47 ArgumentInfo %51 + %55 = OpExtInst %void %47 ArgumentWorkgroup %50 %uint_0 %uint_3 %uint_4 %52 + %58 = OpExtInst %void %47 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/sync.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/sync.spv.dis new file mode 100644 index 0000000000..e922f851ce --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/sync.spv.dis @@ -0,0 +1,81 @@ +; @Input: %17 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 54 +; Schema: 0 + OpCapability Shader + %44 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %20 "foo" %gl_GlobalInvocationID %13 %17 %5 + OpSource OpenCL_C 200 + %45 = OpString "foo" + %46 = OpString " __kernel" + %48 = OpString "p" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_2 = OpConstant %uint 2 + %uint_72 = OpConstant %uint 72 + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %20 = OpFunction %void None %19 + %21 = OpLabel + %24 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %25 = OpLoad %uint %24 + %27 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %28 = OpLoad %uint %27 + %29 = OpIAdd %uint %28 %25 + %30 = OpIAdd %uint %25 %28 + %32 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %30 + OpStore %32 %29 + OpControlBarrier %uint_2 %uint_2 %uint_72 + %35 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %37 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %38 = OpLoad %uint %37 + %39 = OpIAdd %uint %38 %36 + %40 = OpIAdd %uint %36 %38 + %42 = OpIAdd %uint %40 %uint_1 + %43 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %42 + OpStore %43 %39 + OpReturn + OpFunctionEnd + %52 = OpExtInst %void %44 PushConstantRegionOffset %uint_0 %uint_12 + %47 = OpExtInst %void %44 Kernel %20 %45 %uint_1 %uint_0 %46 + %49 = OpExtInst %void %44 ArgumentInfo %48 + %50 = OpExtInst %void %44 ArgumentStorageBuffer %47 %uint_0 %uint_0 %uint_0 %49 + %53 = OpExtInst %void %44 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/sync_within_group_wrong_flag.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/sync_within_group_wrong_flag.spv.dis new file mode 100644 index 0000000000..d86b94cc70 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/fail/sync_within_group_wrong_flag.spv.dis @@ -0,0 +1,96 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 68 +; Schema: 0 + OpCapability Shader + %58 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %13 %gl_LocalInvocationID %18 %5 + OpSource OpenCL_C 200 + %59 = OpString "foo" + %60 = OpString " __kernel" + %62 = OpString "p" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 +%uint_4294967295 = OpConstant %uint 4294967295 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %26 + %31 = OpIAdd %uint %26 %29 + %33 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %31 + OpStore %33 %30 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %36 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %37 = OpLoad %uint %36 + %38 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %39 = OpCompositeExtract %uint %38 0 + %41 = OpIAdd %uint %39 %uint_4294967295 + %43 = OpULessThan %bool %37 %41 + OpSelectionMerge %57 None + OpBranchConditional %43 %46 %57 + %46 = OpLabel + %47 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %48 = OpLoad %uint %47 + %49 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %50 = OpLoad %uint %49 + %51 = OpIAdd %uint %50 %48 + %52 = OpIAdd %uint %48 %50 + %54 = OpIAdd %uint %52 %uint_1 + %55 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %54 + OpStore %55 %51 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd + %66 = OpExtInst %void %58 PushConstantRegionOffset %uint_0 %uint_12 + %61 = OpExtInst %void %58 Kernel %21 %59 %uint_1 %uint_0 %60 + %63 = OpExtInst %void %58 ArgumentInfo %62 + %64 = OpExtInst %void %58 ArgumentStorageBuffer %61 %uint_0 %uint_0 %uint_0 %63 + %67 = OpExtInst %void %58 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/pass/global_barrier.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/pass/global_barrier.spv.dis new file mode 100644 index 0000000000..eadd7d0a4c --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/pass/global_barrier.spv.dis @@ -0,0 +1,96 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 68 +; Schema: 0 + OpCapability Shader + %58 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %13 %gl_LocalInvocationID %18 %5 + OpSource OpenCL_C 200 + %59 = OpString "foo" + %60 = OpString " __kernel" + %62 = OpString "p" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_2 = OpConstant %uint 2 + %uint_72 = OpConstant %uint 72 +%uint_4294967295 = OpConstant %uint 4294967295 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %26 + %31 = OpIAdd %uint %26 %29 + %33 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %31 + OpStore %33 %30 + OpControlBarrier %uint_2 %uint_2 %uint_72 + %36 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %37 = OpLoad %uint %36 + %38 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %39 = OpCompositeExtract %uint %38 0 + %41 = OpIAdd %uint %39 %uint_4294967295 + %43 = OpULessThan %bool %37 %41 + OpSelectionMerge %57 None + OpBranchConditional %43 %46 %57 + %46 = OpLabel + %47 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %48 = OpLoad %uint %47 + %49 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %50 = OpLoad %uint %49 + %51 = OpIAdd %uint %50 %48 + %52 = OpIAdd %uint %48 %50 + %54 = OpIAdd %uint %52 %uint_1 + %55 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %54 + OpStore %55 %51 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd + %66 = OpExtInst %void %58 PushConstantRegionOffset %uint_0 %uint_12 + %61 = OpExtInst %void %58 Kernel %21 %59 %uint_1 %uint_0 %60 + %63 = OpExtInst %void %58 ArgumentInfo %62 + %64 = OpExtInst %void %58 ArgumentStorageBuffer %61 %uint_0 %uint_0 %uint_0 %63 + %67 = OpExtInst %void %58 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/pass/local_barrier_flag.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/pass/local_barrier_flag.spv.dis new file mode 100644 index 0000000000..e4bd89d90e --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/pass/local_barrier_flag.spv.dis @@ -0,0 +1,82 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %47 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %gl_LocalInvocationID %14 %18 %5 + OpSource OpenCL_C 200 + %48 = OpString "foo" + %49 = OpString " __kernel" + %51 = OpString "p" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %15 SpecId 3 + OpDecorate %9 SpecId 0 + OpDecorate %10 SpecId 1 + OpDecorate %11 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %9 %10 %11 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %15 = OpSpecConstant %uint 1 +%_arr_uint_15 = OpTypeArray %uint %15 +%_ptr_Workgroup__arr_uint_15 = OpTypePointer Workgroup %_arr_uint_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_Workgroup__arr_uint_15 Workgroup + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %26 + %31 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %32 = OpLoad %uint %31 + %34 = OpAccessChain %_ptr_Workgroup_uint %18 %32 + OpStore %34 %30 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %37 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %38 = OpLoad %uint %37 + %39 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %40 = OpLoad %uint %39 + %41 = OpIAdd %uint %40 %38 + %42 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %43 = OpLoad %uint %42 + %45 = OpIAdd %uint %43 %uint_1 + %46 = OpAccessChain %_ptr_Workgroup_uint %18 %45 + OpStore %46 %41 + OpReturn + OpFunctionEnd + %57 = OpExtInst %void %47 PushConstantRegionOffset %uint_0 %uint_12 + %50 = OpExtInst %void %47 Kernel %21 %48 %uint_1 %uint_0 %49 + %52 = OpExtInst %void %47 ArgumentInfo %51 + %55 = OpExtInst %void %47 ArgumentWorkgroup %50 %uint_0 %uint_3 %uint_4 %52 + %58 = OpExtInst %void %47 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/pass/local_id_benign_write_write.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/pass/local_id_benign_write_write.spv.dis new file mode 100644 index 0000000000..55f01e7f24 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/pass/local_id_benign_write_write.spv.dis @@ -0,0 +1,58 @@ +; @Input: %14 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %25 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %26 = OpString "foo" + %27 = OpString " __kernel" + %30 = OpString "p" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_12 0 Offset 0 + OpDecorate %_struct_12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_12 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_12 = OpTypePointer StorageBuffer %_struct_12 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %22 = OpLoad %uint %21 + %24 = OpAccessChain %_ptr_StorageBuffer_uint %14 %uint_0 %22 + OpStore %24 %22 + OpReturn + OpFunctionEnd + %29 = OpExtInst %void %25 Kernel %17 %26 %uint_1 %uint_0 %27 + %31 = OpExtInst %void %25 ArgumentInfo %30 + %32 = OpExtInst %void %25 ArgumentStorageBuffer %29 %uint_0 %uint_0 %uint_0 %31 + %34 = OpExtInst %void %25 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/pass/pass_due_to_intra_group_flag.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/pass/pass_due_to_intra_group_flag.spv.dis new file mode 100644 index 0000000000..ab0ae83eb9 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/pass/pass_due_to_intra_group_flag.spv.dis @@ -0,0 +1,73 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + %35 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %gl_LocalInvocationID %14 %18 %5 + OpSource OpenCL_C 200 + %36 = OpString "foo" + %37 = OpString " __kernel" + %40 = OpString "p" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %9 SpecId 0 + OpDecorate %10 SpecId 1 + OpDecorate %11 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %9 %10 %11 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %26 + %31 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %32 = OpLoad %uint %31 + %34 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %32 + OpStore %34 %30 + OpReturn + OpFunctionEnd + %44 = OpExtInst %void %35 PushConstantRegionOffset %uint_0 %uint_12 + %39 = OpExtInst %void %35 Kernel %21 %36 %uint_1 %uint_0 %37 + %41 = OpExtInst %void %35 ArgumentInfo %40 + %42 = OpExtInst %void %35 ArgumentStorageBuffer %39 %uint_0 %uint_0 %uint_0 %41 + %46 = OpExtInst %void %35 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/pass/read_then_write.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/pass/read_then_write.spv.dis new file mode 100644 index 0000000000..df403ac10e --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/pass/read_then_write.spv.dis @@ -0,0 +1,94 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 73 +; Schema: 0 + OpCapability Shader + %63 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %64 = OpString "foo" + %65 = OpString " __kernel" + %67 = OpString "p" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %uint_8 = OpConstant %uint 8 + %uint_256 = OpConstant %uint 256 + %uint_5 = OpConstant %uint 5 + %uint_64 = OpConstant %uint 64 + %uint_9 = OpConstant %uint 9 + %uint_2048 = OpConstant %uint 2048 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %20 = OpVariable %_ptr_Function_uint Function + %21 = OpVariable %_ptr_Function_uint Function + %24 = OpAccessChain %_ptr_Workgroup_uint %14 %uint_0 + %26 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %27 = OpLoad %uint %26 + %29 = OpIEqual %bool %27 %uint_0 + %31 = OpSelect %uint %29 %uint_1 %uint_0 + OpStore %20 %31 + OpSelectionMerge %37 None + OpBranchConditional %29 %34 %37 + %34 = OpLabel + %35 = OpLoad %uint %24 + OpStore %21 %35 + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %uint %20 + %40 = OpShiftLeftLogical %uint %38 %uint_8 + %42 = OpBitwiseAnd %uint %40 %uint_256 + %44 = OpShiftLeftLogical %uint %38 %uint_5 + %46 = OpBitwiseAnd %uint %44 %uint_64 + %48 = OpShiftLeftLogical %uint %38 %uint_9 + %50 = OpBitwiseAnd %uint %48 %uint_2048 + %51 = OpBitwiseOr %uint %50 %46 + %52 = OpBitwiseOr %uint %51 %42 + %53 = OpBitwiseOr %uint %52 %uint_8 + OpControlBarrier %uint_2 %uint_2 %53 + %55 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %56 = OpLoad %uint %55 + %57 = OpIEqual %bool %56 %uint_1 + OpSelectionMerge %62 None + OpBranchConditional %57 %60 %62 + %60 = OpLabel + OpStore %24 %uint_0 + OpBranch %62 + %62 = OpLabel + OpReturn + OpFunctionEnd + %66 = OpExtInst %void %63 Kernel %17 %64 %uint_1 %uint_0 %65 + %68 = OpExtInst %void %63 ArgumentInfo %67 + %71 = OpExtInst %void %63 ArgumentWorkgroup %66 %uint_0 %uint_3 %uint_4 %68 + %72 = OpExtInst %void %63 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/pass/sync_within_group.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/pass/sync_within_group.spv.dis new file mode 100644 index 0000000000..eadd7d0a4c --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/pass/sync_within_group.spv.dis @@ -0,0 +1,96 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 68 +; Schema: 0 + OpCapability Shader + %58 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %13 %gl_LocalInvocationID %18 %5 + OpSource OpenCL_C 200 + %59 = OpString "foo" + %60 = OpString " __kernel" + %62 = OpString "p" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_2 = OpConstant %uint 2 + %uint_72 = OpConstant %uint 72 +%uint_4294967295 = OpConstant %uint 4294967295 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %26 + %31 = OpIAdd %uint %26 %29 + %33 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %31 + OpStore %33 %30 + OpControlBarrier %uint_2 %uint_2 %uint_72 + %36 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %37 = OpLoad %uint %36 + %38 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %39 = OpCompositeExtract %uint %38 0 + %41 = OpIAdd %uint %39 %uint_4294967295 + %43 = OpULessThan %bool %37 %41 + OpSelectionMerge %57 None + OpBranchConditional %43 %46 %57 + %46 = OpLabel + %47 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %48 = OpLoad %uint %47 + %49 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %50 = OpLoad %uint %49 + %51 = OpIAdd %uint %50 %48 + %52 = OpIAdd %uint %48 %50 + %54 = OpIAdd %uint %52 %uint_1 + %55 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %54 + OpStore %55 %51 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd + %66 = OpExtInst %void %58 PushConstantRegionOffset %uint_0 %uint_12 + %61 = OpExtInst %void %58 Kernel %21 %59 %uint_1 %uint_0 %60 + %63 = OpExtInst %void %58 ArgumentInfo %62 + %64 = OpExtInst %void %58 ArgumentStorageBuffer %61 %uint_0 %uint_0 %uint_0 %63 + %67 = OpExtInst %void %58 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/pass/write_then_read.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/pass/write_then_read.spv.dis new file mode 100644 index 0000000000..d88bf51992 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/inter_group_and_barrier_flag_tests/pass/write_then_read.spv.dis @@ -0,0 +1,94 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 73 +; Schema: 0 + OpCapability Shader + %63 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %64 = OpString "foo" + %65 = OpString " __kernel" + %67 = OpString "p" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %uint_8 = OpConstant %uint 8 + %uint_256 = OpConstant %uint 256 + %uint_5 = OpConstant %uint 5 + %uint_64 = OpConstant %uint 64 + %uint_9 = OpConstant %uint 9 + %uint_2048 = OpConstant %uint 2048 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %20 = OpVariable %_ptr_Function_uint Function + %21 = OpVariable %_ptr_Function_uint Function + %24 = OpAccessChain %_ptr_Workgroup_uint %14 %uint_0 + %26 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %27 = OpLoad %uint %26 + %29 = OpIEqual %bool %27 %uint_0 + %31 = OpSelect %uint %29 %uint_1 %uint_0 + OpStore %20 %31 + OpSelectionMerge %36 None + OpBranchConditional %29 %34 %36 + %34 = OpLabel + OpStore %24 %uint_0 + OpBranch %36 + %36 = OpLabel + %37 = OpLoad %uint %20 + %39 = OpShiftLeftLogical %uint %37 %uint_8 + %41 = OpBitwiseAnd %uint %39 %uint_256 + %43 = OpShiftLeftLogical %uint %37 %uint_5 + %45 = OpBitwiseAnd %uint %43 %uint_64 + %47 = OpShiftLeftLogical %uint %37 %uint_9 + %49 = OpBitwiseAnd %uint %47 %uint_2048 + %50 = OpBitwiseOr %uint %49 %45 + %51 = OpBitwiseOr %uint %50 %41 + %52 = OpBitwiseOr %uint %51 %uint_8 + OpControlBarrier %uint_2 %uint_2 %52 + %54 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %55 = OpLoad %uint %54 + %56 = OpIEqual %bool %55 %uint_1 + OpSelectionMerge %62 None + OpBranchConditional %56 %59 %62 + %59 = OpLabel + %60 = OpLoad %uint %24 + OpStore %21 %60 + OpBranch %62 + %62 = OpLabel + OpReturn + OpFunctionEnd + %66 = OpExtInst %void %63 Kernel %17 %64 %uint_1 %uint_0 %65 + %68 = OpExtInst %void %63 ArgumentInfo %67 + %71 = OpExtInst %void %63 ArgumentWorkgroup %66 %uint_0 %uint_3 %uint_4 %68 + %72 = OpExtInst %void %63 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/k-induction/amazingreduction.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/k-induction/amazingreduction.spv.dis new file mode 100644 index 0000000000..bb95f050ca --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/k-induction/amazingreduction.spv.dis @@ -0,0 +1,92 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 72 +; Schema: 0 + OpCapability Shader + %63 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %8 %gl_LocalInvocationID %14 + OpSource OpenCL_C 200 + %64 = OpString "foo" + %65 = OpString " __kernel" + %67 = OpString "p" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %11 SpecId 3 + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 + %uint_264 = OpConstant %uint 264 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_4 = OpConstant %uint 4 + %uint_3 = OpConstant %uint 3 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Workgroup_uint %14 %uint_0 + %22 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %23 = OpCompositeExtract %uint %22 0 + %26 = OpUGreaterThanEqual %bool %23 %uint_2 + OpSelectionMerge %54 None + OpBranchConditional %26 %29 %54 + %29 = OpLabel + %30 = OpPhi %uint %32 %48 %23 %18 + %32 = OpShiftRightLogical %uint %30 %uint_1 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %37 = OpULessThan %bool %36 %32 + OpLoopMerge %52 %48 None + OpBranchConditional %37 %40 %48 + %40 = OpLabel + %41 = OpAccessChain %_ptr_Workgroup_uint %14 %36 + %42 = OpIAdd %uint %36 %32 + %43 = OpAccessChain %_ptr_Workgroup_uint %14 %42 + %44 = OpLoad %uint %43 + %45 = OpLoad %uint %41 + %46 = OpIAdd %uint %45 %44 + OpStore %41 %46 + OpBranch %48 + %48 = OpLabel + %50 = OpULessThan %bool %30 %uint_4 + OpBranchConditional %50 %52 %29 + %52 = OpLabel + OpBranch %54 + %54 = OpLabel + %55 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %56 = OpLoad %uint %55 + %57 = OpIEqual %bool %56 %uint_0 + OpSelectionMerge %62 None + OpBranchConditional %57 %60 %62 + %60 = OpLabel + OpStore %21 %uint_0 + OpBranch %62 + %62 = OpLabel + OpReturn + OpFunctionEnd + %66 = OpExtInst %void %63 Kernel %17 %64 %uint_1 %uint_0 %65 + %68 = OpExtInst %void %63 ArgumentInfo %67 + %70 = OpExtInst %void %63 ArgumentWorkgroup %66 %uint_0 %uint_3 %uint_4 %68 + %71 = OpExtInst %void %63 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/leftshiftequals.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/leftshiftequals.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/leftshiftequals.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/localarrayaccess.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/localarrayaccess.spv.dis new file mode 100644 index 0000000000..88feba962e --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/localarrayaccess.spv.dis @@ -0,0 +1,41 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %13 "foo" %gl_LocalInvocationID %10 + OpSource OpenCL_C 200 + %18 = OpString "foo" + %19 = OpString " __kernel" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %13 = OpFunction %void None %12 + %14 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpReturn + OpFunctionEnd + %21 = OpExtInst %void %17 Kernel %13 %18 %uint_0 %uint_0 %19 + %23 = OpExtInst %void %17 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/localmultidimarraydecl.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/localmultidimarraydecl.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/localmultidimarraydecl.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/mem_fence.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/mem_fence.spv.dis new file mode 100644 index 0000000000..256c118aa2 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/mem_fence.spv.dis @@ -0,0 +1,41 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %17 = OpString "foo" + %18 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_8 = OpConstant %uint 8 + %uint_4 = OpConstant %uint 4 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void None %10 + %12 = OpLabel + OpMemoryBarrier %uint_2 %uint_8 + OpMemoryBarrier %uint_2 %uint_2 + OpMemoryBarrier %uint_2 %uint_4 + OpReturn + OpFunctionEnd + %20 = OpExtInst %void %16 Kernel %11 %17 %uint_0 %uint_0 %18 + %22 = OpExtInst %void %16 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/2d_array_race.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/2d_array_race.spv.dis new file mode 100644 index 0000000000..182fb0bc7e --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/2d_array_race.spv.dis @@ -0,0 +1,106 @@ +; @Input: %23 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 77 +; Schema: 0 + OpCapability Shader + %64 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %26 "example" %6 %gl_GlobalInvocationID %gl_LocalInvocationID %19 %23 %10 + OpSource OpenCL_C 200 + %65 = OpString "example" + %66 = OpString " kernel" + %68 = OpString "G" + OpMemberDecorate %_struct_8 0 Offset 0 + OpMemberDecorate %_struct_8 1 Offset 16 + OpDecorate %_struct_8 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_21 0 Offset 0 + OpDecorate %_struct_21 Block + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 0 + OpDecorate %14 SpecId 0 + OpDecorate %15 SpecId 1 + OpDecorate %16 SpecId 2 + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_uint_uint_64 = OpTypeArray %uint %uint_64 +%_arr__arr_uint_uint_64_uint_64 = OpTypeArray %_arr_uint_uint_64 %uint_64 +%_ptr_Workgroup__arr__arr_uint_uint_64_uint_64 = OpTypePointer Workgroup %_arr__arr_uint_uint_64_uint_64 + %v3uint = OpTypeVector %uint 3 + %_struct_8 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_8 = OpTypePointer PushConstant %_struct_8 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %14 = OpSpecConstant %uint 1 + %15 = OpSpecConstant %uint 1 + %16 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %14 %15 %16 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_21 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_21 = OpTypePointer StorageBuffer %_struct_21 + %void = OpTypeVoid + %25 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_1 = OpConstant %uint 1 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %uint_2 = OpConstant %uint 2 + %6 = OpVariable %_ptr_Workgroup__arr__arr_uint_uint_64_uint_64 Workgroup + %10 = OpVariable %_ptr_PushConstant__struct_8 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %19 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %23 = OpVariable %_ptr_StorageBuffer__struct_21 StorageBuffer + %26 = OpFunction %void None %25 + %27 = OpLabel + %30 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_1 + %31 = OpLoad %uint %30 + %33 = OpAccessChain %_ptr_PushConstant_uint %10 %uint_1 %uint_1 + %34 = OpLoad %uint %33 + %35 = OpIAdd %uint %34 %31 + %37 = OpAccessChain %_ptr_PushConstant_uint %10 %uint_0 %uint_1 + %38 = OpLoad %uint %37 + %39 = OpIMul %uint %38 %35 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %42 = OpAccessChain %_ptr_PushConstant_uint %10 %uint_1 %uint_0 + %43 = OpLoad %uint %42 + %44 = OpIAdd %uint %39 %41 + %45 = OpIAdd %uint %44 %43 + %47 = OpAccessChain %_ptr_StorageBuffer_uint %23 %uint_0 %45 + %48 = OpLoad %uint %47 + %49 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %50 = OpLoad %uint %49 + %51 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %52 = OpLoad %uint %51 + %54 = OpAccessChain %_ptr_Workgroup_uint %6 %50 %52 + OpStore %54 %48 + %55 = OpIAdd %uint %50 %uint_1 + %56 = OpAccessChain %_ptr_Workgroup_uint %6 %55 %52 + %57 = OpLoad %uint %56 + %58 = OpIAdd %uint %57 %uint_1 + OpStore %56 %58 + %59 = OpIAdd %uint %34 %31 + %60 = OpIMul %uint %59 %38 + %61 = OpIAdd %uint %60 %41 + %62 = OpIAdd %uint %61 %43 + %63 = OpAccessChain %_ptr_StorageBuffer_uint %23 %uint_0 %62 + OpStore %63 %48 + OpReturn + OpFunctionEnd + %72 = OpExtInst %void %64 PushConstantGlobalSize %uint_0 %uint_12 + %74 = OpExtInst %void %64 PushConstantRegionOffset %uint_16 %uint_12 + %67 = OpExtInst %void %64 Kernel %26 %65 %uint_1 %uint_0 %66 + %69 = OpExtInst %void %64 ArgumentInfo %68 + %70 = OpExtInst %void %64 ArgumentStorageBuffer %67 %uint_0 %uint_0 %uint_0 %69 + %76 = OpExtInst %void %64 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/4d_array_of_structs_race.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/4d_array_of_structs_race.spv.dis new file mode 100644 index 0000000000..f8dcdc64a3 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/4d_array_of_structs_race.spv.dis @@ -0,0 +1,46 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %16 "example" %gl_GlobalInvocationID %13 %5 + OpSource OpenCL_C 200 + %19 = OpString "example" + %20 = OpString " kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %16 = OpFunction %void Pure %15 + %17 = OpLabel + OpReturn + OpFunctionEnd + %25 = OpExtInst %void %18 PushConstantRegionOffset %uint_0 %uint_12 + %23 = OpExtInst %void %18 Kernel %16 %19 %uint_1 %uint_0 %20 + %27 = OpExtInst %void %18 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/4d_array_of_vectors_race.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/4d_array_of_vectors_race.spv.dis new file mode 100644 index 0000000000..f8cdbfc116 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/4d_array_of_vectors_race.spv.dis @@ -0,0 +1,76 @@ +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %39 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %24 "example" %4 %gl_GlobalInvocationID %17 %21 %9 + OpSource OpenCL_C 200 + %40 = OpString "example" + %41 = OpString " kernel" + %44 = OpString "G" + OpMemberDecorate %_struct_7 0 Offset 0 + OpDecorate %_struct_7 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %_struct_19 0 Offset 0 + OpDecorate %_struct_19 Block + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 0 + OpDecorate %12 SpecId 0 + OpDecorate %13 SpecId 1 + OpDecorate %14 SpecId 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_7 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_7 = OpTypePointer PushConstant %_struct_7 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %12 = OpSpecConstant %uint 1 + %13 = OpSpecConstant %uint 1 + %14 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %12 %13 %14 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %_struct_19 = OpTypeStruct %_runtimearr_v4float +%_ptr_StorageBuffer__struct_19 = OpTypePointer StorageBuffer %_struct_19 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %4 = OpVariable %_ptr_Workgroup_v4float Workgroup + %9 = OpVariable %_ptr_PushConstant__struct_7 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %17 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %21 = OpVariable %_ptr_StorageBuffer__struct_19 StorageBuffer + %24 = OpFunction %void None %23 + %25 = OpLabel + %28 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %29 = OpLoad %uint %28 + %31 = OpAccessChain %_ptr_PushConstant_uint %9 %uint_0 %uint_0 + %32 = OpLoad %uint %31 + %33 = OpIAdd %uint %29 %32 + %35 = OpAccessChain %_ptr_StorageBuffer_v4float %21 %uint_0 %33 + %36 = OpLoad %v4float %35 + %37 = OpLoad %v4float %4 + %38 = OpVectorShuffle %v4float %37 %36 0 1 4 3 + OpStore %4 %38 + OpReturn + OpFunctionEnd + %48 = OpExtInst %void %39 PushConstantRegionOffset %uint_0 %uint_12 + %43 = OpExtInst %void %39 Kernel %24 %40 %uint_1 %uint_0 %41 + %45 = OpExtInst %void %39 ArgumentInfo %44 + %46 = OpExtInst %void %39 ArgumentStorageBuffer %43 %uint_0 %uint_0 %uint_0 %45 + %50 = OpExtInst %void %39 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/4d_array_race.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/4d_array_race.spv.dis new file mode 100644 index 0000000000..f8dcdc64a3 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/4d_array_race.spv.dis @@ -0,0 +1,46 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %16 "example" %gl_GlobalInvocationID %13 %5 + OpSource OpenCL_C 200 + %19 = OpString "example" + %20 = OpString " kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %16 = OpFunction %void Pure %15 + %17 = OpLabel + OpReturn + OpFunctionEnd + %25 = OpExtInst %void %18 PushConstantRegionOffset %uint_0 %uint_12 + %23 = OpExtInst %void %18 Kernel %16 %19 %uint_1 %uint_0 %20 + %27 = OpExtInst %void %18 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/4d_array_with_casting.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/4d_array_with_casting.spv.dis new file mode 100644 index 0000000000..f8dcdc64a3 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/4d_array_with_casting.spv.dis @@ -0,0 +1,46 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %16 "example" %gl_GlobalInvocationID %13 %5 + OpSource OpenCL_C 200 + %19 = OpString "example" + %20 = OpString " kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %16 = OpFunction %void Pure %15 + %17 = OpLabel + OpReturn + OpFunctionEnd + %25 = OpExtInst %void %18 PushConstantRegionOffset %uint_0 %uint_12 + %23 = OpExtInst %void %18 Kernel %16 %19 %uint_1 %uint_0 %20 + %27 = OpExtInst %void %18 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/miscfail1.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/miscfail1.spv.dis new file mode 100644 index 0000000000..37a84f697b --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/miscfail1.spv.dis @@ -0,0 +1,84 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 63 +; Schema: 0 + OpCapability Shader + %46 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %25 "foo" %gl_LocalInvocationID %10 %14 %18 %22 + OpSource OpenCL_C 200 + %47 = OpString "foo" + %48 = OpString " __kernel" + %51 = OpString "A" + %55 = OpString "B" + %58 = OpString "C" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %15 SpecId 4 + OpDecorate %19 SpecId 5 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %15 = OpSpecConstant %uint 1 +%_arr_uint_15 = OpTypeArray %uint %15 +%_ptr_Workgroup__arr_uint_15 = OpTypePointer Workgroup %_arr_uint_15 + %19 = OpSpecConstant %uint 1 +%_arr_uint_19 = OpTypeArray %uint %19 +%_ptr_Workgroup__arr_uint_19 = OpTypePointer Workgroup %_arr_uint_19 + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_5 = OpConstant %uint 5 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %18 = OpVariable %_ptr_Workgroup__arr_uint_15 Workgroup + %22 = OpVariable %_ptr_Workgroup__arr_uint_19 Workgroup + %25 = OpFunction %void None %24 + %26 = OpLabel + %29 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %30 = OpLoad %uint %29 + %32 = OpAccessChain %_ptr_Workgroup_uint %22 %30 + %34 = OpIAdd %uint %30 %uint_1 + %35 = OpAccessChain %_ptr_Workgroup_uint %22 %34 + %36 = OpLoad %uint %35 + OpStore %32 %36 + %37 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %38 = OpLoad %uint %37 + %40 = OpIAdd %uint %38 %uint_2 + %41 = OpAccessChain %_ptr_Workgroup_uint %22 %40 + %42 = OpLoad %uint %41 + %43 = OpAccessChain %_ptr_Workgroup_uint %14 %42 + %44 = OpLoad %uint %43 + %45 = OpAccessChain %_ptr_Workgroup_uint %18 %38 + OpStore %45 %44 + OpReturn + OpFunctionEnd + %50 = OpExtInst %void %46 Kernel %25 %47 %uint_3 %uint_0 %48 + %52 = OpExtInst %void %46 ArgumentInfo %51 + %54 = OpExtInst %void %46 ArgumentWorkgroup %50 %uint_0 %uint_3 %uint_4 %52 + %56 = OpExtInst %void %46 ArgumentInfo %55 + %57 = OpExtInst %void %46 ArgumentWorkgroup %50 %uint_1 %uint_4 %uint_4 %56 + %59 = OpExtInst %void %46 ArgumentInfo %58 + %61 = OpExtInst %void %46 ArgumentWorkgroup %50 %uint_2 %uint_5 %uint_4 %59 + %62 = OpExtInst %void %46 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/miscfail10.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/miscfail10.spv.dis new file mode 100644 index 0000000000..ef1d416579 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/miscfail10.spv.dis @@ -0,0 +1,37 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 22 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_3 = OpConstant %uint 3 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %18 = OpExtInst %void %13 Kernel %11 %14 %uint_3 %uint_0 %15 + %21 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/miscfail3.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/miscfail3.spv.dis new file mode 100644 index 0000000000..7121fcdebf --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/miscfail3.spv.dis @@ -0,0 +1,66 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + %35 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %36 = OpString "foo" + %37 = OpString " __kernel" + %40 = OpString "A" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Workgroup_uint %14 %uint_0 + %23 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %24 = OpLoad %uint %23 + %26 = OpINotEqual %bool %24 %uint_0 + OpSelectionMerge %32 None + OpBranchConditional %26 %29 %32 + %29 = OpLabel + %30 = OpAccessChain %_ptr_Workgroup_uint %14 %24 + OpStore %30 %24 + OpBranch %32 + %32 = OpLabel + %33 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %34 = OpLoad %uint %33 + OpStore %21 %34 + OpReturn + OpFunctionEnd + %39 = OpExtInst %void %35 Kernel %17 %36 %uint_1 %uint_0 %37 + %41 = OpExtInst %void %35 ArgumentInfo %40 + %44 = OpExtInst %void %35 ArgumentWorkgroup %39 %uint_0 %uint_3 %uint_4 %41 + %46 = OpExtInst %void %35 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/miscfail8.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/miscfail8.spv.dis new file mode 100644 index 0000000000..74faa361c3 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/miscfail8.spv.dis @@ -0,0 +1,56 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %27 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "baz" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %28 = OpString "baz" + %29 = OpString " __kernel" + %31 = OpString "p" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %22 = OpLoad %uint %21 + %24 = OpIAdd %uint %22 %uint_1 + %26 = OpAccessChain %_ptr_Workgroup_uint %14 %24 + OpStore %26 %22 + OpReturn + OpFunctionEnd + %30 = OpExtInst %void %27 Kernel %17 %28 %uint_1 %uint_0 %29 + %32 = OpExtInst %void %27 ArgumentInfo %31 + %35 = OpExtInst %void %27 ArgumentWorkgroup %30 %uint_0 %uint_3 %uint_4 %32 + %37 = OpExtInst %void %27 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/miscfail9.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/miscfail9.spv.dis new file mode 100644 index 0000000000..862d7faeb4 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/miscfail9.spv.dis @@ -0,0 +1,7305 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 7117 +; Schema: 0 + OpCapability Shader + %184 = OpExtInstImport "GLSL.std.450" + %7107 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "test" %gl_GlobalInvocationID %13 %18 %5 + OpSource OpenCL_C 200 + %7108 = OpString "test" + %7109 = OpString " __kernel" + %7111 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %228 NoContraction + OpDecorate %229 NoContraction + OpDecorate %770 NoContraction + OpDecorate %799 NoContraction + OpDecorate %1298 NoContraction + OpDecorate %1338 NoContraction + OpDecorate %1347 NoContraction + OpDecorate %1348 NoContraction + OpDecorate %1850 NoContraction + OpDecorate %1884 NoContraction + OpDecorate %1885 NoContraction + OpDecorate %1889 NoContraction + OpDecorate %1890 NoContraction + OpDecorate %1891 NoContraction + OpDecorate %1904 NoContraction + OpDecorate %1906 NoContraction + OpDecorate %1908 NoContraction + OpDecorate %1909 NoContraction + OpDecorate %2408 NoContraction + OpDecorate %2442 NoContraction + OpDecorate %2446 NoContraction + OpDecorate %2447 NoContraction + OpDecorate %2448 NoContraction + OpDecorate %2449 NoContraction + OpDecorate %2450 NoContraction + OpDecorate %2451 NoContraction + OpDecorate %2452 NoContraction + OpDecorate %2949 NoContraction + OpDecorate %2983 NoContraction + OpDecorate %2987 NoContraction + OpDecorate %2988 NoContraction + OpDecorate %2989 NoContraction + OpDecorate %2990 NoContraction + OpDecorate %2991 NoContraction + OpDecorate %2993 NoContraction + OpDecorate %2994 NoContraction + OpDecorate %3492 NoContraction + OpDecorate %3526 NoContraction + OpDecorate %3530 NoContraction + OpDecorate %3531 NoContraction + OpDecorate %3532 NoContraction + OpDecorate %3533 NoContraction + OpDecorate %3534 NoContraction + OpDecorate %3543 NoContraction + OpDecorate %3544 NoContraction + OpDecorate %3546 NoContraction + OpDecorate %3548 NoContraction + OpDecorate %3549 NoContraction + OpDecorate %3551 NoContraction + OpDecorate %3552 NoContraction + OpDecorate %3554 NoContraction + OpDecorate %3555 NoContraction + OpDecorate %3557 NoContraction + OpDecorate %3558 NoContraction + OpDecorate %3559 NoContraction + OpDecorate %3560 NoContraction + OpDecorate %3561 NoContraction + OpDecorate %3562 NoContraction + OpDecorate %3564 NoContraction + OpDecorate %3565 NoContraction + OpDecorate %3566 NoContraction + OpDecorate %3567 NoContraction + OpDecorate %3569 NoContraction + OpDecorate %3571 NoContraction + OpDecorate %3572 NoContraction + OpDecorate %3574 NoContraction + OpDecorate %3575 NoContraction + OpDecorate %3577 NoContraction + OpDecorate %3578 NoContraction + OpDecorate %3580 NoContraction + OpDecorate %3581 NoContraction + OpDecorate %3583 NoContraction + OpDecorate %3584 NoContraction + OpDecorate %3601 NoContraction + OpDecorate %3602 NoContraction + OpDecorate %3604 NoContraction + OpDecorate %3605 NoContraction + OpDecorate %3606 NoContraction + OpDecorate %3607 NoContraction + OpDecorate %3608 NoContraction + OpDecorate %3609 NoContraction + OpDecorate %3778 NoContraction + OpDecorate %3779 NoContraction + OpDecorate %4278 NoContraction + OpDecorate %4307 NoContraction + OpDecorate %4804 NoContraction + OpDecorate %4844 NoContraction + OpDecorate %4853 NoContraction + OpDecorate %4854 NoContraction + OpDecorate %5356 NoContraction + OpDecorate %5390 NoContraction + OpDecorate %5391 NoContraction + OpDecorate %5395 NoContraction + OpDecorate %5396 NoContraction + OpDecorate %5397 NoContraction + OpDecorate %5409 NoContraction + OpDecorate %5410 NoContraction + OpDecorate %5412 NoContraction + OpDecorate %5413 NoContraction + OpDecorate %5912 NoContraction + OpDecorate %5946 NoContraction + OpDecorate %5950 NoContraction + OpDecorate %5951 NoContraction + OpDecorate %5952 NoContraction + OpDecorate %5953 NoContraction + OpDecorate %5954 NoContraction + OpDecorate %5955 NoContraction + OpDecorate %5956 NoContraction + OpDecorate %6453 NoContraction + OpDecorate %6487 NoContraction + OpDecorate %6491 NoContraction + OpDecorate %6492 NoContraction + OpDecorate %6493 NoContraction + OpDecorate %6494 NoContraction + OpDecorate %6495 NoContraction + OpDecorate %6496 NoContraction + OpDecorate %6497 NoContraction + OpDecorate %6994 NoContraction + OpDecorate %7028 NoContraction + OpDecorate %7032 NoContraction + OpDecorate %7033 NoContraction + OpDecorate %7034 NoContraction + OpDecorate %7035 NoContraction + OpDecorate %7036 NoContraction + OpDecorate %7046 NoContraction + OpDecorate %7047 NoContraction + OpDecorate %7048 NoContraction + OpDecorate %7049 NoContraction + OpDecorate %7050 NoContraction + OpDecorate %7051 NoContraction + OpDecorate %7052 NoContraction + OpDecorate %7053 NoContraction + OpDecorate %7054 NoContraction + OpDecorate %7055 NoContraction + OpDecorate %7056 NoContraction + OpDecorate %7057 NoContraction + OpDecorate %7058 NoContraction + OpDecorate %7059 NoContraction + OpDecorate %7060 NoContraction + OpDecorate %7061 NoContraction + OpDecorate %7062 NoContraction + OpDecorate %7063 NoContraction + OpDecorate %7064 NoContraction + OpDecorate %7065 NoContraction + OpDecorate %7066 NoContraction + OpDecorate %7067 NoContraction + OpDecorate %7068 NoContraction + OpDecorate %7069 NoContraction + OpDecorate %7070 NoContraction + OpDecorate %7071 NoContraction + OpDecorate %7072 NoContraction + OpDecorate %7073 NoContraction + OpDecorate %7074 NoContraction + OpDecorate %7086 NoContraction + OpDecorate %7087 NoContraction + OpDecorate %7088 NoContraction + OpDecorate %7089 NoContraction + OpDecorate %7090 NoContraction + OpDecorate %7091 NoContraction + OpDecorate %7092 NoContraction + OpDecorate %7093 NoContraction + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_16 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %33 = OpTypeFunction %float %float +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float +%uint_2147483647 = OpConstant %uint 2147483647 + %bool = OpTypeBool +%float_8388608 = OpConstant %float 8388608 + %uint_23 = OpConstant %uint 23 +%uint_8388607 = OpConstant %uint 8388607 +%uint_8388608 = OpConstant %uint 8388608 +%uint_4266746795 = OpConstant %uint 4266746795 + %_struct_58 = OpTypeStruct %uint %uint +%uint_1011060801 = OpConstant %uint 1011060801 + %uint_1 = OpConstant %uint 1 +%uint_3680671129 = OpConstant %uint 3680671129 +%uint_4113882560 = OpConstant %uint 4113882560 +%uint_4230436817 = OpConstant %uint 4230436817 +%uint_1313084713 = OpConstant %uint 1313084713 +%uint_2734261102 = OpConstant %uint 2734261102 +%uint_4294967176 = OpConstant %uint 4294967176 + %uint_31 = OpConstant %uint 31 +%uint_4294967264 = OpConstant %uint 4294967264 + %uint_24 = OpConstant %uint 24 + %uint_29 = OpConstant %uint 29 + %uint_2 = OpConstant %uint 2 + %uint_30 = OpConstant %uint 30 + %uint_9 = OpConstant %uint 9 +%uint_1056964608 = OpConstant %uint 1056964608 +%uint_4294967295 = OpConstant %uint 4294967295 +%uint_864026624 = OpConstant %uint 864026624 +%float_1_57079625 = OpConstant %float 1.57079625 + %v2float = OpTypeVector %float 2 + %261 = OpUndef %float + %262 = OpConstantComposite %v2float %float_1_57079625 %261 + %v2uint = OpTypeVector %uint 2 +%uint_2139095040 = OpConstant %uint 2139095040 + %267 = OpConstantComposite %v2uint %uint_2139095040 %uint_2139095040 + %v2bool = OpTypeVector %bool 2 + %270 = OpConstantNull %v2uint + %272 = OpConstantComposite %v2uint %uint_8388607 %uint_8388607 +%uint_2147483648 = OpConstant %uint 2147483648 + %277 = OpConstantComposite %v2uint %uint_2147483648 %uint_2147483648 + %290 = OpConstantNull %v2float + %292 = OpUndef %v2bool + %float_0 = OpConstant %float 0 + %uint_255 = OpConstant %uint 255 +%uint_4294967169 = OpConstant %uint 4294967169 + %319 = OpConstantComposite %v2uint %uint_8388608 %uint_8388608 + %uint_14 = OpConstant %uint 14 + %uint_18 = OpConstant %uint 18 +%uint_4294967042 = OpConstant %uint 4294967042 + %uint_5 = OpConstant %uint 5 +%uint_268435424 = OpConstant %uint 268435424 +%uint_268435456 = OpConstant %uint 268435456 + %354 = OpUndef %uint + %355 = OpConstantComposite %v2uint %uint_0 %354 + %uint_32 = OpConstant %uint 32 +%uint_4294967233 = OpConstant %uint 4294967233 + %420 = OpConstantComposite %v2uint %354 %uint_0 + %uint_63 = OpConstant %uint 63 + %528 = OpUndef %v2uint + %false = OpConstantFalse %bool + %536 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295 + %uint_3 = OpConstant %uint 3 +%uint_4294967293 = OpConstant %uint 4294967293 + %650 = OpConstantComposite %v2uint %uint_4294967295 %354 + %uint_4 = OpConstant %uint 4 + %true = OpConstantTrue %bool +%uint_16777215 = OpConstant %uint 16777215 + %uint_127 = OpConstant %uint 127 +%uint_4294967170 = OpConstant %uint 4294967170 +%uint_1065353216 = OpConstant %uint 1065353216 + %768 = OpUndef %v2float +%float_7_54978942en08 = OpConstant %float 7.54978942e-08 + %829 = OpConstantComposite %v2float %float_7_54978942en08 %261 +%float_0_636619747 = OpConstant %float 0.636619747 + %float_0_5 = OpConstant %float 0.5 +%float_5_39030253en15 = OpConstant %float 5.39030253e-15 + %3023 = OpConstantComposite %v2float %float_5_39030253en15 %261 +%float_1_58969102en10 = OpConstant %float 1.58969102e-10 +%float_n2_50507597en08 = OpConstant %float -2.50507597e-08 +%float_2_72500006en06 = OpConstant %float 2.72500006e-06 +%float_n0_00019840087 = OpConstant %float -0.00019840087 +%float_0_00833333191 = OpConstant %float 0.00833333191 +%float_0_166666672 = OpConstant %float 0.166666672 +%float_1_13596476en11 = OpConstant %float 1.13596476e-11 +%float_2_08757234en09 = OpConstant %float 2.08757234e-09 +%float_n2_7301013en07 = OpConstant %float -2.7301013e-07 +%float_2_48005999en05 = OpConstant %float 2.48005999e-05 +%float_n0_00138888881 = OpConstant %float -0.00138888881 +%float_0_0416666679 = OpConstant %float 0.0416666679 +%uint_4278190080 = OpConstant %uint 4278190080 +%uint_3244713574 = OpConstant %uint 3244713574 +%uint_11429479 = OpConstant %uint 11429479 +%uint_1061683200 = OpConstant %uint 1061683200 +%float_0_28125 = OpConstant %float 0.28125 + %float_1 = OpConstant %float 1 +%uint_2139095039 = OpConstant %uint 2139095039 +%float_0x1_8p_128 = OpConstant %float 0x1.8p+128 + %7106 = OpConstantComposite %v2uint %uint_1 %uint_0 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %26 + %31 = OpConvertUToF %float %30 + %32 = OpFunctionCall %float %34 %31 + OpReturn + OpFunctionEnd + %34 = OpFunction %float None %33 + %35 = OpFunctionParameter %float + %36 = OpLabel + %38 = OpAccessChain %_ptr_StorageBuffer_float %18 %uint_0 %uint_0 + %39 = OpBitcast %uint %35 + %41 = OpBitwiseAnd %uint %39 %uint_2147483647 + %42 = OpBitcast %float %41 + %43 = OpBitcast %uint %42 + %46 = OpFUnordGreaterThanEqual %bool %42 %float_8388608 + OpSelectionMerge %1895 None + OpBranchConditional %46 %49 %1895 + %49 = OpLabel + %51 = OpShiftRightLogical %uint %43 %uint_23 + %53 = OpBitwiseAnd %uint %43 %uint_8388607 + %55 = OpBitwiseOr %uint %53 %uint_8388608 + %57 = OpIMul %uint %55 %uint_4266746795 + %59 = OpUMulExtended %_struct_58 %55 %uint_4266746795 + %60 = OpCompositeExtract %uint %59 1 + %62 = OpIMul %uint %55 %uint_1011060801 + %63 = OpIAdd %uint %60 %62 + %64 = OpUMulExtended %_struct_58 %55 %uint_1011060801 + %65 = OpCompositeExtract %uint %64 1 + %66 = OpULessThan %bool %63 %60 + %68 = OpSelect %uint %66 %uint_1 %uint_0 + %69 = OpIAdd %uint %65 %68 + %71 = OpIMul %uint %55 %uint_3680671129 + %72 = OpIAdd %uint %69 %71 + %73 = OpUMulExtended %_struct_58 %55 %uint_3680671129 + %74 = OpCompositeExtract %uint %73 1 + %75 = OpULessThan %bool %72 %69 + %76 = OpSelect %uint %75 %uint_1 %uint_0 + %77 = OpIAdd %uint %74 %76 + %79 = OpIMul %uint %55 %uint_4113882560 + %80 = OpIAdd %uint %77 %79 + %81 = OpUMulExtended %_struct_58 %55 %uint_4113882560 + %82 = OpCompositeExtract %uint %81 1 + %83 = OpULessThan %bool %80 %77 + %84 = OpSelect %uint %83 %uint_1 %uint_0 + %85 = OpIAdd %uint %82 %84 + %87 = OpIMul %uint %55 %uint_4230436817 + %88 = OpIAdd %uint %85 %87 + %89 = OpUMulExtended %_struct_58 %55 %uint_4230436817 + %90 = OpCompositeExtract %uint %89 1 + %91 = OpULessThan %bool %88 %85 + %92 = OpSelect %uint %91 %uint_1 %uint_0 + %93 = OpIAdd %uint %90 %92 + %95 = OpIMul %uint %55 %uint_1313084713 + %96 = OpIAdd %uint %93 %95 + %97 = OpUMulExtended %_struct_58 %55 %uint_1313084713 + %98 = OpCompositeExtract %uint %97 1 + %99 = OpULessThan %bool %96 %93 + %100 = OpSelect %uint %99 %uint_1 %uint_0 + %101 = OpIAdd %uint %98 %100 + %103 = OpIMul %uint %55 %uint_2734261102 + %104 = OpIAdd %uint %101 %103 + %105 = OpUMulExtended %_struct_58 %55 %uint_2734261102 + %106 = OpCompositeExtract %uint %105 1 + %107 = OpULessThan %bool %104 %101 + %108 = OpSelect %uint %107 %uint_1 %uint_0 + %109 = OpIAdd %uint %106 %108 + %111 = OpIAdd %uint %51 %uint_4294967176 + %113 = OpUGreaterThan %bool %111 %uint_31 + %114 = OpSelect %uint %113 %104 %109 + %115 = OpSelect %uint %113 %96 %104 + %116 = OpSelect %uint %113 %88 %96 + %117 = OpSelect %uint %113 %80 %88 + %118 = OpSelect %uint %113 %72 %80 + %119 = OpSelect %uint %113 %63 %72 + %120 = OpSelect %uint %113 %57 %63 + %122 = OpSelect %uint %113 %uint_4294967264 %uint_0 + %123 = OpIAdd %uint %122 %111 + %124 = OpUGreaterThan %bool %123 %uint_31 + %125 = OpSelect %uint %124 %115 %114 + %126 = OpSelect %uint %124 %116 %115 + %127 = OpSelect %uint %124 %117 %116 + %128 = OpSelect %uint %124 %118 %117 + %129 = OpSelect %uint %124 %119 %118 + %130 = OpSelect %uint %124 %120 %119 + %131 = OpSelect %uint %124 %uint_4294967264 %uint_0 + %132 = OpIAdd %uint %131 %123 + %133 = OpUGreaterThan %bool %132 %uint_31 + %134 = OpSelect %uint %133 %126 %125 + %135 = OpSelect %uint %133 %127 %126 + %136 = OpSelect %uint %133 %128 %127 + %137 = OpSelect %uint %133 %129 %128 + %138 = OpSelect %uint %133 %130 %129 + %139 = OpSelect %uint %133 %uint_4294967264 %uint_0 + %140 = OpIAdd %uint %139 %132 + %141 = OpUGreaterThan %bool %140 %uint_31 + %142 = OpSelect %uint %141 %135 %134 + %143 = OpSelect %uint %141 %136 %135 + %144 = OpSelect %uint %141 %137 %136 + %145 = OpSelect %uint %141 %138 %137 + %146 = OpSelect %uint %141 %uint_4294967264 %uint_0 + %147 = OpISub %uint %uint_0 %140 + %148 = OpIEqual %bool %146 %147 + %150 = OpISub %uint %uint_24 %51 + %151 = OpBitwiseAnd %uint %111 %uint_31 + %152 = OpShiftLeftLogical %uint %142 %151 + %153 = OpBitwiseAnd %uint %150 %uint_31 + %154 = OpShiftRightLogical %uint %143 %153 + %155 = OpBitwiseOr %uint %152 %154 + %156 = OpShiftLeftLogical %uint %143 %151 + %157 = OpShiftRightLogical %uint %144 %153 + %158 = OpBitwiseOr %uint %156 %157 + %159 = OpShiftLeftLogical %uint %144 %151 + %160 = OpShiftRightLogical %uint %145 %153 + %161 = OpBitwiseOr %uint %159 %160 + %162 = OpSelect %uint %148 %142 %155 + %163 = OpSelect %uint %148 %143 %158 + %164 = OpSelect %uint %148 %144 %161 + %166 = OpShiftRightLogical %uint %162 %uint_29 + %168 = OpShiftLeftLogical %uint %162 %uint_2 + %170 = OpShiftRightLogical %uint %163 %uint_30 + %171 = OpBitwiseOr %uint %170 %168 + %172 = OpShiftLeftLogical %uint %163 %uint_2 + %173 = OpShiftRightLogical %uint %164 %uint_30 + %174 = OpBitwiseOr %uint %173 %172 + %175 = OpShiftLeftLogical %uint %164 %uint_2 + %176 = OpShiftRightLogical %uint %145 %uint_30 + %177 = OpBitwiseOr %uint %176 %175 + %178 = OpBitwiseAnd %uint %166 %uint_1 + %179 = OpISub %uint %uint_0 %178 + %180 = OpShiftLeftLogical %uint %166 %uint_31 + %181 = OpBitwiseXor %uint %171 %179 + %182 = OpBitwiseXor %uint %174 %179 + %183 = OpBitwiseXor %uint %177 %179 + %185 = OpExtInst %uint %184 FindUMsb %181 + %186 = OpISub %uint %uint_31 %185 + %187 = OpIAdd %uint %186 %uint_1 + %188 = OpISub %uint %uint_31 %186 + %189 = OpBitwiseAnd %uint %187 %uint_31 + %190 = OpShiftLeftLogical %uint %181 %189 + %191 = OpBitwiseAnd %uint %188 %uint_31 + %192 = OpShiftRightLogical %uint %182 %191 + %193 = OpBitwiseOr %uint %190 %192 + %194 = OpShiftLeftLogical %uint %182 %189 + %195 = OpShiftRightLogical %uint %183 %191 + %196 = OpBitwiseOr %uint %194 %195 + %198 = OpShiftRightLogical %uint %193 %uint_9 + %199 = OpShiftLeftLogical %uint %186 %uint_23 + %200 = OpISub %uint %198 %199 + %202 = OpIAdd %uint %200 %uint_1056964608 + %203 = OpBitwiseOr %uint %202 %180 + %204 = OpBitcast %float %203 + %205 = OpShiftLeftLogical %uint %193 %uint_23 + %206 = OpShiftRightLogical %uint %196 %uint_9 + %207 = OpBitwiseOr %uint %206 %205 + %208 = OpExtInst %uint %184 FindUMsb %207 + %209 = OpISub %uint %uint_31 %208 + %211 = OpBitwiseXor %uint %209 %uint_4294967295 + %212 = OpIAdd %uint %209 %uint_1 + %213 = OpISub %uint %uint_31 %209 + %214 = OpBitwiseAnd %uint %212 %uint_31 + %215 = OpShiftLeftLogical %uint %207 %214 + %216 = OpBitwiseAnd %uint %213 %uint_31 + %217 = OpShiftRightLogical %uint %196 %216 + %218 = OpBitwiseOr %uint %215 %217 + %219 = OpISub %uint %211 %186 + %220 = OpShiftLeftLogical %uint %219 %uint_23 + %221 = OpShiftRightLogical %uint %218 %uint_9 + %223 = OpIAdd %uint %220 %uint_864026624 + %224 = OpBitwiseOr %uint %221 %223 + %225 = OpBitwiseOr %uint %224 %180 + %226 = OpBitcast %float %225 + %228 = OpFMul %float %204 %float_1_57079625 + %229 = OpFNegate %float %228 + %230 = OpIsNan %bool %204 + %231 = OpLogicalNot %bool %230 + OpSelectionMerge %1330 None + OpBranchConditional %231 %234 %1330 + %234 = OpLabel + %235 = OpIsNan %bool %float_1_57079625 + %236 = OpLogicalNot %bool %235 + OpSelectionMerge %793 None + OpBranchConditional %236 %239 %793 + %239 = OpLabel + %240 = OpIsNan %bool %229 + %241 = OpLogicalNot %bool %240 + OpSelectionMerge %789 None + OpBranchConditional %241 %244 %789 + %244 = OpLabel + %245 = OpIsInf %bool %204 + %246 = OpLogicalNot %bool %245 + OpSelectionMerge %785 None + OpBranchConditional %246 %249 %785 + %249 = OpLabel + %250 = OpIsInf %bool %float_1_57079625 + %251 = OpLogicalNot %bool %250 + OpSelectionMerge %782 None + OpBranchConditional %251 %254 %782 + %254 = OpLabel + %255 = OpIsInf %bool %229 + %256 = OpLogicalNot %bool %255 + OpSelectionMerge %779 None + OpBranchConditional %256 %259 %779 + %259 = OpLabel + %263 = OpCompositeInsert %v2float %204 %262 1 + %265 = OpBitcast %v2uint %263 + %268 = OpBitwiseAnd %v2uint %265 %267 + %271 = OpINotEqual %v2bool %268 %270 + %273 = OpBitwiseAnd %v2uint %265 %272 + %274 = OpIEqual %v2bool %273 %270 + %275 = OpLogicalOr %v2bool %274 %271 + %278 = OpBitwiseAnd %v2uint %265 %277 + %279 = OpBitcast %v2float %278 + %280 = OpSelect %v2float %275 %263 %279 + %281 = OpBitcast %uint %229 + %282 = OpBitwiseAnd %uint %281 %uint_2139095040 + %283 = OpINotEqual %bool %282 %uint_0 + %284 = OpBitwiseAnd %uint %281 %uint_8388607 + %285 = OpIEqual %bool %284 %uint_0 + %286 = OpLogicalOr %bool %285 %283 + %287 = OpBitwiseAnd %uint %281 %uint_2147483648 + %288 = OpBitcast %float %287 + %289 = OpSelect %float %286 %229 %288 + %291 = OpFOrdEqual %v2bool %280 %290 + %293 = OpVectorShuffle %v2bool %291 %292 1 4294967295 + %294 = OpLogicalOr %v2bool %293 %291 + %295 = OpCompositeExtract %bool %294 0 + %296 = OpLogicalNot %bool %295 + OpSelectionMerge %776 None + OpBranchConditional %296 %299 %776 + %299 = OpLabel + %301 = OpFUnordNotEqual %bool %289 %float_0 + OpSelectionMerge %762 None + OpBranchConditional %301 %304 %762 + %304 = OpLabel + %305 = OpBitcast %v2uint %280 + %306 = OpCompositeExtract %uint %305 1 + %307 = OpShiftRightLogical %uint %306 %uint_23 + %309 = OpBitwiseAnd %uint %307 %uint_255 + %310 = OpCompositeExtract %uint %305 0 + %311 = OpShiftRightLogical %uint %310 %uint_23 + %312 = OpBitwiseAnd %uint %311 %uint_255 + %313 = OpBitcast %uint %289 + %314 = OpShiftRightLogical %uint %313 %uint_23 + %315 = OpBitwiseAnd %uint %314 %uint_255 + %317 = OpIAdd %uint %315 %uint_4294967169 + %318 = OpBitwiseAnd %v2uint %305 %272 + %320 = OpBitwiseOr %v2uint %318 %319 + %321 = OpBitwiseAnd %uint %313 %uint_2147483648 + %322 = OpBitwiseXor %uint %310 %306 + %323 = OpBitwiseAnd %uint %322 %uint_2147483648 + %324 = OpCompositeExtract %uint %320 0 + %325 = OpCompositeExtract %uint %320 1 + %326 = OpUMulExtended %_struct_58 %325 %324 + %327 = OpCompositeExtract %uint %326 1 + %328 = OpIMul %uint %324 %325 + %330 = OpShiftLeftLogical %uint %327 %uint_14 + %332 = OpShiftRightLogical %uint %328 %uint_18 + %333 = OpBitwiseOr %uint %332 %330 + %334 = OpShiftLeftLogical %uint %328 %uint_14 + %335 = OpCompositeConstruct %v2uint %334 %333 + %336 = OpBitwiseOr %uint %333 %334 + %337 = OpIEqual %bool %336 %uint_0 + %339 = OpIAdd %uint %309 %uint_4294967042 + %340 = OpIAdd %uint %339 %312 + %341 = OpSelect %uint %337 %uint_0 %340 + %342 = OpBitwiseOr %uint %341 %336 + %343 = OpINotEqual %bool %342 %uint_0 + OpSelectionMerge %759 None + OpBranchConditional %343 %346 %759 + %346 = OpLabel + %347 = OpISub %uint %341 %317 + %349 = OpShiftLeftLogical %uint %313 %uint_5 + %351 = OpBitwiseAnd %uint %349 %uint_268435424 + %353 = OpBitwiseOr %uint %351 %uint_268435456 + %356 = OpCompositeInsert %v2uint %353 %355 1 + %357 = OpExtInst %uint %184 SAbs %347 + %358 = OpINotEqual %bool %357 %uint_0 + OpSelectionMerge %386 None + OpBranchConditional %358 %361 %386 + %361 = OpLabel + %363 = OpUGreaterThanEqual %bool %357 %uint_32 + OpSelectionMerge %371 None + OpBranchConditional %363 %366 %371 + %366 = OpLabel + %367 = OpBitwiseAnd %uint %357 %uint_31 + %368 = OpShiftLeftLogical %uint %uint_1 %367 + %369 = OpCompositeInsert %v2uint %368 %355 1 + OpBranch %371 + %371 = OpLabel + %372 = OpPhi %v2uint %369 %366 %528 %361 + %373 = OpPhi %bool %false %366 %true %361 + OpSelectionMerge %383 None + OpBranchConditional %373 %376 %383 + %376 = OpLabel + %377 = OpISub %uint %uint_0 %357 + %378 = OpBitwiseAnd %uint %377 %uint_31 + %379 = OpShiftRightLogical %uint %uint_1 %378 + %380 = OpShiftLeftLogical %uint %uint_1 %357 + %381 = OpCompositeConstruct %v2uint %380 %379 + OpBranch %383 + %383 = OpLabel + %384 = OpPhi %v2uint %381 %376 %372 %371 + OpBranch %386 + %386 = OpLabel + %387 = OpPhi %v2uint %7106 %346 %384 %383 + %388 = OpCompositeExtract %uint %387 0 + %389 = OpShiftRightLogical %uint %388 %uint_1 + %390 = OpIAdd %uint %389 %uint_2147483647 + %391 = OpBitwiseAnd %uint %388 %uint_1 + %392 = OpIAdd %uint %390 %391 + %393 = OpShiftRightLogical %uint %392 %uint_31 + %394 = OpIAdd %uint %388 %uint_4294967295 + %395 = OpCompositeExtract %uint %387 1 + %396 = OpIAdd %uint %395 %uint_4294967295 + %397 = OpIAdd %uint %396 %393 + %398 = OpCompositeConstruct %v2uint %394 %397 + %399 = OpSLessThanEqual %bool %347 %uint_0 + OpSelectionMerge %453 None + OpBranchConditional %399 %402 %453 + %402 = OpLabel + %404 = OpSGreaterThanEqual %bool %347 %uint_4294967233 + OpSelectionMerge %448 None + OpBranchConditional %404 %407 %448 + %407 = OpLabel + %408 = OpISub %uint %uint_0 %347 + %409 = OpBitwiseAnd %v2uint %398 %335 + %410 = OpINotEqual %bool %341 %317 + OpSelectionMerge %443 None + OpBranchConditional %410 %413 %443 + %413 = OpLabel + %414 = OpUGreaterThanEqual %bool %408 %uint_32 + OpSelectionMerge %423 None + OpBranchConditional %414 %417 %423 + %417 = OpLabel + %418 = OpBitwiseAnd %uint %408 %uint_31 + %419 = OpShiftRightLogical %uint %333 %418 + %421 = OpCompositeInsert %v2uint %419 %420 0 + OpBranch %423 + %423 = OpLabel + %424 = OpPhi %v2uint %356 %417 %528 %413 + %425 = OpPhi %v2uint %409 %417 %528 %413 + %426 = OpPhi %v2uint %421 %417 %528 %413 + %427 = OpPhi %bool %false %417 %true %413 + OpSelectionMerge %438 None + OpBranchConditional %427 %430 %438 + %430 = OpLabel + %431 = OpShiftRightLogical %uint %334 %408 + %432 = OpBitwiseAnd %uint %347 %uint_31 + %433 = OpShiftLeftLogical %uint %333 %432 + %434 = OpBitwiseOr %uint %433 %431 + %435 = OpShiftRightLogical %uint %333 %408 + %436 = OpCompositeConstruct %v2uint %434 %435 + OpBranch %438 + %438 = OpLabel + %439 = OpPhi %v2uint %356 %430 %424 %423 + %440 = OpPhi %v2uint %409 %430 %425 %423 + %441 = OpPhi %v2uint %436 %430 %426 %423 + OpBranch %443 + %443 = OpLabel + %444 = OpPhi %v2uint %439 %438 %356 %407 + %445 = OpPhi %v2uint %440 %438 %409 %407 + %446 = OpPhi %v2uint %441 %438 %335 %407 + OpBranch %448 + %448 = OpLabel + %449 = OpPhi %v2uint %444 %443 %356 %402 + %450 = OpPhi %v2uint %445 %443 %335 %402 + %451 = OpPhi %v2uint %446 %443 %270 %402 + OpBranch %453 + %453 = OpLabel + %454 = OpPhi %v2uint %449 %448 %528 %386 + %455 = OpPhi %v2uint %450 %448 %528 %386 + %456 = OpPhi %v2uint %451 %448 %528 %386 + %457 = OpPhi %bool %false %448 %true %386 + OpSelectionMerge %500 None + OpBranchConditional %457 %460 %500 + %460 = OpLabel + %462 = OpULessThanEqual %bool %347 %uint_63 + OpSelectionMerge %495 None + OpBranchConditional %462 %465 %495 + %465 = OpLabel + %466 = OpBitwiseAnd %uint %397 %353 + %467 = OpCompositeInsert %v2uint %466 %355 1 + %468 = OpUGreaterThanEqual %bool %347 %uint_32 + OpSelectionMerge %476 None + OpBranchConditional %468 %471 %476 + %471 = OpLabel + %472 = OpBitwiseAnd %uint %347 %uint_31 + %473 = OpShiftRightLogical %uint %353 %472 + %474 = OpCompositeInsert %v2uint %473 %420 0 + OpBranch %476 + %476 = OpLabel + %477 = OpPhi %v2uint %474 %471 %528 %465 + %478 = OpPhi %v2uint %467 %471 %528 %465 + %479 = OpPhi %v2uint %335 %471 %528 %465 + %480 = OpPhi %bool %false %471 %true %465 + OpSelectionMerge %490 None + OpBranchConditional %480 %483 %490 + %483 = OpLabel + %484 = OpISub %uint %uint_0 %347 + %485 = OpBitwiseAnd %uint %484 %uint_31 + %486 = OpShiftLeftLogical %uint %353 %485 + %487 = OpShiftRightLogical %uint %353 %347 + %488 = OpCompositeConstruct %v2uint %486 %487 + OpBranch %490 + %490 = OpLabel + %491 = OpPhi %v2uint %488 %483 %477 %476 + %492 = OpPhi %v2uint %467 %483 %478 %476 + %493 = OpPhi %v2uint %335 %483 %479 %476 + OpBranch %495 + %495 = OpLabel + %496 = OpPhi %v2uint %491 %490 %270 %460 + %497 = OpPhi %v2uint %492 %490 %356 %460 + %498 = OpPhi %v2uint %493 %490 %335 %460 + OpBranch %500 + %500 = OpLabel + %501 = OpPhi %v2uint %456 %453 %498 %495 + %502 = OpPhi %v2uint %455 %453 %497 %495 + %503 = OpPhi %v2uint %454 %453 %496 %495 + %504 = OpExtInst %uint %184 SMax %341 %317 + %505 = OpINotEqual %bool %321 %323 + OpSelectionMerge %555 None + OpBranchConditional %505 %508 %555 + %508 = OpLabel + %509 = OpCompositeExtract %uint %503 0 + %510 = OpBitwiseXor %uint %509 %uint_4294967295 + %511 = OpCompositeExtract %uint %503 1 + %512 = OpBitwiseXor %uint %511 %uint_4294967295 + %513 = OpShiftRightLogical %uint %510 %uint_1 + %514 = OpBitwiseAnd %uint %510 %uint_1 + %515 = OpIAdd %uint %513 %514 + %516 = OpShiftRightLogical %uint %515 %uint_31 + %517 = OpISub %uint %uint_0 %509 + %518 = OpCompositeExtract %uint %501 0 + %519 = OpShiftRightLogical %uint %518 %uint_1 + %520 = OpShiftRightLogical %uint %517 %uint_1 + %521 = OpIAdd %uint %520 %519 + %522 = OpBitwiseAnd %uint %518 %uint_1 + %523 = OpBitwiseAnd %uint %522 %517 + %524 = OpIAdd %uint %521 %523 + %525 = OpShiftRightLogical %uint %524 %uint_31 + %526 = OpISub %uint %518 %509 + %527 = OpCompositeExtract %uint %501 1 + %529 = OpVectorShuffle %v2uint %502 %528 1 4294967295 + %530 = OpBitwiseOr %v2uint %529 %502 + %531 = OpCompositeExtract %uint %530 0 + %532 = OpINotEqual %bool %531 %uint_0 + %533 = OpSGreaterThan %bool %341 %317 + %535 = OpSelect %bool %532 %533 %false + %537 = OpSelect %v2uint %535 %536 %270 + %538 = OpCompositeExtract %uint %537 0 + %539 = OpShiftRightLogical %uint %526 %uint_1 + %540 = OpShiftRightLogical %uint %538 %uint_1 + %541 = OpIAdd %uint %540 %539 + %542 = OpBitwiseAnd %uint %526 %uint_1 + %543 = OpBitwiseAnd %uint %542 %538 + %544 = OpIAdd %uint %541 %543 + %545 = OpShiftRightLogical %uint %544 %uint_31 + %546 = OpIAdd %uint %538 %526 + %547 = OpCompositeExtract %uint %537 1 + %548 = OpIAdd %uint %527 %512 + %549 = OpIAdd %uint %548 %516 + %550 = OpIAdd %uint %549 %525 + %551 = OpIAdd %uint %550 %547 + %552 = OpIAdd %uint %551 %545 + %553 = OpCompositeConstruct %v2uint %546 %552 + OpBranch %555 + %555 = OpLabel + %556 = OpPhi %v2uint %553 %508 %528 %500 + %557 = OpPhi %bool %false %508 %true %500 + OpSelectionMerge %576 None + OpBranchConditional %557 %560 %576 + %560 = OpLabel + %561 = OpCompositeExtract %uint %501 0 + %562 = OpCompositeExtract %uint %503 0 + %563 = OpShiftRightLogical %uint %561 %uint_1 + %564 = OpShiftRightLogical %uint %562 %uint_1 + %565 = OpIAdd %uint %564 %563 + %566 = OpBitwiseAnd %uint %561 %uint_1 + %567 = OpBitwiseAnd %uint %566 %562 + %568 = OpIAdd %uint %565 %567 + %569 = OpShiftRightLogical %uint %568 %uint_31 + %570 = OpIAdd %uint %562 %561 + %571 = OpIAdd %v2uint %503 %501 + %572 = OpCompositeExtract %uint %571 1 + %573 = OpIAdd %uint %569 %572 + %574 = OpCompositeConstruct %v2uint %570 %573 + OpBranch %576 + %576 = OpLabel + %577 = OpPhi %v2uint %574 %560 %556 %555 + %578 = OpCompositeExtract %uint %577 1 + %579 = OpSLessThan %bool %578 %uint_0 + OpSelectionMerge %595 None + OpBranchConditional %579 %582 %595 + %582 = OpLabel + %583 = OpCompositeExtract %uint %577 0 + %584 = OpBitwiseXor %uint %583 %uint_4294967295 + %585 = OpBitwiseXor %uint %578 %uint_4294967295 + %586 = OpShiftRightLogical %uint %584 %uint_1 + %587 = OpBitwiseAnd %uint %584 %uint_1 + %588 = OpIAdd %uint %586 %587 + %589 = OpShiftRightLogical %uint %588 %uint_31 + %590 = OpISub %uint %uint_0 %583 + %591 = OpIAdd %uint %589 %585 + %592 = OpCompositeConstruct %v2uint %590 %591 + %593 = OpBitwiseXor %uint %323 %uint_2147483648 + OpBranch %595 + %595 = OpLabel + %596 = OpPhi %uint %593 %582 %323 %576 + %597 = OpPhi %v2uint %592 %582 %577 %576 + %598 = OpCompositeExtract %uint %597 1 + %599 = OpExtInst %uint %184 FindUMsb %598 + %600 = OpISub %uint %uint_31 %599 + %601 = OpIEqual %bool %598 %uint_0 + %602 = OpCompositeExtract %uint %597 0 + %603 = OpExtInst %uint %184 FindUMsb %602 + %604 = OpISub %uint %uint_31 %603 + %605 = OpIAdd %uint %604 %uint_32 + %606 = OpSelect %uint %601 %605 %600 + %608 = OpISub %uint %uint_3 %606 + %609 = OpIAdd %uint %608 %504 + %610 = OpUGreaterThan %bool %606 %uint_3 + OpSelectionMerge %642 None + OpBranchConditional %610 %613 %642 + %613 = OpLabel + %615 = OpIAdd %uint %606 %uint_4294967293 + %616 = OpUGreaterThanEqual %bool %615 %uint_32 + OpSelectionMerge %624 None + OpBranchConditional %616 %619 %624 + %619 = OpLabel + %620 = OpBitwiseAnd %uint %615 %uint_31 + %621 = OpShiftLeftLogical %uint %602 %620 + %622 = OpCompositeInsert %v2uint %621 %355 1 + OpBranch %624 + %624 = OpLabel + %625 = OpPhi %uint %uint_0 %619 %354 %613 + %626 = OpPhi %v2uint %622 %619 %528 %613 + %627 = OpPhi %bool %false %619 %true %613 + OpSelectionMerge %638 None + OpBranchConditional %627 %630 %638 + %630 = OpLabel + %631 = OpShiftLeftLogical %uint %598 %615 + %632 = OpBitwiseAnd %uint %608 %uint_31 + %633 = OpShiftRightLogical %uint %602 %632 + %634 = OpBitwiseOr %uint %633 %631 + %635 = OpShiftLeftLogical %uint %602 %615 + %636 = OpCompositeConstruct %v2uint %635 %634 + OpBranch %638 + %638 = OpLabel + %639 = OpPhi %uint %uint_0 %630 %625 %624 + %640 = OpPhi %v2uint %636 %630 %626 %624 + OpBranch %642 + %642 = OpLabel + %643 = OpPhi %v2uint %597 %595 %640 %638 + %644 = OpPhi %uint %608 %595 %639 %638 + %645 = OpIAdd %uint %644 %uint_5 + %646 = OpBitwiseAnd %uint %645 %uint_31 + %647 = OpShiftLeftLogical %uint %uint_1 %646 + %648 = OpCompositeInsert %v2uint %647 %355 1 + %649 = OpIAdd %uint %647 %uint_4294967295 + %651 = OpCompositeInsert %v2uint %649 %650 1 + %652 = OpBitwiseAnd %v2uint %651 %643 + %653 = OpCompositeExtract %uint %652 1 + %654 = OpBitwiseAnd %v2uint %648 %643 + %655 = OpIAdd %uint %644 %uint_2 + %656 = OpBitwiseAnd %uint %655 %uint_31 + %658 = OpShiftLeftLogical %uint %uint_4 %656 + %659 = OpUGreaterThan %bool %653 %658 + %660 = OpLogicalNot %bool %659 + OpSelectionMerge %692 None + OpBranchConditional %660 %663 %692 + %663 = OpLabel + %664 = OpCompositeExtract %uint %652 0 + %665 = OpVectorShuffle %v2uint %502 %528 1 4294967295 + %666 = OpBitwiseOr %v2uint %665 %502 + %667 = OpCompositeExtract %uint %666 0 + %668 = OpINotEqual %bool %667 %uint_0 + %669 = OpSelect %uint %668 %uint_1 %uint_0 + %670 = OpBitwiseOr %uint %664 %669 + %671 = OpIEqual %bool %653 %658 + %672 = OpINotEqual %bool %670 %uint_0 + %673 = OpSelect %bool %671 %672 %false + %674 = OpLogicalNot %bool %673 + OpSelectionMerge %688 None + OpBranchConditional %674 %677 %688 + %677 = OpLabel + %678 = OpINotEqual %bool %653 %658 + %679 = OpLogicalOr %bool %678 %672 + %680 = OpVectorShuffle %v2uint %654 %528 1 4294967295 + %681 = OpBitwiseOr %v2uint %680 %654 + %682 = OpCompositeExtract %uint %681 0 + %683 = OpIEqual %bool %682 %uint_0 + %685 = OpSelect %bool %679 %true %683 + %686 = OpLogicalNot %bool %685 + OpBranch %688 + %688 = OpLabel + %689 = OpPhi %v2uint %643 %677 %528 %663 + %690 = OpPhi %bool %686 %677 %673 %663 + OpBranch %692 + %692 = OpLabel + %693 = OpPhi %v2uint %689 %688 %528 %642 + %694 = OpPhi %bool %690 %688 %659 %642 + OpSelectionMerge %702 None + OpBranchConditional %694 %697 %702 + %697 = OpLabel + %698 = OpCompositeExtract %uint %643 1 + %699 = OpIAdd %uint %647 %698 + %700 = OpCompositeInsert %v2uint %699 %643 1 + OpBranch %702 + %702 = OpLabel + %703 = OpPhi %v2uint %700 %697 %693 %692 + %704 = OpCompositeExtract %uint %703 1 + %705 = OpShiftRightLogical %uint %704 %646 + %707 = OpUGreaterThan %bool %705 %uint_16777215 + %708 = OpSelect %uint %707 %uint_1 %uint_0 + %709 = OpShiftRightLogical %uint %705 %708 + %710 = OpIAdd %uint %609 %708 + %711 = OpINotEqual %bool %709 %uint_0 + OpSelectionMerge %756 None + OpBranchConditional %711 %714 %756 + %714 = OpLabel + %716 = OpSLessThanEqual %bool %710 %uint_127 + OpSelectionMerge %744 None + OpBranchConditional %716 %719 %744 + %719 = OpLabel + %721 = OpSGreaterThanEqual %bool %710 %uint_4294967170 + OpSelectionMerge %733 None + OpBranchConditional %721 %724 %733 + %724 = OpLabel + %725 = OpShiftLeftLogical %uint %710 %uint_23 + %727 = OpIAdd %uint %725 %uint_1065353216 + %728 = OpBitwiseAnd %uint %709 %uint_8388607 + %729 = OpBitwiseOr %uint %727 %728 + %730 = OpBitwiseOr %uint %729 %596 + %731 = OpBitcast %float %730 + OpBranch %733 + %733 = OpLabel + %734 = OpPhi %float %731 %724 %261 %719 + %735 = OpPhi %bool %false %724 %true %719 + OpSelectionMerge %741 None + OpBranchConditional %735 %738 %741 + %738 = OpLabel + %739 = OpBitcast %float %596 + OpBranch %741 + %741 = OpLabel + %742 = OpPhi %float %739 %738 %734 %733 + OpBranch %744 + %744 = OpLabel + %745 = OpPhi %float %742 %741 %261 %714 + %746 = OpPhi %bool %false %741 %true %714 + OpSelectionMerge %753 None + OpBranchConditional %746 %749 %753 + %749 = OpLabel + %750 = OpBitwiseOr %uint %596 %uint_2139095040 + %751 = OpBitcast %float %750 + OpBranch %753 + %753 = OpLabel + %754 = OpPhi %float %751 %749 %745 %744 + OpBranch %756 + %756 = OpLabel + %757 = OpPhi %float %754 %753 %float_0 %702 + OpBranch %759 + %759 = OpLabel + %760 = OpPhi %float %757 %756 %289 %304 + OpBranch %762 + %762 = OpLabel + %763 = OpPhi %float %760 %759 %261 %299 + %764 = OpPhi %bool %false %759 %true %299 + OpSelectionMerge %773 None + OpBranchConditional %764 %767 %773 + %767 = OpLabel + %769 = OpVectorShuffle %v2float %280 %768 1 4294967295 + %770 = OpFMul %v2float %280 %769 + %771 = OpCompositeExtract %float %770 0 + OpBranch %773 + %773 = OpLabel + %774 = OpPhi %float %771 %767 %763 %762 + OpBranch %776 + %776 = OpLabel + %777 = OpPhi %float %774 %773 %289 %259 + OpBranch %779 + %779 = OpLabel + %780 = OpPhi %float %777 %776 %229 %254 + OpBranch %782 + %782 = OpLabel + %783 = OpPhi %float %780 %779 %261 %249 + OpBranch %785 + %785 = OpLabel + %786 = OpPhi %float %783 %782 %261 %244 + %787 = OpPhi %bool %250 %782 %true %244 + OpBranch %789 + %789 = OpLabel + %790 = OpPhi %float %786 %785 %261 %239 + %791 = OpPhi %bool %787 %785 %240 %239 + OpBranch %793 + %793 = OpLabel + %794 = OpPhi %float %790 %789 %261 %234 + %795 = OpPhi %bool %791 %789 %true %234 + OpSelectionMerge %801 None + OpBranchConditional %795 %798 %801 + %798 = OpLabel + %799 = OpFSub %float %228 %228 + OpBranch %801 + %801 = OpLabel + %802 = OpPhi %float %799 %798 %794 %793 + %804 = OpIsNan %bool %float_7_54978942en08 + %805 = OpLogicalNot %bool %804 + OpSelectionMerge %1325 None + OpBranchConditional %805 %808 %1325 + %808 = OpLabel + %809 = OpIsNan %bool %802 + %810 = OpLogicalNot %bool %809 + OpSelectionMerge %1320 None + OpBranchConditional %810 %813 %1320 + %813 = OpLabel + %814 = OpIsInf %bool %204 + %815 = OpLogicalNot %bool %814 + OpSelectionMerge %1315 None + OpBranchConditional %815 %818 %1315 + %818 = OpLabel + %819 = OpIsInf %bool %float_7_54978942en08 + %820 = OpLogicalNot %bool %819 + OpSelectionMerge %1310 None + OpBranchConditional %820 %823 %1310 + %823 = OpLabel + %824 = OpIsInf %bool %802 + %825 = OpLogicalNot %bool %824 + OpSelectionMerge %1307 None + OpBranchConditional %825 %828 %1307 + %828 = OpLabel + %830 = OpCompositeInsert %v2float %204 %829 1 + %831 = OpBitcast %v2uint %830 + %832 = OpBitwiseAnd %v2uint %831 %267 + %833 = OpINotEqual %v2bool %832 %270 + %834 = OpBitwiseAnd %v2uint %831 %272 + %835 = OpIEqual %v2bool %834 %270 + %836 = OpLogicalOr %v2bool %835 %833 + %837 = OpBitwiseAnd %v2uint %831 %277 + %838 = OpBitcast %v2float %837 + %839 = OpSelect %v2float %836 %830 %838 + %840 = OpBitcast %uint %802 + %841 = OpBitwiseAnd %uint %840 %uint_2139095040 + %842 = OpINotEqual %bool %841 %uint_0 + %843 = OpBitwiseAnd %uint %840 %uint_8388607 + %844 = OpIEqual %bool %843 %uint_0 + %845 = OpLogicalOr %bool %844 %842 + %846 = OpBitwiseAnd %uint %840 %uint_2147483648 + %847 = OpBitcast %float %846 + %848 = OpSelect %float %845 %802 %847 + %849 = OpFOrdEqual %v2bool %839 %290 + %850 = OpVectorShuffle %v2bool %849 %292 1 4294967295 + %851 = OpLogicalOr %v2bool %850 %849 + %852 = OpCompositeExtract %bool %851 0 + %853 = OpLogicalNot %bool %852 + OpSelectionMerge %1304 None + OpBranchConditional %853 %856 %1304 + %856 = OpLabel + %857 = OpFUnordNotEqual %bool %848 %float_0 + OpSelectionMerge %1291 None + OpBranchConditional %857 %860 %1291 + %860 = OpLabel + %861 = OpBitcast %v2uint %839 + %862 = OpCompositeExtract %uint %861 1 + %863 = OpShiftRightLogical %uint %862 %uint_23 + %864 = OpBitwiseAnd %uint %863 %uint_255 + %865 = OpCompositeExtract %uint %861 0 + %866 = OpShiftRightLogical %uint %865 %uint_23 + %867 = OpBitwiseAnd %uint %866 %uint_255 + %868 = OpBitcast %uint %848 + %869 = OpShiftRightLogical %uint %868 %uint_23 + %870 = OpBitwiseAnd %uint %869 %uint_255 + %871 = OpIAdd %uint %870 %uint_4294967169 + %872 = OpBitwiseAnd %v2uint %861 %272 + %873 = OpBitwiseOr %v2uint %872 %319 + %874 = OpBitwiseAnd %uint %868 %uint_2147483648 + %875 = OpBitwiseXor %uint %865 %862 + %876 = OpBitwiseAnd %uint %875 %uint_2147483648 + %877 = OpCompositeExtract %uint %873 0 + %878 = OpCompositeExtract %uint %873 1 + %879 = OpUMulExtended %_struct_58 %878 %877 + %880 = OpCompositeExtract %uint %879 1 + %881 = OpIMul %uint %877 %878 + %882 = OpShiftLeftLogical %uint %880 %uint_14 + %883 = OpShiftRightLogical %uint %881 %uint_18 + %884 = OpBitwiseOr %uint %883 %882 + %885 = OpShiftLeftLogical %uint %881 %uint_14 + %886 = OpCompositeConstruct %v2uint %885 %884 + %887 = OpBitwiseOr %uint %884 %885 + %888 = OpIEqual %bool %887 %uint_0 + %889 = OpIAdd %uint %864 %uint_4294967042 + %890 = OpIAdd %uint %889 %867 + %891 = OpSelect %uint %888 %uint_0 %890 + %892 = OpBitwiseOr %uint %891 %887 + %893 = OpINotEqual %bool %892 %uint_0 + OpSelectionMerge %1288 None + OpBranchConditional %893 %896 %1288 + %896 = OpLabel + %897 = OpISub %uint %891 %871 + %898 = OpShiftLeftLogical %uint %868 %uint_5 + %899 = OpBitwiseAnd %uint %898 %uint_268435424 + %900 = OpBitwiseOr %uint %899 %uint_268435456 + %901 = OpCompositeInsert %v2uint %900 %355 1 + %902 = OpExtInst %uint %184 SAbs %897 + %903 = OpINotEqual %bool %902 %uint_0 + OpSelectionMerge %930 None + OpBranchConditional %903 %906 %930 + %906 = OpLabel + %907 = OpUGreaterThanEqual %bool %902 %uint_32 + OpSelectionMerge %915 None + OpBranchConditional %907 %910 %915 + %910 = OpLabel + %911 = OpBitwiseAnd %uint %902 %uint_31 + %912 = OpShiftLeftLogical %uint %uint_1 %911 + %913 = OpCompositeInsert %v2uint %912 %355 1 + OpBranch %915 + %915 = OpLabel + %916 = OpPhi %v2uint %913 %910 %528 %906 + %917 = OpPhi %bool %false %910 %true %906 + OpSelectionMerge %927 None + OpBranchConditional %917 %920 %927 + %920 = OpLabel + %921 = OpISub %uint %uint_0 %902 + %922 = OpBitwiseAnd %uint %921 %uint_31 + %923 = OpShiftRightLogical %uint %uint_1 %922 + %924 = OpShiftLeftLogical %uint %uint_1 %902 + %925 = OpCompositeConstruct %v2uint %924 %923 + OpBranch %927 + %927 = OpLabel + %928 = OpPhi %v2uint %925 %920 %916 %915 + OpBranch %930 + %930 = OpLabel + %931 = OpPhi %v2uint %7106 %896 %928 %927 + %932 = OpCompositeExtract %uint %931 0 + %933 = OpShiftRightLogical %uint %932 %uint_1 + %934 = OpIAdd %uint %933 %uint_2147483647 + %935 = OpBitwiseAnd %uint %932 %uint_1 + %936 = OpIAdd %uint %934 %935 + %937 = OpShiftRightLogical %uint %936 %uint_31 + %938 = OpIAdd %uint %932 %uint_4294967295 + %939 = OpCompositeExtract %uint %931 1 + %940 = OpIAdd %uint %939 %uint_4294967295 + %941 = OpIAdd %uint %940 %937 + %942 = OpCompositeConstruct %v2uint %938 %941 + %943 = OpSLessThanEqual %bool %897 %uint_0 + OpSelectionMerge %995 None + OpBranchConditional %943 %946 %995 + %946 = OpLabel + %947 = OpSGreaterThanEqual %bool %897 %uint_4294967233 + OpSelectionMerge %990 None + OpBranchConditional %947 %950 %990 + %950 = OpLabel + %951 = OpISub %uint %uint_0 %897 + %952 = OpBitwiseAnd %v2uint %942 %886 + %953 = OpINotEqual %bool %891 %871 + OpSelectionMerge %985 None + OpBranchConditional %953 %956 %985 + %956 = OpLabel + %957 = OpUGreaterThanEqual %bool %951 %uint_32 + OpSelectionMerge %965 None + OpBranchConditional %957 %960 %965 + %960 = OpLabel + %961 = OpBitwiseAnd %uint %951 %uint_31 + %962 = OpShiftRightLogical %uint %884 %961 + %963 = OpCompositeInsert %v2uint %962 %420 0 + OpBranch %965 + %965 = OpLabel + %966 = OpPhi %v2uint %901 %960 %528 %956 + %967 = OpPhi %v2uint %952 %960 %528 %956 + %968 = OpPhi %v2uint %963 %960 %528 %956 + %969 = OpPhi %bool %false %960 %true %956 + OpSelectionMerge %980 None + OpBranchConditional %969 %972 %980 + %972 = OpLabel + %973 = OpShiftRightLogical %uint %885 %951 + %974 = OpBitwiseAnd %uint %897 %uint_31 + %975 = OpShiftLeftLogical %uint %884 %974 + %976 = OpBitwiseOr %uint %975 %973 + %977 = OpShiftRightLogical %uint %884 %951 + %978 = OpCompositeConstruct %v2uint %976 %977 + OpBranch %980 + %980 = OpLabel + %981 = OpPhi %v2uint %901 %972 %966 %965 + %982 = OpPhi %v2uint %952 %972 %967 %965 + %983 = OpPhi %v2uint %978 %972 %968 %965 + OpBranch %985 + %985 = OpLabel + %986 = OpPhi %v2uint %981 %980 %901 %950 + %987 = OpPhi %v2uint %982 %980 %952 %950 + %988 = OpPhi %v2uint %983 %980 %886 %950 + OpBranch %990 + %990 = OpLabel + %991 = OpPhi %v2uint %986 %985 %901 %946 + %992 = OpPhi %v2uint %987 %985 %886 %946 + %993 = OpPhi %v2uint %988 %985 %270 %946 + OpBranch %995 + %995 = OpLabel + %996 = OpPhi %v2uint %991 %990 %528 %930 + %997 = OpPhi %v2uint %992 %990 %528 %930 + %998 = OpPhi %v2uint %993 %990 %528 %930 + %999 = OpPhi %bool %false %990 %true %930 + OpSelectionMerge %1041 None + OpBranchConditional %999 %1002 %1041 + %1002 = OpLabel + %1003 = OpULessThanEqual %bool %897 %uint_63 + OpSelectionMerge %1036 None + OpBranchConditional %1003 %1006 %1036 + %1006 = OpLabel + %1007 = OpBitwiseAnd %uint %941 %900 + %1008 = OpCompositeInsert %v2uint %1007 %355 1 + %1009 = OpUGreaterThanEqual %bool %897 %uint_32 + OpSelectionMerge %1017 None + OpBranchConditional %1009 %1012 %1017 + %1012 = OpLabel + %1013 = OpBitwiseAnd %uint %897 %uint_31 + %1014 = OpShiftRightLogical %uint %900 %1013 + %1015 = OpCompositeInsert %v2uint %1014 %420 0 + OpBranch %1017 + %1017 = OpLabel + %1018 = OpPhi %v2uint %1015 %1012 %528 %1006 + %1019 = OpPhi %v2uint %1008 %1012 %528 %1006 + %1020 = OpPhi %v2uint %886 %1012 %528 %1006 + %1021 = OpPhi %bool %false %1012 %true %1006 + OpSelectionMerge %1031 None + OpBranchConditional %1021 %1024 %1031 + %1024 = OpLabel + %1025 = OpISub %uint %uint_0 %897 + %1026 = OpBitwiseAnd %uint %1025 %uint_31 + %1027 = OpShiftLeftLogical %uint %900 %1026 + %1028 = OpShiftRightLogical %uint %900 %897 + %1029 = OpCompositeConstruct %v2uint %1027 %1028 + OpBranch %1031 + %1031 = OpLabel + %1032 = OpPhi %v2uint %1029 %1024 %1018 %1017 + %1033 = OpPhi %v2uint %1008 %1024 %1019 %1017 + %1034 = OpPhi %v2uint %886 %1024 %1020 %1017 + OpBranch %1036 + %1036 = OpLabel + %1037 = OpPhi %v2uint %1032 %1031 %270 %1002 + %1038 = OpPhi %v2uint %1033 %1031 %901 %1002 + %1039 = OpPhi %v2uint %1034 %1031 %886 %1002 + OpBranch %1041 + %1041 = OpLabel + %1042 = OpPhi %v2uint %998 %995 %1039 %1036 + %1043 = OpPhi %v2uint %997 %995 %1038 %1036 + %1044 = OpPhi %v2uint %996 %995 %1037 %1036 + %1045 = OpExtInst %uint %184 SMax %891 %871 + %1046 = OpINotEqual %bool %874 %876 + OpSelectionMerge %1093 None + OpBranchConditional %1046 %1049 %1093 + %1049 = OpLabel + %1050 = OpCompositeExtract %uint %1044 0 + %1051 = OpBitwiseXor %uint %1050 %uint_4294967295 + %1052 = OpCompositeExtract %uint %1044 1 + %1053 = OpBitwiseXor %uint %1052 %uint_4294967295 + %1054 = OpShiftRightLogical %uint %1051 %uint_1 + %1055 = OpBitwiseAnd %uint %1051 %uint_1 + %1056 = OpIAdd %uint %1054 %1055 + %1057 = OpShiftRightLogical %uint %1056 %uint_31 + %1058 = OpISub %uint %uint_0 %1050 + %1059 = OpCompositeExtract %uint %1042 0 + %1060 = OpShiftRightLogical %uint %1059 %uint_1 + %1061 = OpShiftRightLogical %uint %1058 %uint_1 + %1062 = OpIAdd %uint %1061 %1060 + %1063 = OpBitwiseAnd %uint %1059 %uint_1 + %1064 = OpBitwiseAnd %uint %1063 %1058 + %1065 = OpIAdd %uint %1062 %1064 + %1066 = OpShiftRightLogical %uint %1065 %uint_31 + %1067 = OpISub %uint %1059 %1050 + %1068 = OpCompositeExtract %uint %1042 1 + %1069 = OpVectorShuffle %v2uint %1043 %528 1 4294967295 + %1070 = OpBitwiseOr %v2uint %1069 %1043 + %1071 = OpCompositeExtract %uint %1070 0 + %1072 = OpINotEqual %bool %1071 %uint_0 + %1073 = OpSGreaterThan %bool %891 %871 + %1074 = OpSelect %bool %1072 %1073 %false + %1075 = OpSelect %v2uint %1074 %536 %270 + %1076 = OpCompositeExtract %uint %1075 0 + %1077 = OpShiftRightLogical %uint %1067 %uint_1 + %1078 = OpShiftRightLogical %uint %1076 %uint_1 + %1079 = OpIAdd %uint %1078 %1077 + %1080 = OpBitwiseAnd %uint %1067 %uint_1 + %1081 = OpBitwiseAnd %uint %1080 %1076 + %1082 = OpIAdd %uint %1079 %1081 + %1083 = OpShiftRightLogical %uint %1082 %uint_31 + %1084 = OpIAdd %uint %1076 %1067 + %1085 = OpCompositeExtract %uint %1075 1 + %1086 = OpIAdd %uint %1068 %1053 + %1087 = OpIAdd %uint %1086 %1057 + %1088 = OpIAdd %uint %1087 %1066 + %1089 = OpIAdd %uint %1088 %1085 + %1090 = OpIAdd %uint %1089 %1083 + %1091 = OpCompositeConstruct %v2uint %1084 %1090 + OpBranch %1093 + %1093 = OpLabel + %1094 = OpPhi %v2uint %1091 %1049 %528 %1041 + %1095 = OpPhi %bool %false %1049 %true %1041 + OpSelectionMerge %1114 None + OpBranchConditional %1095 %1098 %1114 + %1098 = OpLabel + %1099 = OpCompositeExtract %uint %1042 0 + %1100 = OpCompositeExtract %uint %1044 0 + %1101 = OpShiftRightLogical %uint %1099 %uint_1 + %1102 = OpShiftRightLogical %uint %1100 %uint_1 + %1103 = OpIAdd %uint %1102 %1101 + %1104 = OpBitwiseAnd %uint %1099 %uint_1 + %1105 = OpBitwiseAnd %uint %1104 %1100 + %1106 = OpIAdd %uint %1103 %1105 + %1107 = OpShiftRightLogical %uint %1106 %uint_31 + %1108 = OpIAdd %uint %1100 %1099 + %1109 = OpIAdd %v2uint %1044 %1042 + %1110 = OpCompositeExtract %uint %1109 1 + %1111 = OpIAdd %uint %1107 %1110 + %1112 = OpCompositeConstruct %v2uint %1108 %1111 + OpBranch %1114 + %1114 = OpLabel + %1115 = OpPhi %v2uint %1112 %1098 %1094 %1093 + %1116 = OpCompositeExtract %uint %1115 1 + %1117 = OpSLessThan %bool %1116 %uint_0 + OpSelectionMerge %1133 None + OpBranchConditional %1117 %1120 %1133 + %1120 = OpLabel + %1121 = OpCompositeExtract %uint %1115 0 + %1122 = OpBitwiseXor %uint %1121 %uint_4294967295 + %1123 = OpBitwiseXor %uint %1116 %uint_4294967295 + %1124 = OpShiftRightLogical %uint %1122 %uint_1 + %1125 = OpBitwiseAnd %uint %1122 %uint_1 + %1126 = OpIAdd %uint %1124 %1125 + %1127 = OpShiftRightLogical %uint %1126 %uint_31 + %1128 = OpISub %uint %uint_0 %1121 + %1129 = OpIAdd %uint %1127 %1123 + %1130 = OpCompositeConstruct %v2uint %1128 %1129 + %1131 = OpBitwiseXor %uint %876 %uint_2147483648 + OpBranch %1133 + %1133 = OpLabel + %1134 = OpPhi %uint %1131 %1120 %876 %1114 + %1135 = OpPhi %v2uint %1130 %1120 %1115 %1114 + %1136 = OpCompositeExtract %uint %1135 1 + %1137 = OpExtInst %uint %184 FindUMsb %1136 + %1138 = OpISub %uint %uint_31 %1137 + %1139 = OpIEqual %bool %1136 %uint_0 + %1140 = OpCompositeExtract %uint %1135 0 + %1141 = OpExtInst %uint %184 FindUMsb %1140 + %1142 = OpISub %uint %uint_31 %1141 + %1143 = OpIAdd %uint %1142 %uint_32 + %1144 = OpSelect %uint %1139 %1143 %1138 + %1145 = OpISub %uint %uint_3 %1144 + %1146 = OpIAdd %uint %1145 %1045 + %1147 = OpUGreaterThan %bool %1144 %uint_3 + OpSelectionMerge %1178 None + OpBranchConditional %1147 %1150 %1178 + %1150 = OpLabel + %1151 = OpIAdd %uint %1144 %uint_4294967293 + %1152 = OpUGreaterThanEqual %bool %1151 %uint_32 + OpSelectionMerge %1160 None + OpBranchConditional %1152 %1155 %1160 + %1155 = OpLabel + %1156 = OpBitwiseAnd %uint %1151 %uint_31 + %1157 = OpShiftLeftLogical %uint %1140 %1156 + %1158 = OpCompositeInsert %v2uint %1157 %355 1 + OpBranch %1160 + %1160 = OpLabel + %1161 = OpPhi %uint %uint_0 %1155 %354 %1150 + %1162 = OpPhi %v2uint %1158 %1155 %528 %1150 + %1163 = OpPhi %bool %false %1155 %true %1150 + OpSelectionMerge %1174 None + OpBranchConditional %1163 %1166 %1174 + %1166 = OpLabel + %1167 = OpShiftLeftLogical %uint %1136 %1151 + %1168 = OpBitwiseAnd %uint %1145 %uint_31 + %1169 = OpShiftRightLogical %uint %1140 %1168 + %1170 = OpBitwiseOr %uint %1169 %1167 + %1171 = OpShiftLeftLogical %uint %1140 %1151 + %1172 = OpCompositeConstruct %v2uint %1171 %1170 + OpBranch %1174 + %1174 = OpLabel + %1175 = OpPhi %uint %uint_0 %1166 %1161 %1160 + %1176 = OpPhi %v2uint %1172 %1166 %1162 %1160 + OpBranch %1178 + %1178 = OpLabel + %1179 = OpPhi %v2uint %1135 %1133 %1176 %1174 + %1180 = OpPhi %uint %1145 %1133 %1175 %1174 + %1181 = OpIAdd %uint %1180 %uint_5 + %1182 = OpBitwiseAnd %uint %1181 %uint_31 + %1183 = OpShiftLeftLogical %uint %uint_1 %1182 + %1184 = OpCompositeInsert %v2uint %1183 %355 1 + %1185 = OpIAdd %uint %1183 %uint_4294967295 + %1186 = OpCompositeInsert %v2uint %1185 %650 1 + %1187 = OpBitwiseAnd %v2uint %1186 %1179 + %1188 = OpCompositeExtract %uint %1187 1 + %1189 = OpBitwiseAnd %v2uint %1184 %1179 + %1190 = OpIAdd %uint %1180 %uint_2 + %1191 = OpBitwiseAnd %uint %1190 %uint_31 + %1192 = OpShiftLeftLogical %uint %uint_4 %1191 + %1193 = OpUGreaterThan %bool %1188 %1192 + %1194 = OpLogicalNot %bool %1193 + OpSelectionMerge %1225 None + OpBranchConditional %1194 %1197 %1225 + %1197 = OpLabel + %1198 = OpCompositeExtract %uint %1187 0 + %1199 = OpVectorShuffle %v2uint %1043 %528 1 4294967295 + %1200 = OpBitwiseOr %v2uint %1199 %1043 + %1201 = OpCompositeExtract %uint %1200 0 + %1202 = OpINotEqual %bool %1201 %uint_0 + %1203 = OpSelect %uint %1202 %uint_1 %uint_0 + %1204 = OpBitwiseOr %uint %1198 %1203 + %1205 = OpIEqual %bool %1188 %1192 + %1206 = OpINotEqual %bool %1204 %uint_0 + %1207 = OpSelect %bool %1205 %1206 %false + %1208 = OpLogicalNot %bool %1207 + OpSelectionMerge %1221 None + OpBranchConditional %1208 %1211 %1221 + %1211 = OpLabel + %1212 = OpINotEqual %bool %1188 %1192 + %1213 = OpLogicalOr %bool %1212 %1206 + %1214 = OpVectorShuffle %v2uint %1189 %528 1 4294967295 + %1215 = OpBitwiseOr %v2uint %1214 %1189 + %1216 = OpCompositeExtract %uint %1215 0 + %1217 = OpIEqual %bool %1216 %uint_0 + %1218 = OpSelect %bool %1213 %true %1217 + %1219 = OpLogicalNot %bool %1218 + OpBranch %1221 + %1221 = OpLabel + %1222 = OpPhi %v2uint %1179 %1211 %528 %1197 + %1223 = OpPhi %bool %1219 %1211 %1207 %1197 + OpBranch %1225 + %1225 = OpLabel + %1226 = OpPhi %v2uint %1222 %1221 %528 %1178 + %1227 = OpPhi %bool %1223 %1221 %1193 %1178 + OpSelectionMerge %1235 None + OpBranchConditional %1227 %1230 %1235 + %1230 = OpLabel + %1231 = OpCompositeExtract %uint %1179 1 + %1232 = OpIAdd %uint %1183 %1231 + %1233 = OpCompositeInsert %v2uint %1232 %1179 1 + OpBranch %1235 + %1235 = OpLabel + %1236 = OpPhi %v2uint %1233 %1230 %1226 %1225 + %1237 = OpCompositeExtract %uint %1236 1 + %1238 = OpShiftRightLogical %uint %1237 %1182 + %1239 = OpUGreaterThan %bool %1238 %uint_16777215 + %1240 = OpSelect %uint %1239 %uint_1 %uint_0 + %1241 = OpShiftRightLogical %uint %1238 %1240 + %1242 = OpIAdd %uint %1146 %1240 + %1243 = OpINotEqual %bool %1241 %uint_0 + OpSelectionMerge %1285 None + OpBranchConditional %1243 %1246 %1285 + %1246 = OpLabel + %1247 = OpSLessThanEqual %bool %1242 %uint_127 + OpSelectionMerge %1273 None + OpBranchConditional %1247 %1250 %1273 + %1250 = OpLabel + %1251 = OpSGreaterThanEqual %bool %1242 %uint_4294967170 + OpSelectionMerge %1262 None + OpBranchConditional %1251 %1254 %1262 + %1254 = OpLabel + %1255 = OpShiftLeftLogical %uint %1242 %uint_23 + %1256 = OpIAdd %uint %1255 %uint_1065353216 + %1257 = OpBitwiseAnd %uint %1241 %uint_8388607 + %1258 = OpBitwiseOr %uint %1256 %1257 + %1259 = OpBitwiseOr %uint %1258 %1134 + %1260 = OpBitcast %float %1259 + OpBranch %1262 + %1262 = OpLabel + %1263 = OpPhi %float %1260 %1254 %261 %1250 + %1264 = OpPhi %bool %false %1254 %true %1250 + OpSelectionMerge %1270 None + OpBranchConditional %1264 %1267 %1270 + %1267 = OpLabel + %1268 = OpBitcast %float %1134 + OpBranch %1270 + %1270 = OpLabel + %1271 = OpPhi %float %1268 %1267 %1263 %1262 + OpBranch %1273 + %1273 = OpLabel + %1274 = OpPhi %float %1271 %1270 %261 %1246 + %1275 = OpPhi %bool %false %1270 %true %1246 + OpSelectionMerge %1282 None + OpBranchConditional %1275 %1278 %1282 + %1278 = OpLabel + %1279 = OpBitwiseOr %uint %1134 %uint_2139095040 + %1280 = OpBitcast %float %1279 + OpBranch %1282 + %1282 = OpLabel + %1283 = OpPhi %float %1280 %1278 %1274 %1273 + OpBranch %1285 + %1285 = OpLabel + %1286 = OpPhi %float %1283 %1282 %float_0 %1235 + OpBranch %1288 + %1288 = OpLabel + %1289 = OpPhi %float %1286 %1285 %848 %860 + OpBranch %1291 + %1291 = OpLabel + %1292 = OpPhi %float %1289 %1288 %261 %856 + %1293 = OpPhi %bool %false %1288 %true %856 + OpSelectionMerge %1301 None + OpBranchConditional %1293 %1296 %1301 + %1296 = OpLabel + %1297 = OpVectorShuffle %v2float %839 %768 1 4294967295 + %1298 = OpFMul %v2float %839 %1297 + %1299 = OpCompositeExtract %float %1298 0 + OpBranch %1301 + %1301 = OpLabel + %1302 = OpPhi %float %1299 %1296 %1292 %1291 + OpBranch %1304 + %1304 = OpLabel + %1305 = OpPhi %float %1302 %1301 %848 %828 + OpBranch %1307 + %1307 = OpLabel + %1308 = OpPhi %float %1305 %1304 %802 %823 + OpBranch %1310 + %1310 = OpLabel + %1311 = OpPhi %float %261 %1307 %802 %818 + %1312 = OpPhi %float %1308 %1307 %261 %818 + %1313 = OpPhi %bool %false %1307 %true %818 + OpBranch %1315 + %1315 = OpLabel + %1316 = OpPhi %float %1311 %1310 %802 %813 + %1317 = OpPhi %float %1312 %1310 %261 %813 + %1318 = OpPhi %bool %1313 %1310 %814 %813 + OpBranch %1320 + %1320 = OpLabel + %1321 = OpPhi %float %1316 %1315 %802 %808 + %1322 = OpPhi %float %1317 %1315 %261 %808 + %1323 = OpPhi %bool %1318 %1315 %809 %808 + OpBranch %1325 + %1325 = OpLabel + %1326 = OpPhi %float %1321 %1320 %802 %801 + %1327 = OpPhi %float %1322 %1320 %261 %801 + %1328 = OpPhi %bool %1323 %1320 %804 %801 + OpBranch %1330 + %1330 = OpLabel + %1331 = OpPhi %float %1326 %1325 %261 %49 + %1332 = OpPhi %float %1327 %1325 %261 %49 + %1333 = OpPhi %bool %1328 %1325 %false %49 + %1334 = OpPhi %bool %false %1325 %true %49 + OpSelectionMerge %1340 None + OpBranchConditional %1334 %1337 %1340 + %1337 = OpLabel + %1338 = OpFSub %float %228 %228 + OpBranch %1340 + %1340 = OpLabel + %1341 = OpPhi %float %1338 %1337 %1331 %1330 + %1342 = OpPhi %float %261 %1337 %1332 %1330 + %1343 = OpPhi %bool %true %1337 %1333 %1330 + OpSelectionMerge %1350 None + OpBranchConditional %1343 %1346 %1350 + %1346 = OpLabel + %1347 = OpFMul %float %204 %float_7_54978942en08 + %1348 = OpFAdd %float %1347 %1341 + OpBranch %1350 + %1350 = OpLabel + %1351 = OpPhi %float %1348 %1346 %1342 %1340 + %1352 = OpIsNan %bool %226 + %1353 = OpLogicalNot %bool %1352 + OpSelectionMerge %1878 None + OpBranchConditional %1353 %1356 %1878 + %1356 = OpLabel + %1357 = OpIsNan %bool %float_1_57079625 + %1358 = OpLogicalNot %bool %1357 + OpSelectionMerge %1874 None + OpBranchConditional %1358 %1361 %1874 + %1361 = OpLabel + %1362 = OpIsNan %bool %1351 + %1363 = OpLogicalNot %bool %1362 + OpSelectionMerge %1870 None + OpBranchConditional %1363 %1366 %1870 + %1366 = OpLabel + %1367 = OpIsInf %bool %226 + %1368 = OpLogicalNot %bool %1367 + OpSelectionMerge %1866 None + OpBranchConditional %1368 %1371 %1866 + %1371 = OpLabel + %1372 = OpIsInf %bool %float_1_57079625 + %1373 = OpLogicalNot %bool %1372 + OpSelectionMerge %1862 None + OpBranchConditional %1373 %1376 %1862 + %1376 = OpLabel + %1377 = OpIsInf %bool %1351 + %1378 = OpLogicalNot %bool %1377 + OpSelectionMerge %1859 None + OpBranchConditional %1378 %1381 %1859 + %1381 = OpLabel + %1382 = OpCompositeInsert %v2float %226 %262 1 + %1383 = OpBitcast %v2uint %1382 + %1384 = OpBitwiseAnd %v2uint %1383 %267 + %1385 = OpINotEqual %v2bool %1384 %270 + %1386 = OpBitwiseAnd %v2uint %1383 %272 + %1387 = OpIEqual %v2bool %1386 %270 + %1388 = OpLogicalOr %v2bool %1387 %1385 + %1389 = OpBitwiseAnd %v2uint %1383 %277 + %1390 = OpBitcast %v2float %1389 + %1391 = OpSelect %v2float %1388 %1382 %1390 + %1392 = OpBitcast %uint %1351 + %1393 = OpBitwiseAnd %uint %1392 %uint_2139095040 + %1394 = OpINotEqual %bool %1393 %uint_0 + %1395 = OpBitwiseAnd %uint %1392 %uint_8388607 + %1396 = OpIEqual %bool %1395 %uint_0 + %1397 = OpLogicalOr %bool %1396 %1394 + %1398 = OpBitwiseAnd %uint %1392 %uint_2147483648 + %1399 = OpBitcast %float %1398 + %1400 = OpSelect %float %1397 %1351 %1399 + %1401 = OpFOrdEqual %v2bool %1391 %290 + %1402 = OpVectorShuffle %v2bool %1401 %292 1 4294967295 + %1403 = OpLogicalOr %v2bool %1402 %1401 + %1404 = OpCompositeExtract %bool %1403 0 + %1405 = OpLogicalNot %bool %1404 + OpSelectionMerge %1856 None + OpBranchConditional %1405 %1408 %1856 + %1408 = OpLabel + %1409 = OpFUnordNotEqual %bool %1400 %float_0 + OpSelectionMerge %1843 None + OpBranchConditional %1409 %1412 %1843 + %1412 = OpLabel + %1413 = OpBitcast %v2uint %1391 + %1414 = OpCompositeExtract %uint %1413 1 + %1415 = OpShiftRightLogical %uint %1414 %uint_23 + %1416 = OpBitwiseAnd %uint %1415 %uint_255 + %1417 = OpCompositeExtract %uint %1413 0 + %1418 = OpShiftRightLogical %uint %1417 %uint_23 + %1419 = OpBitwiseAnd %uint %1418 %uint_255 + %1420 = OpBitcast %uint %1400 + %1421 = OpShiftRightLogical %uint %1420 %uint_23 + %1422 = OpBitwiseAnd %uint %1421 %uint_255 + %1423 = OpIAdd %uint %1422 %uint_4294967169 + %1424 = OpBitwiseAnd %v2uint %1413 %272 + %1425 = OpBitwiseOr %v2uint %1424 %319 + %1426 = OpBitwiseAnd %uint %1420 %uint_2147483648 + %1427 = OpBitwiseXor %uint %1417 %1414 + %1428 = OpBitwiseAnd %uint %1427 %uint_2147483648 + %1429 = OpCompositeExtract %uint %1425 0 + %1430 = OpCompositeExtract %uint %1425 1 + %1431 = OpUMulExtended %_struct_58 %1430 %1429 + %1432 = OpCompositeExtract %uint %1431 1 + %1433 = OpIMul %uint %1429 %1430 + %1434 = OpShiftLeftLogical %uint %1432 %uint_14 + %1435 = OpShiftRightLogical %uint %1433 %uint_18 + %1436 = OpBitwiseOr %uint %1435 %1434 + %1437 = OpShiftLeftLogical %uint %1433 %uint_14 + %1438 = OpCompositeConstruct %v2uint %1437 %1436 + %1439 = OpBitwiseOr %uint %1436 %1437 + %1440 = OpIEqual %bool %1439 %uint_0 + %1441 = OpIAdd %uint %1416 %uint_4294967042 + %1442 = OpIAdd %uint %1441 %1419 + %1443 = OpSelect %uint %1440 %uint_0 %1442 + %1444 = OpBitwiseOr %uint %1443 %1439 + %1445 = OpINotEqual %bool %1444 %uint_0 + OpSelectionMerge %1840 None + OpBranchConditional %1445 %1448 %1840 + %1448 = OpLabel + %1449 = OpISub %uint %1443 %1423 + %1450 = OpShiftLeftLogical %uint %1420 %uint_5 + %1451 = OpBitwiseAnd %uint %1450 %uint_268435424 + %1452 = OpBitwiseOr %uint %1451 %uint_268435456 + %1453 = OpCompositeInsert %v2uint %1452 %355 1 + %1454 = OpExtInst %uint %184 SAbs %1449 + %1455 = OpINotEqual %bool %1454 %uint_0 + OpSelectionMerge %1482 None + OpBranchConditional %1455 %1458 %1482 + %1458 = OpLabel + %1459 = OpUGreaterThanEqual %bool %1454 %uint_32 + OpSelectionMerge %1467 None + OpBranchConditional %1459 %1462 %1467 + %1462 = OpLabel + %1463 = OpBitwiseAnd %uint %1454 %uint_31 + %1464 = OpShiftLeftLogical %uint %uint_1 %1463 + %1465 = OpCompositeInsert %v2uint %1464 %355 1 + OpBranch %1467 + %1467 = OpLabel + %1468 = OpPhi %v2uint %1465 %1462 %528 %1458 + %1469 = OpPhi %bool %false %1462 %true %1458 + OpSelectionMerge %1479 None + OpBranchConditional %1469 %1472 %1479 + %1472 = OpLabel + %1473 = OpISub %uint %uint_0 %1454 + %1474 = OpBitwiseAnd %uint %1473 %uint_31 + %1475 = OpShiftRightLogical %uint %uint_1 %1474 + %1476 = OpShiftLeftLogical %uint %uint_1 %1454 + %1477 = OpCompositeConstruct %v2uint %1476 %1475 + OpBranch %1479 + %1479 = OpLabel + %1480 = OpPhi %v2uint %1477 %1472 %1468 %1467 + OpBranch %1482 + %1482 = OpLabel + %1483 = OpPhi %v2uint %7106 %1448 %1480 %1479 + %1484 = OpCompositeExtract %uint %1483 0 + %1485 = OpShiftRightLogical %uint %1484 %uint_1 + %1486 = OpIAdd %uint %1485 %uint_2147483647 + %1487 = OpBitwiseAnd %uint %1484 %uint_1 + %1488 = OpIAdd %uint %1486 %1487 + %1489 = OpShiftRightLogical %uint %1488 %uint_31 + %1490 = OpIAdd %uint %1484 %uint_4294967295 + %1491 = OpCompositeExtract %uint %1483 1 + %1492 = OpIAdd %uint %1491 %uint_4294967295 + %1493 = OpIAdd %uint %1492 %1489 + %1494 = OpCompositeConstruct %v2uint %1490 %1493 + %1495 = OpSLessThanEqual %bool %1449 %uint_0 + OpSelectionMerge %1547 None + OpBranchConditional %1495 %1498 %1547 + %1498 = OpLabel + %1499 = OpSGreaterThanEqual %bool %1449 %uint_4294967233 + OpSelectionMerge %1542 None + OpBranchConditional %1499 %1502 %1542 + %1502 = OpLabel + %1503 = OpISub %uint %uint_0 %1449 + %1504 = OpBitwiseAnd %v2uint %1494 %1438 + %1505 = OpINotEqual %bool %1443 %1423 + OpSelectionMerge %1537 None + OpBranchConditional %1505 %1508 %1537 + %1508 = OpLabel + %1509 = OpUGreaterThanEqual %bool %1503 %uint_32 + OpSelectionMerge %1517 None + OpBranchConditional %1509 %1512 %1517 + %1512 = OpLabel + %1513 = OpBitwiseAnd %uint %1503 %uint_31 + %1514 = OpShiftRightLogical %uint %1436 %1513 + %1515 = OpCompositeInsert %v2uint %1514 %420 0 + OpBranch %1517 + %1517 = OpLabel + %1518 = OpPhi %v2uint %1453 %1512 %528 %1508 + %1519 = OpPhi %v2uint %1504 %1512 %528 %1508 + %1520 = OpPhi %v2uint %1515 %1512 %528 %1508 + %1521 = OpPhi %bool %false %1512 %true %1508 + OpSelectionMerge %1532 None + OpBranchConditional %1521 %1524 %1532 + %1524 = OpLabel + %1525 = OpShiftRightLogical %uint %1437 %1503 + %1526 = OpBitwiseAnd %uint %1449 %uint_31 + %1527 = OpShiftLeftLogical %uint %1436 %1526 + %1528 = OpBitwiseOr %uint %1527 %1525 + %1529 = OpShiftRightLogical %uint %1436 %1503 + %1530 = OpCompositeConstruct %v2uint %1528 %1529 + OpBranch %1532 + %1532 = OpLabel + %1533 = OpPhi %v2uint %1453 %1524 %1518 %1517 + %1534 = OpPhi %v2uint %1504 %1524 %1519 %1517 + %1535 = OpPhi %v2uint %1530 %1524 %1520 %1517 + OpBranch %1537 + %1537 = OpLabel + %1538 = OpPhi %v2uint %1533 %1532 %1453 %1502 + %1539 = OpPhi %v2uint %1534 %1532 %1504 %1502 + %1540 = OpPhi %v2uint %1535 %1532 %1438 %1502 + OpBranch %1542 + %1542 = OpLabel + %1543 = OpPhi %v2uint %1538 %1537 %1453 %1498 + %1544 = OpPhi %v2uint %1539 %1537 %1438 %1498 + %1545 = OpPhi %v2uint %1540 %1537 %270 %1498 + OpBranch %1547 + %1547 = OpLabel + %1548 = OpPhi %v2uint %1543 %1542 %528 %1482 + %1549 = OpPhi %v2uint %1544 %1542 %528 %1482 + %1550 = OpPhi %v2uint %1545 %1542 %528 %1482 + %1551 = OpPhi %bool %false %1542 %true %1482 + OpSelectionMerge %1593 None + OpBranchConditional %1551 %1554 %1593 + %1554 = OpLabel + %1555 = OpULessThanEqual %bool %1449 %uint_63 + OpSelectionMerge %1588 None + OpBranchConditional %1555 %1558 %1588 + %1558 = OpLabel + %1559 = OpBitwiseAnd %uint %1493 %1452 + %1560 = OpCompositeInsert %v2uint %1559 %355 1 + %1561 = OpUGreaterThanEqual %bool %1449 %uint_32 + OpSelectionMerge %1569 None + OpBranchConditional %1561 %1564 %1569 + %1564 = OpLabel + %1565 = OpBitwiseAnd %uint %1449 %uint_31 + %1566 = OpShiftRightLogical %uint %1452 %1565 + %1567 = OpCompositeInsert %v2uint %1566 %420 0 + OpBranch %1569 + %1569 = OpLabel + %1570 = OpPhi %v2uint %1567 %1564 %528 %1558 + %1571 = OpPhi %v2uint %1560 %1564 %528 %1558 + %1572 = OpPhi %v2uint %1438 %1564 %528 %1558 + %1573 = OpPhi %bool %false %1564 %true %1558 + OpSelectionMerge %1583 None + OpBranchConditional %1573 %1576 %1583 + %1576 = OpLabel + %1577 = OpISub %uint %uint_0 %1449 + %1578 = OpBitwiseAnd %uint %1577 %uint_31 + %1579 = OpShiftLeftLogical %uint %1452 %1578 + %1580 = OpShiftRightLogical %uint %1452 %1449 + %1581 = OpCompositeConstruct %v2uint %1579 %1580 + OpBranch %1583 + %1583 = OpLabel + %1584 = OpPhi %v2uint %1581 %1576 %1570 %1569 + %1585 = OpPhi %v2uint %1560 %1576 %1571 %1569 + %1586 = OpPhi %v2uint %1438 %1576 %1572 %1569 + OpBranch %1588 + %1588 = OpLabel + %1589 = OpPhi %v2uint %1584 %1583 %270 %1554 + %1590 = OpPhi %v2uint %1585 %1583 %1453 %1554 + %1591 = OpPhi %v2uint %1586 %1583 %1438 %1554 + OpBranch %1593 + %1593 = OpLabel + %1594 = OpPhi %v2uint %1550 %1547 %1591 %1588 + %1595 = OpPhi %v2uint %1549 %1547 %1590 %1588 + %1596 = OpPhi %v2uint %1548 %1547 %1589 %1588 + %1597 = OpExtInst %uint %184 SMax %1443 %1423 + %1598 = OpINotEqual %bool %1426 %1428 + OpSelectionMerge %1645 None + OpBranchConditional %1598 %1601 %1645 + %1601 = OpLabel + %1602 = OpCompositeExtract %uint %1596 0 + %1603 = OpBitwiseXor %uint %1602 %uint_4294967295 + %1604 = OpCompositeExtract %uint %1596 1 + %1605 = OpBitwiseXor %uint %1604 %uint_4294967295 + %1606 = OpShiftRightLogical %uint %1603 %uint_1 + %1607 = OpBitwiseAnd %uint %1603 %uint_1 + %1608 = OpIAdd %uint %1606 %1607 + %1609 = OpShiftRightLogical %uint %1608 %uint_31 + %1610 = OpISub %uint %uint_0 %1602 + %1611 = OpCompositeExtract %uint %1594 0 + %1612 = OpShiftRightLogical %uint %1611 %uint_1 + %1613 = OpShiftRightLogical %uint %1610 %uint_1 + %1614 = OpIAdd %uint %1613 %1612 + %1615 = OpBitwiseAnd %uint %1611 %uint_1 + %1616 = OpBitwiseAnd %uint %1615 %1610 + %1617 = OpIAdd %uint %1614 %1616 + %1618 = OpShiftRightLogical %uint %1617 %uint_31 + %1619 = OpISub %uint %1611 %1602 + %1620 = OpCompositeExtract %uint %1594 1 + %1621 = OpVectorShuffle %v2uint %1595 %528 1 4294967295 + %1622 = OpBitwiseOr %v2uint %1621 %1595 + %1623 = OpCompositeExtract %uint %1622 0 + %1624 = OpINotEqual %bool %1623 %uint_0 + %1625 = OpSGreaterThan %bool %1443 %1423 + %1626 = OpSelect %bool %1624 %1625 %false + %1627 = OpSelect %v2uint %1626 %536 %270 + %1628 = OpCompositeExtract %uint %1627 0 + %1629 = OpShiftRightLogical %uint %1619 %uint_1 + %1630 = OpShiftRightLogical %uint %1628 %uint_1 + %1631 = OpIAdd %uint %1630 %1629 + %1632 = OpBitwiseAnd %uint %1619 %uint_1 + %1633 = OpBitwiseAnd %uint %1632 %1628 + %1634 = OpIAdd %uint %1631 %1633 + %1635 = OpShiftRightLogical %uint %1634 %uint_31 + %1636 = OpIAdd %uint %1628 %1619 + %1637 = OpCompositeExtract %uint %1627 1 + %1638 = OpIAdd %uint %1620 %1605 + %1639 = OpIAdd %uint %1638 %1609 + %1640 = OpIAdd %uint %1639 %1618 + %1641 = OpIAdd %uint %1640 %1637 + %1642 = OpIAdd %uint %1641 %1635 + %1643 = OpCompositeConstruct %v2uint %1636 %1642 + OpBranch %1645 + %1645 = OpLabel + %1646 = OpPhi %v2uint %1643 %1601 %528 %1593 + %1647 = OpPhi %bool %false %1601 %true %1593 + OpSelectionMerge %1666 None + OpBranchConditional %1647 %1650 %1666 + %1650 = OpLabel + %1651 = OpCompositeExtract %uint %1594 0 + %1652 = OpCompositeExtract %uint %1596 0 + %1653 = OpShiftRightLogical %uint %1651 %uint_1 + %1654 = OpShiftRightLogical %uint %1652 %uint_1 + %1655 = OpIAdd %uint %1654 %1653 + %1656 = OpBitwiseAnd %uint %1651 %uint_1 + %1657 = OpBitwiseAnd %uint %1656 %1652 + %1658 = OpIAdd %uint %1655 %1657 + %1659 = OpShiftRightLogical %uint %1658 %uint_31 + %1660 = OpIAdd %uint %1652 %1651 + %1661 = OpIAdd %v2uint %1596 %1594 + %1662 = OpCompositeExtract %uint %1661 1 + %1663 = OpIAdd %uint %1659 %1662 + %1664 = OpCompositeConstruct %v2uint %1660 %1663 + OpBranch %1666 + %1666 = OpLabel + %1667 = OpPhi %v2uint %1664 %1650 %1646 %1645 + %1668 = OpCompositeExtract %uint %1667 1 + %1669 = OpSLessThan %bool %1668 %uint_0 + OpSelectionMerge %1685 None + OpBranchConditional %1669 %1672 %1685 + %1672 = OpLabel + %1673 = OpCompositeExtract %uint %1667 0 + %1674 = OpBitwiseXor %uint %1673 %uint_4294967295 + %1675 = OpBitwiseXor %uint %1668 %uint_4294967295 + %1676 = OpShiftRightLogical %uint %1674 %uint_1 + %1677 = OpBitwiseAnd %uint %1674 %uint_1 + %1678 = OpIAdd %uint %1676 %1677 + %1679 = OpShiftRightLogical %uint %1678 %uint_31 + %1680 = OpISub %uint %uint_0 %1673 + %1681 = OpIAdd %uint %1679 %1675 + %1682 = OpCompositeConstruct %v2uint %1680 %1681 + %1683 = OpBitwiseXor %uint %1428 %uint_2147483648 + OpBranch %1685 + %1685 = OpLabel + %1686 = OpPhi %uint %1683 %1672 %1428 %1666 + %1687 = OpPhi %v2uint %1682 %1672 %1667 %1666 + %1688 = OpCompositeExtract %uint %1687 1 + %1689 = OpExtInst %uint %184 FindUMsb %1688 + %1690 = OpISub %uint %uint_31 %1689 + %1691 = OpIEqual %bool %1688 %uint_0 + %1692 = OpCompositeExtract %uint %1687 0 + %1693 = OpExtInst %uint %184 FindUMsb %1692 + %1694 = OpISub %uint %uint_31 %1693 + %1695 = OpIAdd %uint %1694 %uint_32 + %1696 = OpSelect %uint %1691 %1695 %1690 + %1697 = OpISub %uint %uint_3 %1696 + %1698 = OpIAdd %uint %1697 %1597 + %1699 = OpUGreaterThan %bool %1696 %uint_3 + OpSelectionMerge %1730 None + OpBranchConditional %1699 %1702 %1730 + %1702 = OpLabel + %1703 = OpIAdd %uint %1696 %uint_4294967293 + %1704 = OpUGreaterThanEqual %bool %1703 %uint_32 + OpSelectionMerge %1712 None + OpBranchConditional %1704 %1707 %1712 + %1707 = OpLabel + %1708 = OpBitwiseAnd %uint %1703 %uint_31 + %1709 = OpShiftLeftLogical %uint %1692 %1708 + %1710 = OpCompositeInsert %v2uint %1709 %355 1 + OpBranch %1712 + %1712 = OpLabel + %1713 = OpPhi %uint %uint_0 %1707 %354 %1702 + %1714 = OpPhi %v2uint %1710 %1707 %528 %1702 + %1715 = OpPhi %bool %false %1707 %true %1702 + OpSelectionMerge %1726 None + OpBranchConditional %1715 %1718 %1726 + %1718 = OpLabel + %1719 = OpShiftLeftLogical %uint %1688 %1703 + %1720 = OpBitwiseAnd %uint %1697 %uint_31 + %1721 = OpShiftRightLogical %uint %1692 %1720 + %1722 = OpBitwiseOr %uint %1721 %1719 + %1723 = OpShiftLeftLogical %uint %1692 %1703 + %1724 = OpCompositeConstruct %v2uint %1723 %1722 + OpBranch %1726 + %1726 = OpLabel + %1727 = OpPhi %uint %uint_0 %1718 %1713 %1712 + %1728 = OpPhi %v2uint %1724 %1718 %1714 %1712 + OpBranch %1730 + %1730 = OpLabel + %1731 = OpPhi %v2uint %1687 %1685 %1728 %1726 + %1732 = OpPhi %uint %1697 %1685 %1727 %1726 + %1733 = OpIAdd %uint %1732 %uint_5 + %1734 = OpBitwiseAnd %uint %1733 %uint_31 + %1735 = OpShiftLeftLogical %uint %uint_1 %1734 + %1736 = OpCompositeInsert %v2uint %1735 %355 1 + %1737 = OpIAdd %uint %1735 %uint_4294967295 + %1738 = OpCompositeInsert %v2uint %1737 %650 1 + %1739 = OpBitwiseAnd %v2uint %1738 %1731 + %1740 = OpCompositeExtract %uint %1739 1 + %1741 = OpBitwiseAnd %v2uint %1736 %1731 + %1742 = OpIAdd %uint %1732 %uint_2 + %1743 = OpBitwiseAnd %uint %1742 %uint_31 + %1744 = OpShiftLeftLogical %uint %uint_4 %1743 + %1745 = OpUGreaterThan %bool %1740 %1744 + %1746 = OpLogicalNot %bool %1745 + OpSelectionMerge %1777 None + OpBranchConditional %1746 %1749 %1777 + %1749 = OpLabel + %1750 = OpCompositeExtract %uint %1739 0 + %1751 = OpVectorShuffle %v2uint %1595 %528 1 4294967295 + %1752 = OpBitwiseOr %v2uint %1751 %1595 + %1753 = OpCompositeExtract %uint %1752 0 + %1754 = OpINotEqual %bool %1753 %uint_0 + %1755 = OpSelect %uint %1754 %uint_1 %uint_0 + %1756 = OpBitwiseOr %uint %1750 %1755 + %1757 = OpIEqual %bool %1740 %1744 + %1758 = OpINotEqual %bool %1756 %uint_0 + %1759 = OpSelect %bool %1757 %1758 %false + %1760 = OpLogicalNot %bool %1759 + OpSelectionMerge %1773 None + OpBranchConditional %1760 %1763 %1773 + %1763 = OpLabel + %1764 = OpINotEqual %bool %1740 %1744 + %1765 = OpLogicalOr %bool %1764 %1758 + %1766 = OpVectorShuffle %v2uint %1741 %528 1 4294967295 + %1767 = OpBitwiseOr %v2uint %1766 %1741 + %1768 = OpCompositeExtract %uint %1767 0 + %1769 = OpIEqual %bool %1768 %uint_0 + %1770 = OpSelect %bool %1765 %true %1769 + %1771 = OpLogicalNot %bool %1770 + OpBranch %1773 + %1773 = OpLabel + %1774 = OpPhi %v2uint %1731 %1763 %528 %1749 + %1775 = OpPhi %bool %1771 %1763 %1759 %1749 + OpBranch %1777 + %1777 = OpLabel + %1778 = OpPhi %v2uint %1774 %1773 %528 %1730 + %1779 = OpPhi %bool %1775 %1773 %1745 %1730 + OpSelectionMerge %1787 None + OpBranchConditional %1779 %1782 %1787 + %1782 = OpLabel + %1783 = OpCompositeExtract %uint %1731 1 + %1784 = OpIAdd %uint %1735 %1783 + %1785 = OpCompositeInsert %v2uint %1784 %1731 1 + OpBranch %1787 + %1787 = OpLabel + %1788 = OpPhi %v2uint %1785 %1782 %1778 %1777 + %1789 = OpCompositeExtract %uint %1788 1 + %1790 = OpShiftRightLogical %uint %1789 %1734 + %1791 = OpUGreaterThan %bool %1790 %uint_16777215 + %1792 = OpSelect %uint %1791 %uint_1 %uint_0 + %1793 = OpShiftRightLogical %uint %1790 %1792 + %1794 = OpIAdd %uint %1698 %1792 + %1795 = OpINotEqual %bool %1793 %uint_0 + OpSelectionMerge %1837 None + OpBranchConditional %1795 %1798 %1837 + %1798 = OpLabel + %1799 = OpSLessThanEqual %bool %1794 %uint_127 + OpSelectionMerge %1825 None + OpBranchConditional %1799 %1802 %1825 + %1802 = OpLabel + %1803 = OpSGreaterThanEqual %bool %1794 %uint_4294967170 + OpSelectionMerge %1814 None + OpBranchConditional %1803 %1806 %1814 + %1806 = OpLabel + %1807 = OpShiftLeftLogical %uint %1794 %uint_23 + %1808 = OpIAdd %uint %1807 %uint_1065353216 + %1809 = OpBitwiseAnd %uint %1793 %uint_8388607 + %1810 = OpBitwiseOr %uint %1808 %1809 + %1811 = OpBitwiseOr %uint %1810 %1686 + %1812 = OpBitcast %float %1811 + OpBranch %1814 + %1814 = OpLabel + %1815 = OpPhi %float %1812 %1806 %261 %1802 + %1816 = OpPhi %bool %false %1806 %true %1802 + OpSelectionMerge %1822 None + OpBranchConditional %1816 %1819 %1822 + %1819 = OpLabel + %1820 = OpBitcast %float %1686 + OpBranch %1822 + %1822 = OpLabel + %1823 = OpPhi %float %1820 %1819 %1815 %1814 + OpBranch %1825 + %1825 = OpLabel + %1826 = OpPhi %float %1823 %1822 %261 %1798 + %1827 = OpPhi %bool %false %1822 %true %1798 + OpSelectionMerge %1834 None + OpBranchConditional %1827 %1830 %1834 + %1830 = OpLabel + %1831 = OpBitwiseOr %uint %1686 %uint_2139095040 + %1832 = OpBitcast %float %1831 + OpBranch %1834 + %1834 = OpLabel + %1835 = OpPhi %float %1832 %1830 %1826 %1825 + OpBranch %1837 + %1837 = OpLabel + %1838 = OpPhi %float %1835 %1834 %float_0 %1787 + OpBranch %1840 + %1840 = OpLabel + %1841 = OpPhi %float %1838 %1837 %1400 %1412 + OpBranch %1843 + %1843 = OpLabel + %1844 = OpPhi %float %1841 %1840 %261 %1408 + %1845 = OpPhi %bool %false %1840 %true %1408 + OpSelectionMerge %1853 None + OpBranchConditional %1845 %1848 %1853 + %1848 = OpLabel + %1849 = OpVectorShuffle %v2float %1391 %768 1 4294967295 + %1850 = OpFMul %v2float %1391 %1849 + %1851 = OpCompositeExtract %float %1850 0 + OpBranch %1853 + %1853 = OpLabel + %1854 = OpPhi %float %1851 %1848 %1844 %1843 + OpBranch %1856 + %1856 = OpLabel + %1857 = OpPhi %float %1854 %1853 %1400 %1381 + OpBranch %1859 + %1859 = OpLabel + %1860 = OpPhi %float %1857 %1856 %1351 %1376 + OpBranch %1862 + %1862 = OpLabel + %1863 = OpPhi %float %1860 %1859 %261 %1371 + %1864 = OpPhi %bool %false %1859 %true %1371 + OpBranch %1866 + %1866 = OpLabel + %1867 = OpPhi %float %1863 %1862 %261 %1366 + %1868 = OpPhi %bool %1864 %1862 %1367 %1366 + OpBranch %1870 + %1870 = OpLabel + %1871 = OpPhi %float %1867 %1866 %261 %1361 + %1872 = OpPhi %bool %1868 %1866 %1362 %1361 + OpBranch %1874 + %1874 = OpLabel + %1875 = OpPhi %float %1871 %1870 %261 %1356 + %1876 = OpPhi %bool %1872 %1870 %1357 %1356 + OpBranch %1878 + %1878 = OpLabel + %1879 = OpPhi %float %1875 %1874 %261 %1350 + %1880 = OpPhi %bool %1876 %1874 %1352 %1350 + OpSelectionMerge %1887 None + OpBranchConditional %1880 %1883 %1887 + %1883 = OpLabel + %1884 = OpFMul %float %226 %float_1_57079625 + %1885 = OpFAdd %float %1884 %1351 + OpBranch %1887 + %1887 = OpLabel + %1888 = OpPhi %float %1885 %1883 %1879 %1878 + %1889 = OpFAdd %float %228 %1888 + %1890 = OpFSub %float %1889 %228 + %1891 = OpFSub %float %1888 %1890 + %1892 = OpShiftRightLogical %uint %162 %uint_30 + %1893 = OpIAdd %uint %178 %1892 + OpBranch %1895 + %1895 = OpLabel + %1896 = OpPhi %uint %1893 %1887 %354 %36 + %1897 = OpPhi %float %1889 %1887 %261 %36 + %1898 = OpPhi %float %1891 %1887 %261 %36 + %1899 = OpPhi %bool %false %1887 %true %36 + OpSelectionMerge %3537 None + OpBranchConditional %1899 %1902 %3537 + %1902 = OpLabel + %1904 = OpFMul %float %42 %float_0_636619747 + %1906 = OpFAdd %float %1904 %float_0_5 + %1907 = OpExtInst %float %184 Trunc %1906 + %1908 = OpFMul %float %1907 %float_1_57079625 + %1909 = OpFNegate %float %1908 + %1910 = OpIsNan %bool %1907 + %1911 = OpLogicalNot %bool %1910 + OpSelectionMerge %2436 None + OpBranchConditional %1911 %1914 %2436 + %1914 = OpLabel + %1915 = OpIsNan %bool %float_1_57079625 + %1916 = OpLogicalNot %bool %1915 + OpSelectionMerge %2432 None + OpBranchConditional %1916 %1919 %2432 + %1919 = OpLabel + %1920 = OpIsNan %bool %1909 + %1921 = OpLogicalNot %bool %1920 + OpSelectionMerge %2428 None + OpBranchConditional %1921 %1924 %2428 + %1924 = OpLabel + %1925 = OpIsInf %bool %1907 + %1926 = OpLogicalNot %bool %1925 + OpSelectionMerge %2424 None + OpBranchConditional %1926 %1929 %2424 + %1929 = OpLabel + %1930 = OpIsInf %bool %float_1_57079625 + %1931 = OpLogicalNot %bool %1930 + OpSelectionMerge %2420 None + OpBranchConditional %1931 %1934 %2420 + %1934 = OpLabel + %1935 = OpIsInf %bool %1909 + %1936 = OpLogicalNot %bool %1935 + OpSelectionMerge %2417 None + OpBranchConditional %1936 %1939 %2417 + %1939 = OpLabel + %1940 = OpCompositeInsert %v2float %1907 %262 1 + %1941 = OpBitcast %v2uint %1940 + %1942 = OpBitwiseAnd %v2uint %1941 %267 + %1943 = OpINotEqual %v2bool %1942 %270 + %1944 = OpBitwiseAnd %v2uint %1941 %272 + %1945 = OpIEqual %v2bool %1944 %270 + %1946 = OpLogicalOr %v2bool %1945 %1943 + %1947 = OpBitwiseAnd %v2uint %1941 %277 + %1948 = OpBitcast %v2float %1947 + %1949 = OpSelect %v2float %1946 %1940 %1948 + %1950 = OpBitcast %uint %1909 + %1951 = OpBitwiseAnd %uint %1950 %uint_2139095040 + %1952 = OpINotEqual %bool %1951 %uint_0 + %1953 = OpBitwiseAnd %uint %1950 %uint_8388607 + %1954 = OpIEqual %bool %1953 %uint_0 + %1955 = OpLogicalOr %bool %1954 %1952 + %1956 = OpBitwiseAnd %uint %1950 %uint_2147483648 + %1957 = OpBitcast %float %1956 + %1958 = OpSelect %float %1955 %1909 %1957 + %1959 = OpFOrdEqual %v2bool %1949 %290 + %1960 = OpVectorShuffle %v2bool %1959 %292 1 4294967295 + %1961 = OpLogicalOr %v2bool %1960 %1959 + %1962 = OpCompositeExtract %bool %1961 0 + %1963 = OpLogicalNot %bool %1962 + OpSelectionMerge %2414 None + OpBranchConditional %1963 %1966 %2414 + %1966 = OpLabel + %1967 = OpFUnordNotEqual %bool %1958 %float_0 + OpSelectionMerge %2401 None + OpBranchConditional %1967 %1970 %2401 + %1970 = OpLabel + %1971 = OpBitcast %v2uint %1949 + %1972 = OpCompositeExtract %uint %1971 1 + %1973 = OpShiftRightLogical %uint %1972 %uint_23 + %1974 = OpBitwiseAnd %uint %1973 %uint_255 + %1975 = OpCompositeExtract %uint %1971 0 + %1976 = OpShiftRightLogical %uint %1975 %uint_23 + %1977 = OpBitwiseAnd %uint %1976 %uint_255 + %1978 = OpBitcast %uint %1958 + %1979 = OpShiftRightLogical %uint %1978 %uint_23 + %1980 = OpBitwiseAnd %uint %1979 %uint_255 + %1981 = OpIAdd %uint %1980 %uint_4294967169 + %1982 = OpBitwiseAnd %v2uint %1971 %272 + %1983 = OpBitwiseOr %v2uint %1982 %319 + %1984 = OpBitwiseAnd %uint %1978 %uint_2147483648 + %1985 = OpBitwiseXor %uint %1975 %1972 + %1986 = OpBitwiseAnd %uint %1985 %uint_2147483648 + %1987 = OpCompositeExtract %uint %1983 0 + %1988 = OpCompositeExtract %uint %1983 1 + %1989 = OpUMulExtended %_struct_58 %1988 %1987 + %1990 = OpCompositeExtract %uint %1989 1 + %1991 = OpIMul %uint %1987 %1988 + %1992 = OpShiftLeftLogical %uint %1990 %uint_14 + %1993 = OpShiftRightLogical %uint %1991 %uint_18 + %1994 = OpBitwiseOr %uint %1993 %1992 + %1995 = OpShiftLeftLogical %uint %1991 %uint_14 + %1996 = OpCompositeConstruct %v2uint %1995 %1994 + %1997 = OpBitwiseOr %uint %1994 %1995 + %1998 = OpIEqual %bool %1997 %uint_0 + %1999 = OpIAdd %uint %1974 %uint_4294967042 + %2000 = OpIAdd %uint %1999 %1977 + %2001 = OpSelect %uint %1998 %uint_0 %2000 + %2002 = OpBitwiseOr %uint %2001 %1997 + %2003 = OpINotEqual %bool %2002 %uint_0 + OpSelectionMerge %2398 None + OpBranchConditional %2003 %2006 %2398 + %2006 = OpLabel + %2007 = OpISub %uint %2001 %1981 + %2008 = OpShiftLeftLogical %uint %1978 %uint_5 + %2009 = OpBitwiseAnd %uint %2008 %uint_268435424 + %2010 = OpBitwiseOr %uint %2009 %uint_268435456 + %2011 = OpCompositeInsert %v2uint %2010 %355 1 + %2012 = OpExtInst %uint %184 SAbs %2007 + %2013 = OpINotEqual %bool %2012 %uint_0 + OpSelectionMerge %2040 None + OpBranchConditional %2013 %2016 %2040 + %2016 = OpLabel + %2017 = OpUGreaterThanEqual %bool %2012 %uint_32 + OpSelectionMerge %2025 None + OpBranchConditional %2017 %2020 %2025 + %2020 = OpLabel + %2021 = OpBitwiseAnd %uint %2012 %uint_31 + %2022 = OpShiftLeftLogical %uint %uint_1 %2021 + %2023 = OpCompositeInsert %v2uint %2022 %355 1 + OpBranch %2025 + %2025 = OpLabel + %2026 = OpPhi %v2uint %2023 %2020 %528 %2016 + %2027 = OpPhi %bool %false %2020 %true %2016 + OpSelectionMerge %2037 None + OpBranchConditional %2027 %2030 %2037 + %2030 = OpLabel + %2031 = OpISub %uint %uint_0 %2012 + %2032 = OpBitwiseAnd %uint %2031 %uint_31 + %2033 = OpShiftRightLogical %uint %uint_1 %2032 + %2034 = OpShiftLeftLogical %uint %uint_1 %2012 + %2035 = OpCompositeConstruct %v2uint %2034 %2033 + OpBranch %2037 + %2037 = OpLabel + %2038 = OpPhi %v2uint %2035 %2030 %2026 %2025 + OpBranch %2040 + %2040 = OpLabel + %2041 = OpPhi %v2uint %7106 %2006 %2038 %2037 + %2042 = OpCompositeExtract %uint %2041 0 + %2043 = OpShiftRightLogical %uint %2042 %uint_1 + %2044 = OpIAdd %uint %2043 %uint_2147483647 + %2045 = OpBitwiseAnd %uint %2042 %uint_1 + %2046 = OpIAdd %uint %2044 %2045 + %2047 = OpShiftRightLogical %uint %2046 %uint_31 + %2048 = OpIAdd %uint %2042 %uint_4294967295 + %2049 = OpCompositeExtract %uint %2041 1 + %2050 = OpIAdd %uint %2049 %uint_4294967295 + %2051 = OpIAdd %uint %2050 %2047 + %2052 = OpCompositeConstruct %v2uint %2048 %2051 + %2053 = OpSLessThanEqual %bool %2007 %uint_0 + OpSelectionMerge %2105 None + OpBranchConditional %2053 %2056 %2105 + %2056 = OpLabel + %2057 = OpSGreaterThanEqual %bool %2007 %uint_4294967233 + OpSelectionMerge %2100 None + OpBranchConditional %2057 %2060 %2100 + %2060 = OpLabel + %2061 = OpISub %uint %uint_0 %2007 + %2062 = OpBitwiseAnd %v2uint %2052 %1996 + %2063 = OpINotEqual %bool %2001 %1981 + OpSelectionMerge %2095 None + OpBranchConditional %2063 %2066 %2095 + %2066 = OpLabel + %2067 = OpUGreaterThanEqual %bool %2061 %uint_32 + OpSelectionMerge %2075 None + OpBranchConditional %2067 %2070 %2075 + %2070 = OpLabel + %2071 = OpBitwiseAnd %uint %2061 %uint_31 + %2072 = OpShiftRightLogical %uint %1994 %2071 + %2073 = OpCompositeInsert %v2uint %2072 %420 0 + OpBranch %2075 + %2075 = OpLabel + %2076 = OpPhi %v2uint %2011 %2070 %528 %2066 + %2077 = OpPhi %v2uint %2062 %2070 %528 %2066 + %2078 = OpPhi %v2uint %2073 %2070 %528 %2066 + %2079 = OpPhi %bool %false %2070 %true %2066 + OpSelectionMerge %2090 None + OpBranchConditional %2079 %2082 %2090 + %2082 = OpLabel + %2083 = OpShiftRightLogical %uint %1995 %2061 + %2084 = OpBitwiseAnd %uint %2007 %uint_31 + %2085 = OpShiftLeftLogical %uint %1994 %2084 + %2086 = OpBitwiseOr %uint %2085 %2083 + %2087 = OpShiftRightLogical %uint %1994 %2061 + %2088 = OpCompositeConstruct %v2uint %2086 %2087 + OpBranch %2090 + %2090 = OpLabel + %2091 = OpPhi %v2uint %2011 %2082 %2076 %2075 + %2092 = OpPhi %v2uint %2062 %2082 %2077 %2075 + %2093 = OpPhi %v2uint %2088 %2082 %2078 %2075 + OpBranch %2095 + %2095 = OpLabel + %2096 = OpPhi %v2uint %2091 %2090 %2011 %2060 + %2097 = OpPhi %v2uint %2092 %2090 %2062 %2060 + %2098 = OpPhi %v2uint %2093 %2090 %1996 %2060 + OpBranch %2100 + %2100 = OpLabel + %2101 = OpPhi %v2uint %2096 %2095 %2011 %2056 + %2102 = OpPhi %v2uint %2097 %2095 %1996 %2056 + %2103 = OpPhi %v2uint %2098 %2095 %270 %2056 + OpBranch %2105 + %2105 = OpLabel + %2106 = OpPhi %v2uint %2101 %2100 %528 %2040 + %2107 = OpPhi %v2uint %2102 %2100 %528 %2040 + %2108 = OpPhi %v2uint %2103 %2100 %528 %2040 + %2109 = OpPhi %bool %false %2100 %true %2040 + OpSelectionMerge %2151 None + OpBranchConditional %2109 %2112 %2151 + %2112 = OpLabel + %2113 = OpULessThanEqual %bool %2007 %uint_63 + OpSelectionMerge %2146 None + OpBranchConditional %2113 %2116 %2146 + %2116 = OpLabel + %2117 = OpBitwiseAnd %uint %2051 %2010 + %2118 = OpCompositeInsert %v2uint %2117 %355 1 + %2119 = OpUGreaterThanEqual %bool %2007 %uint_32 + OpSelectionMerge %2127 None + OpBranchConditional %2119 %2122 %2127 + %2122 = OpLabel + %2123 = OpBitwiseAnd %uint %2007 %uint_31 + %2124 = OpShiftRightLogical %uint %2010 %2123 + %2125 = OpCompositeInsert %v2uint %2124 %420 0 + OpBranch %2127 + %2127 = OpLabel + %2128 = OpPhi %v2uint %2125 %2122 %528 %2116 + %2129 = OpPhi %v2uint %2118 %2122 %528 %2116 + %2130 = OpPhi %v2uint %1996 %2122 %528 %2116 + %2131 = OpPhi %bool %false %2122 %true %2116 + OpSelectionMerge %2141 None + OpBranchConditional %2131 %2134 %2141 + %2134 = OpLabel + %2135 = OpISub %uint %uint_0 %2007 + %2136 = OpBitwiseAnd %uint %2135 %uint_31 + %2137 = OpShiftLeftLogical %uint %2010 %2136 + %2138 = OpShiftRightLogical %uint %2010 %2007 + %2139 = OpCompositeConstruct %v2uint %2137 %2138 + OpBranch %2141 + %2141 = OpLabel + %2142 = OpPhi %v2uint %2139 %2134 %2128 %2127 + %2143 = OpPhi %v2uint %2118 %2134 %2129 %2127 + %2144 = OpPhi %v2uint %1996 %2134 %2130 %2127 + OpBranch %2146 + %2146 = OpLabel + %2147 = OpPhi %v2uint %2142 %2141 %270 %2112 + %2148 = OpPhi %v2uint %2143 %2141 %2011 %2112 + %2149 = OpPhi %v2uint %2144 %2141 %1996 %2112 + OpBranch %2151 + %2151 = OpLabel + %2152 = OpPhi %v2uint %2108 %2105 %2149 %2146 + %2153 = OpPhi %v2uint %2107 %2105 %2148 %2146 + %2154 = OpPhi %v2uint %2106 %2105 %2147 %2146 + %2155 = OpExtInst %uint %184 SMax %2001 %1981 + %2156 = OpINotEqual %bool %1984 %1986 + OpSelectionMerge %2203 None + OpBranchConditional %2156 %2159 %2203 + %2159 = OpLabel + %2160 = OpCompositeExtract %uint %2154 0 + %2161 = OpBitwiseXor %uint %2160 %uint_4294967295 + %2162 = OpCompositeExtract %uint %2154 1 + %2163 = OpBitwiseXor %uint %2162 %uint_4294967295 + %2164 = OpShiftRightLogical %uint %2161 %uint_1 + %2165 = OpBitwiseAnd %uint %2161 %uint_1 + %2166 = OpIAdd %uint %2164 %2165 + %2167 = OpShiftRightLogical %uint %2166 %uint_31 + %2168 = OpISub %uint %uint_0 %2160 + %2169 = OpCompositeExtract %uint %2152 0 + %2170 = OpShiftRightLogical %uint %2169 %uint_1 + %2171 = OpShiftRightLogical %uint %2168 %uint_1 + %2172 = OpIAdd %uint %2171 %2170 + %2173 = OpBitwiseAnd %uint %2169 %uint_1 + %2174 = OpBitwiseAnd %uint %2173 %2168 + %2175 = OpIAdd %uint %2172 %2174 + %2176 = OpShiftRightLogical %uint %2175 %uint_31 + %2177 = OpISub %uint %2169 %2160 + %2178 = OpCompositeExtract %uint %2152 1 + %2179 = OpVectorShuffle %v2uint %2153 %528 1 4294967295 + %2180 = OpBitwiseOr %v2uint %2179 %2153 + %2181 = OpCompositeExtract %uint %2180 0 + %2182 = OpINotEqual %bool %2181 %uint_0 + %2183 = OpSGreaterThan %bool %2001 %1981 + %2184 = OpSelect %bool %2182 %2183 %false + %2185 = OpSelect %v2uint %2184 %536 %270 + %2186 = OpCompositeExtract %uint %2185 0 + %2187 = OpShiftRightLogical %uint %2177 %uint_1 + %2188 = OpShiftRightLogical %uint %2186 %uint_1 + %2189 = OpIAdd %uint %2188 %2187 + %2190 = OpBitwiseAnd %uint %2177 %uint_1 + %2191 = OpBitwiseAnd %uint %2190 %2186 + %2192 = OpIAdd %uint %2189 %2191 + %2193 = OpShiftRightLogical %uint %2192 %uint_31 + %2194 = OpIAdd %uint %2186 %2177 + %2195 = OpCompositeExtract %uint %2185 1 + %2196 = OpIAdd %uint %2178 %2163 + %2197 = OpIAdd %uint %2196 %2167 + %2198 = OpIAdd %uint %2197 %2176 + %2199 = OpIAdd %uint %2198 %2195 + %2200 = OpIAdd %uint %2199 %2193 + %2201 = OpCompositeConstruct %v2uint %2194 %2200 + OpBranch %2203 + %2203 = OpLabel + %2204 = OpPhi %v2uint %2201 %2159 %528 %2151 + %2205 = OpPhi %bool %false %2159 %true %2151 + OpSelectionMerge %2224 None + OpBranchConditional %2205 %2208 %2224 + %2208 = OpLabel + %2209 = OpCompositeExtract %uint %2152 0 + %2210 = OpCompositeExtract %uint %2154 0 + %2211 = OpShiftRightLogical %uint %2209 %uint_1 + %2212 = OpShiftRightLogical %uint %2210 %uint_1 + %2213 = OpIAdd %uint %2212 %2211 + %2214 = OpBitwiseAnd %uint %2209 %uint_1 + %2215 = OpBitwiseAnd %uint %2214 %2210 + %2216 = OpIAdd %uint %2213 %2215 + %2217 = OpShiftRightLogical %uint %2216 %uint_31 + %2218 = OpIAdd %uint %2210 %2209 + %2219 = OpIAdd %v2uint %2154 %2152 + %2220 = OpCompositeExtract %uint %2219 1 + %2221 = OpIAdd %uint %2217 %2220 + %2222 = OpCompositeConstruct %v2uint %2218 %2221 + OpBranch %2224 + %2224 = OpLabel + %2225 = OpPhi %v2uint %2222 %2208 %2204 %2203 + %2226 = OpCompositeExtract %uint %2225 1 + %2227 = OpSLessThan %bool %2226 %uint_0 + OpSelectionMerge %2243 None + OpBranchConditional %2227 %2230 %2243 + %2230 = OpLabel + %2231 = OpCompositeExtract %uint %2225 0 + %2232 = OpBitwiseXor %uint %2231 %uint_4294967295 + %2233 = OpBitwiseXor %uint %2226 %uint_4294967295 + %2234 = OpShiftRightLogical %uint %2232 %uint_1 + %2235 = OpBitwiseAnd %uint %2232 %uint_1 + %2236 = OpIAdd %uint %2234 %2235 + %2237 = OpShiftRightLogical %uint %2236 %uint_31 + %2238 = OpISub %uint %uint_0 %2231 + %2239 = OpIAdd %uint %2237 %2233 + %2240 = OpCompositeConstruct %v2uint %2238 %2239 + %2241 = OpBitwiseXor %uint %1986 %uint_2147483648 + OpBranch %2243 + %2243 = OpLabel + %2244 = OpPhi %uint %2241 %2230 %1986 %2224 + %2245 = OpPhi %v2uint %2240 %2230 %2225 %2224 + %2246 = OpCompositeExtract %uint %2245 1 + %2247 = OpExtInst %uint %184 FindUMsb %2246 + %2248 = OpISub %uint %uint_31 %2247 + %2249 = OpIEqual %bool %2246 %uint_0 + %2250 = OpCompositeExtract %uint %2245 0 + %2251 = OpExtInst %uint %184 FindUMsb %2250 + %2252 = OpISub %uint %uint_31 %2251 + %2253 = OpIAdd %uint %2252 %uint_32 + %2254 = OpSelect %uint %2249 %2253 %2248 + %2255 = OpISub %uint %uint_3 %2254 + %2256 = OpIAdd %uint %2255 %2155 + %2257 = OpUGreaterThan %bool %2254 %uint_3 + OpSelectionMerge %2288 None + OpBranchConditional %2257 %2260 %2288 + %2260 = OpLabel + %2261 = OpIAdd %uint %2254 %uint_4294967293 + %2262 = OpUGreaterThanEqual %bool %2261 %uint_32 + OpSelectionMerge %2270 None + OpBranchConditional %2262 %2265 %2270 + %2265 = OpLabel + %2266 = OpBitwiseAnd %uint %2261 %uint_31 + %2267 = OpShiftLeftLogical %uint %2250 %2266 + %2268 = OpCompositeInsert %v2uint %2267 %355 1 + OpBranch %2270 + %2270 = OpLabel + %2271 = OpPhi %uint %uint_0 %2265 %354 %2260 + %2272 = OpPhi %v2uint %2268 %2265 %528 %2260 + %2273 = OpPhi %bool %false %2265 %true %2260 + OpSelectionMerge %2284 None + OpBranchConditional %2273 %2276 %2284 + %2276 = OpLabel + %2277 = OpShiftLeftLogical %uint %2246 %2261 + %2278 = OpBitwiseAnd %uint %2255 %uint_31 + %2279 = OpShiftRightLogical %uint %2250 %2278 + %2280 = OpBitwiseOr %uint %2279 %2277 + %2281 = OpShiftLeftLogical %uint %2250 %2261 + %2282 = OpCompositeConstruct %v2uint %2281 %2280 + OpBranch %2284 + %2284 = OpLabel + %2285 = OpPhi %uint %uint_0 %2276 %2271 %2270 + %2286 = OpPhi %v2uint %2282 %2276 %2272 %2270 + OpBranch %2288 + %2288 = OpLabel + %2289 = OpPhi %v2uint %2245 %2243 %2286 %2284 + %2290 = OpPhi %uint %2255 %2243 %2285 %2284 + %2291 = OpIAdd %uint %2290 %uint_5 + %2292 = OpBitwiseAnd %uint %2291 %uint_31 + %2293 = OpShiftLeftLogical %uint %uint_1 %2292 + %2294 = OpCompositeInsert %v2uint %2293 %355 1 + %2295 = OpIAdd %uint %2293 %uint_4294967295 + %2296 = OpCompositeInsert %v2uint %2295 %650 1 + %2297 = OpBitwiseAnd %v2uint %2296 %2289 + %2298 = OpCompositeExtract %uint %2297 1 + %2299 = OpBitwiseAnd %v2uint %2294 %2289 + %2300 = OpIAdd %uint %2290 %uint_2 + %2301 = OpBitwiseAnd %uint %2300 %uint_31 + %2302 = OpShiftLeftLogical %uint %uint_4 %2301 + %2303 = OpUGreaterThan %bool %2298 %2302 + %2304 = OpLogicalNot %bool %2303 + OpSelectionMerge %2335 None + OpBranchConditional %2304 %2307 %2335 + %2307 = OpLabel + %2308 = OpCompositeExtract %uint %2297 0 + %2309 = OpVectorShuffle %v2uint %2153 %528 1 4294967295 + %2310 = OpBitwiseOr %v2uint %2309 %2153 + %2311 = OpCompositeExtract %uint %2310 0 + %2312 = OpINotEqual %bool %2311 %uint_0 + %2313 = OpSelect %uint %2312 %uint_1 %uint_0 + %2314 = OpBitwiseOr %uint %2308 %2313 + %2315 = OpIEqual %bool %2298 %2302 + %2316 = OpINotEqual %bool %2314 %uint_0 + %2317 = OpSelect %bool %2315 %2316 %false + %2318 = OpLogicalNot %bool %2317 + OpSelectionMerge %2331 None + OpBranchConditional %2318 %2321 %2331 + %2321 = OpLabel + %2322 = OpINotEqual %bool %2298 %2302 + %2323 = OpLogicalOr %bool %2322 %2316 + %2324 = OpVectorShuffle %v2uint %2299 %528 1 4294967295 + %2325 = OpBitwiseOr %v2uint %2324 %2299 + %2326 = OpCompositeExtract %uint %2325 0 + %2327 = OpIEqual %bool %2326 %uint_0 + %2328 = OpSelect %bool %2323 %true %2327 + %2329 = OpLogicalNot %bool %2328 + OpBranch %2331 + %2331 = OpLabel + %2332 = OpPhi %v2uint %2289 %2321 %528 %2307 + %2333 = OpPhi %bool %2329 %2321 %2317 %2307 + OpBranch %2335 + %2335 = OpLabel + %2336 = OpPhi %v2uint %2332 %2331 %528 %2288 + %2337 = OpPhi %bool %2333 %2331 %2303 %2288 + OpSelectionMerge %2345 None + OpBranchConditional %2337 %2340 %2345 + %2340 = OpLabel + %2341 = OpCompositeExtract %uint %2289 1 + %2342 = OpIAdd %uint %2293 %2341 + %2343 = OpCompositeInsert %v2uint %2342 %2289 1 + OpBranch %2345 + %2345 = OpLabel + %2346 = OpPhi %v2uint %2343 %2340 %2336 %2335 + %2347 = OpCompositeExtract %uint %2346 1 + %2348 = OpShiftRightLogical %uint %2347 %2292 + %2349 = OpUGreaterThan %bool %2348 %uint_16777215 + %2350 = OpSelect %uint %2349 %uint_1 %uint_0 + %2351 = OpShiftRightLogical %uint %2348 %2350 + %2352 = OpIAdd %uint %2256 %2350 + %2353 = OpINotEqual %bool %2351 %uint_0 + OpSelectionMerge %2395 None + OpBranchConditional %2353 %2356 %2395 + %2356 = OpLabel + %2357 = OpSLessThanEqual %bool %2352 %uint_127 + OpSelectionMerge %2383 None + OpBranchConditional %2357 %2360 %2383 + %2360 = OpLabel + %2361 = OpSGreaterThanEqual %bool %2352 %uint_4294967170 + OpSelectionMerge %2372 None + OpBranchConditional %2361 %2364 %2372 + %2364 = OpLabel + %2365 = OpShiftLeftLogical %uint %2352 %uint_23 + %2366 = OpIAdd %uint %2365 %uint_1065353216 + %2367 = OpBitwiseAnd %uint %2351 %uint_8388607 + %2368 = OpBitwiseOr %uint %2366 %2367 + %2369 = OpBitwiseOr %uint %2368 %2244 + %2370 = OpBitcast %float %2369 + OpBranch %2372 + %2372 = OpLabel + %2373 = OpPhi %float %2370 %2364 %261 %2360 + %2374 = OpPhi %bool %false %2364 %true %2360 + OpSelectionMerge %2380 None + OpBranchConditional %2374 %2377 %2380 + %2377 = OpLabel + %2378 = OpBitcast %float %2244 + OpBranch %2380 + %2380 = OpLabel + %2381 = OpPhi %float %2378 %2377 %2373 %2372 + OpBranch %2383 + %2383 = OpLabel + %2384 = OpPhi %float %2381 %2380 %261 %2356 + %2385 = OpPhi %bool %false %2380 %true %2356 + OpSelectionMerge %2392 None + OpBranchConditional %2385 %2388 %2392 + %2388 = OpLabel + %2389 = OpBitwiseOr %uint %2244 %uint_2139095040 + %2390 = OpBitcast %float %2389 + OpBranch %2392 + %2392 = OpLabel + %2393 = OpPhi %float %2390 %2388 %2384 %2383 + OpBranch %2395 + %2395 = OpLabel + %2396 = OpPhi %float %2393 %2392 %float_0 %2345 + OpBranch %2398 + %2398 = OpLabel + %2399 = OpPhi %float %2396 %2395 %1958 %1970 + OpBranch %2401 + %2401 = OpLabel + %2402 = OpPhi %float %2399 %2398 %261 %1966 + %2403 = OpPhi %bool %false %2398 %true %1966 + OpSelectionMerge %2411 None + OpBranchConditional %2403 %2406 %2411 + %2406 = OpLabel + %2407 = OpVectorShuffle %v2float %1949 %768 1 4294967295 + %2408 = OpFMul %v2float %1949 %2407 + %2409 = OpCompositeExtract %float %2408 0 + OpBranch %2411 + %2411 = OpLabel + %2412 = OpPhi %float %2409 %2406 %2402 %2401 + OpBranch %2414 + %2414 = OpLabel + %2415 = OpPhi %float %2412 %2411 %1958 %1939 + OpBranch %2417 + %2417 = OpLabel + %2418 = OpPhi %float %2415 %2414 %1909 %1934 + OpBranch %2420 + %2420 = OpLabel + %2421 = OpPhi %float %2418 %2417 %261 %1929 + %2422 = OpPhi %bool %false %2417 %true %1929 + OpBranch %2424 + %2424 = OpLabel + %2425 = OpPhi %float %2421 %2420 %261 %1924 + %2426 = OpPhi %bool %2422 %2420 %1925 %1924 + OpBranch %2428 + %2428 = OpLabel + %2429 = OpPhi %float %2425 %2424 %261 %1919 + %2430 = OpPhi %bool %2426 %2424 %1920 %1919 + OpBranch %2432 + %2432 = OpLabel + %2433 = OpPhi %float %2429 %2428 %261 %1914 + %2434 = OpPhi %bool %2430 %2428 %1915 %1914 + OpBranch %2436 + %2436 = OpLabel + %2437 = OpPhi %float %2433 %2432 %261 %1902 + %2438 = OpPhi %bool %2434 %2432 %1910 %1902 + OpSelectionMerge %2444 None + OpBranchConditional %2438 %2441 %2444 + %2441 = OpLabel + %2442 = OpFSub %float %1908 %1908 + OpBranch %2444 + %2444 = OpLabel + %2445 = OpPhi %float %2442 %2441 %2437 %2436 + %2446 = OpFSub %float %42 %1908 + %2447 = OpFSub %float %42 %2446 + %2448 = OpFSub %float %2447 %1908 + %2449 = OpFSub %float %2448 %2445 + %2450 = OpFAdd %float %2446 %2449 + %2451 = OpFMul %float %1907 %float_7_54978942en08 + %2452 = OpFNegate %float %2451 + OpSelectionMerge %2977 None + OpBranchConditional %1911 %2455 %2977 + %2455 = OpLabel + %2456 = OpIsNan %bool %float_7_54978942en08 + %2457 = OpLogicalNot %bool %2456 + OpSelectionMerge %2973 None + OpBranchConditional %2457 %2460 %2973 + %2460 = OpLabel + %2461 = OpIsNan %bool %2452 + %2462 = OpLogicalNot %bool %2461 + OpSelectionMerge %2969 None + OpBranchConditional %2462 %2465 %2969 + %2465 = OpLabel + %2466 = OpIsInf %bool %1907 + %2467 = OpLogicalNot %bool %2466 + OpSelectionMerge %2965 None + OpBranchConditional %2467 %2470 %2965 + %2470 = OpLabel + %2471 = OpIsInf %bool %float_7_54978942en08 + %2472 = OpLogicalNot %bool %2471 + OpSelectionMerge %2961 None + OpBranchConditional %2472 %2475 %2961 + %2475 = OpLabel + %2476 = OpIsInf %bool %2452 + %2477 = OpLogicalNot %bool %2476 + OpSelectionMerge %2958 None + OpBranchConditional %2477 %2480 %2958 + %2480 = OpLabel + %2481 = OpCompositeInsert %v2float %1907 %829 1 + %2482 = OpBitcast %v2uint %2481 + %2483 = OpBitwiseAnd %v2uint %2482 %267 + %2484 = OpINotEqual %v2bool %2483 %270 + %2485 = OpBitwiseAnd %v2uint %2482 %272 + %2486 = OpIEqual %v2bool %2485 %270 + %2487 = OpLogicalOr %v2bool %2486 %2484 + %2488 = OpBitwiseAnd %v2uint %2482 %277 + %2489 = OpBitcast %v2float %2488 + %2490 = OpSelect %v2float %2487 %2481 %2489 + %2491 = OpBitcast %uint %2452 + %2492 = OpBitwiseAnd %uint %2491 %uint_2139095040 + %2493 = OpINotEqual %bool %2492 %uint_0 + %2494 = OpBitwiseAnd %uint %2491 %uint_8388607 + %2495 = OpIEqual %bool %2494 %uint_0 + %2496 = OpLogicalOr %bool %2495 %2493 + %2497 = OpBitwiseAnd %uint %2491 %uint_2147483648 + %2498 = OpBitcast %float %2497 + %2499 = OpSelect %float %2496 %2452 %2498 + %2500 = OpFOrdEqual %v2bool %2490 %290 + %2501 = OpVectorShuffle %v2bool %2500 %292 1 4294967295 + %2502 = OpLogicalOr %v2bool %2501 %2500 + %2503 = OpCompositeExtract %bool %2502 0 + %2504 = OpLogicalNot %bool %2503 + OpSelectionMerge %2955 None + OpBranchConditional %2504 %2507 %2955 + %2507 = OpLabel + %2508 = OpFUnordNotEqual %bool %2499 %float_0 + OpSelectionMerge %2942 None + OpBranchConditional %2508 %2511 %2942 + %2511 = OpLabel + %2512 = OpBitcast %v2uint %2490 + %2513 = OpCompositeExtract %uint %2512 1 + %2514 = OpShiftRightLogical %uint %2513 %uint_23 + %2515 = OpBitwiseAnd %uint %2514 %uint_255 + %2516 = OpCompositeExtract %uint %2512 0 + %2517 = OpShiftRightLogical %uint %2516 %uint_23 + %2518 = OpBitwiseAnd %uint %2517 %uint_255 + %2519 = OpBitcast %uint %2499 + %2520 = OpShiftRightLogical %uint %2519 %uint_23 + %2521 = OpBitwiseAnd %uint %2520 %uint_255 + %2522 = OpIAdd %uint %2521 %uint_4294967169 + %2523 = OpBitwiseAnd %v2uint %2512 %272 + %2524 = OpBitwiseOr %v2uint %2523 %319 + %2525 = OpBitwiseAnd %uint %2519 %uint_2147483648 + %2526 = OpBitwiseXor %uint %2516 %2513 + %2527 = OpBitwiseAnd %uint %2526 %uint_2147483648 + %2528 = OpCompositeExtract %uint %2524 0 + %2529 = OpCompositeExtract %uint %2524 1 + %2530 = OpUMulExtended %_struct_58 %2529 %2528 + %2531 = OpCompositeExtract %uint %2530 1 + %2532 = OpIMul %uint %2528 %2529 + %2533 = OpShiftLeftLogical %uint %2531 %uint_14 + %2534 = OpShiftRightLogical %uint %2532 %uint_18 + %2535 = OpBitwiseOr %uint %2534 %2533 + %2536 = OpShiftLeftLogical %uint %2532 %uint_14 + %2537 = OpCompositeConstruct %v2uint %2536 %2535 + %2538 = OpBitwiseOr %uint %2535 %2536 + %2539 = OpIEqual %bool %2538 %uint_0 + %2540 = OpIAdd %uint %2515 %uint_4294967042 + %2541 = OpIAdd %uint %2540 %2518 + %2542 = OpSelect %uint %2539 %uint_0 %2541 + %2543 = OpBitwiseOr %uint %2542 %2538 + %2544 = OpINotEqual %bool %2543 %uint_0 + OpSelectionMerge %2939 None + OpBranchConditional %2544 %2547 %2939 + %2547 = OpLabel + %2548 = OpISub %uint %2542 %2522 + %2549 = OpShiftLeftLogical %uint %2519 %uint_5 + %2550 = OpBitwiseAnd %uint %2549 %uint_268435424 + %2551 = OpBitwiseOr %uint %2550 %uint_268435456 + %2552 = OpCompositeInsert %v2uint %2551 %355 1 + %2553 = OpExtInst %uint %184 SAbs %2548 + %2554 = OpINotEqual %bool %2553 %uint_0 + OpSelectionMerge %2581 None + OpBranchConditional %2554 %2557 %2581 + %2557 = OpLabel + %2558 = OpUGreaterThanEqual %bool %2553 %uint_32 + OpSelectionMerge %2566 None + OpBranchConditional %2558 %2561 %2566 + %2561 = OpLabel + %2562 = OpBitwiseAnd %uint %2553 %uint_31 + %2563 = OpShiftLeftLogical %uint %uint_1 %2562 + %2564 = OpCompositeInsert %v2uint %2563 %355 1 + OpBranch %2566 + %2566 = OpLabel + %2567 = OpPhi %v2uint %2564 %2561 %528 %2557 + %2568 = OpPhi %bool %false %2561 %true %2557 + OpSelectionMerge %2578 None + OpBranchConditional %2568 %2571 %2578 + %2571 = OpLabel + %2572 = OpISub %uint %uint_0 %2553 + %2573 = OpBitwiseAnd %uint %2572 %uint_31 + %2574 = OpShiftRightLogical %uint %uint_1 %2573 + %2575 = OpShiftLeftLogical %uint %uint_1 %2553 + %2576 = OpCompositeConstruct %v2uint %2575 %2574 + OpBranch %2578 + %2578 = OpLabel + %2579 = OpPhi %v2uint %2576 %2571 %2567 %2566 + OpBranch %2581 + %2581 = OpLabel + %2582 = OpPhi %v2uint %7106 %2547 %2579 %2578 + %2583 = OpCompositeExtract %uint %2582 0 + %2584 = OpShiftRightLogical %uint %2583 %uint_1 + %2585 = OpIAdd %uint %2584 %uint_2147483647 + %2586 = OpBitwiseAnd %uint %2583 %uint_1 + %2587 = OpIAdd %uint %2585 %2586 + %2588 = OpShiftRightLogical %uint %2587 %uint_31 + %2589 = OpIAdd %uint %2583 %uint_4294967295 + %2590 = OpCompositeExtract %uint %2582 1 + %2591 = OpIAdd %uint %2590 %uint_4294967295 + %2592 = OpIAdd %uint %2591 %2588 + %2593 = OpCompositeConstruct %v2uint %2589 %2592 + %2594 = OpSLessThanEqual %bool %2548 %uint_0 + OpSelectionMerge %2646 None + OpBranchConditional %2594 %2597 %2646 + %2597 = OpLabel + %2598 = OpSGreaterThanEqual %bool %2548 %uint_4294967233 + OpSelectionMerge %2641 None + OpBranchConditional %2598 %2601 %2641 + %2601 = OpLabel + %2602 = OpISub %uint %uint_0 %2548 + %2603 = OpBitwiseAnd %v2uint %2593 %2537 + %2604 = OpINotEqual %bool %2542 %2522 + OpSelectionMerge %2636 None + OpBranchConditional %2604 %2607 %2636 + %2607 = OpLabel + %2608 = OpUGreaterThanEqual %bool %2602 %uint_32 + OpSelectionMerge %2616 None + OpBranchConditional %2608 %2611 %2616 + %2611 = OpLabel + %2612 = OpBitwiseAnd %uint %2602 %uint_31 + %2613 = OpShiftRightLogical %uint %2535 %2612 + %2614 = OpCompositeInsert %v2uint %2613 %420 0 + OpBranch %2616 + %2616 = OpLabel + %2617 = OpPhi %v2uint %2552 %2611 %528 %2607 + %2618 = OpPhi %v2uint %2603 %2611 %528 %2607 + %2619 = OpPhi %v2uint %2614 %2611 %528 %2607 + %2620 = OpPhi %bool %false %2611 %true %2607 + OpSelectionMerge %2631 None + OpBranchConditional %2620 %2623 %2631 + %2623 = OpLabel + %2624 = OpShiftRightLogical %uint %2536 %2602 + %2625 = OpBitwiseAnd %uint %2548 %uint_31 + %2626 = OpShiftLeftLogical %uint %2535 %2625 + %2627 = OpBitwiseOr %uint %2626 %2624 + %2628 = OpShiftRightLogical %uint %2535 %2602 + %2629 = OpCompositeConstruct %v2uint %2627 %2628 + OpBranch %2631 + %2631 = OpLabel + %2632 = OpPhi %v2uint %2552 %2623 %2617 %2616 + %2633 = OpPhi %v2uint %2603 %2623 %2618 %2616 + %2634 = OpPhi %v2uint %2629 %2623 %2619 %2616 + OpBranch %2636 + %2636 = OpLabel + %2637 = OpPhi %v2uint %2632 %2631 %2552 %2601 + %2638 = OpPhi %v2uint %2633 %2631 %2603 %2601 + %2639 = OpPhi %v2uint %2634 %2631 %2537 %2601 + OpBranch %2641 + %2641 = OpLabel + %2642 = OpPhi %v2uint %2637 %2636 %2552 %2597 + %2643 = OpPhi %v2uint %2638 %2636 %2537 %2597 + %2644 = OpPhi %v2uint %2639 %2636 %270 %2597 + OpBranch %2646 + %2646 = OpLabel + %2647 = OpPhi %v2uint %2642 %2641 %528 %2581 + %2648 = OpPhi %v2uint %2643 %2641 %528 %2581 + %2649 = OpPhi %v2uint %2644 %2641 %528 %2581 + %2650 = OpPhi %bool %false %2641 %true %2581 + OpSelectionMerge %2692 None + OpBranchConditional %2650 %2653 %2692 + %2653 = OpLabel + %2654 = OpULessThanEqual %bool %2548 %uint_63 + OpSelectionMerge %2687 None + OpBranchConditional %2654 %2657 %2687 + %2657 = OpLabel + %2658 = OpBitwiseAnd %uint %2592 %2551 + %2659 = OpCompositeInsert %v2uint %2658 %355 1 + %2660 = OpUGreaterThanEqual %bool %2548 %uint_32 + OpSelectionMerge %2668 None + OpBranchConditional %2660 %2663 %2668 + %2663 = OpLabel + %2664 = OpBitwiseAnd %uint %2548 %uint_31 + %2665 = OpShiftRightLogical %uint %2551 %2664 + %2666 = OpCompositeInsert %v2uint %2665 %420 0 + OpBranch %2668 + %2668 = OpLabel + %2669 = OpPhi %v2uint %2666 %2663 %528 %2657 + %2670 = OpPhi %v2uint %2659 %2663 %528 %2657 + %2671 = OpPhi %v2uint %2537 %2663 %528 %2657 + %2672 = OpPhi %bool %false %2663 %true %2657 + OpSelectionMerge %2682 None + OpBranchConditional %2672 %2675 %2682 + %2675 = OpLabel + %2676 = OpISub %uint %uint_0 %2548 + %2677 = OpBitwiseAnd %uint %2676 %uint_31 + %2678 = OpShiftLeftLogical %uint %2551 %2677 + %2679 = OpShiftRightLogical %uint %2551 %2548 + %2680 = OpCompositeConstruct %v2uint %2678 %2679 + OpBranch %2682 + %2682 = OpLabel + %2683 = OpPhi %v2uint %2680 %2675 %2669 %2668 + %2684 = OpPhi %v2uint %2659 %2675 %2670 %2668 + %2685 = OpPhi %v2uint %2537 %2675 %2671 %2668 + OpBranch %2687 + %2687 = OpLabel + %2688 = OpPhi %v2uint %2683 %2682 %270 %2653 + %2689 = OpPhi %v2uint %2684 %2682 %2552 %2653 + %2690 = OpPhi %v2uint %2685 %2682 %2537 %2653 + OpBranch %2692 + %2692 = OpLabel + %2693 = OpPhi %v2uint %2649 %2646 %2690 %2687 + %2694 = OpPhi %v2uint %2648 %2646 %2689 %2687 + %2695 = OpPhi %v2uint %2647 %2646 %2688 %2687 + %2696 = OpExtInst %uint %184 SMax %2542 %2522 + %2697 = OpINotEqual %bool %2525 %2527 + OpSelectionMerge %2744 None + OpBranchConditional %2697 %2700 %2744 + %2700 = OpLabel + %2701 = OpCompositeExtract %uint %2695 0 + %2702 = OpBitwiseXor %uint %2701 %uint_4294967295 + %2703 = OpCompositeExtract %uint %2695 1 + %2704 = OpBitwiseXor %uint %2703 %uint_4294967295 + %2705 = OpShiftRightLogical %uint %2702 %uint_1 + %2706 = OpBitwiseAnd %uint %2702 %uint_1 + %2707 = OpIAdd %uint %2705 %2706 + %2708 = OpShiftRightLogical %uint %2707 %uint_31 + %2709 = OpISub %uint %uint_0 %2701 + %2710 = OpCompositeExtract %uint %2693 0 + %2711 = OpShiftRightLogical %uint %2710 %uint_1 + %2712 = OpShiftRightLogical %uint %2709 %uint_1 + %2713 = OpIAdd %uint %2712 %2711 + %2714 = OpBitwiseAnd %uint %2710 %uint_1 + %2715 = OpBitwiseAnd %uint %2714 %2709 + %2716 = OpIAdd %uint %2713 %2715 + %2717 = OpShiftRightLogical %uint %2716 %uint_31 + %2718 = OpISub %uint %2710 %2701 + %2719 = OpCompositeExtract %uint %2693 1 + %2720 = OpVectorShuffle %v2uint %2694 %528 1 4294967295 + %2721 = OpBitwiseOr %v2uint %2720 %2694 + %2722 = OpCompositeExtract %uint %2721 0 + %2723 = OpINotEqual %bool %2722 %uint_0 + %2724 = OpSGreaterThan %bool %2542 %2522 + %2725 = OpSelect %bool %2723 %2724 %false + %2726 = OpSelect %v2uint %2725 %536 %270 + %2727 = OpCompositeExtract %uint %2726 0 + %2728 = OpShiftRightLogical %uint %2718 %uint_1 + %2729 = OpShiftRightLogical %uint %2727 %uint_1 + %2730 = OpIAdd %uint %2729 %2728 + %2731 = OpBitwiseAnd %uint %2718 %uint_1 + %2732 = OpBitwiseAnd %uint %2731 %2727 + %2733 = OpIAdd %uint %2730 %2732 + %2734 = OpShiftRightLogical %uint %2733 %uint_31 + %2735 = OpIAdd %uint %2727 %2718 + %2736 = OpCompositeExtract %uint %2726 1 + %2737 = OpIAdd %uint %2719 %2704 + %2738 = OpIAdd %uint %2737 %2708 + %2739 = OpIAdd %uint %2738 %2717 + %2740 = OpIAdd %uint %2739 %2736 + %2741 = OpIAdd %uint %2740 %2734 + %2742 = OpCompositeConstruct %v2uint %2735 %2741 + OpBranch %2744 + %2744 = OpLabel + %2745 = OpPhi %v2uint %2742 %2700 %528 %2692 + %2746 = OpPhi %bool %false %2700 %true %2692 + OpSelectionMerge %2765 None + OpBranchConditional %2746 %2749 %2765 + %2749 = OpLabel + %2750 = OpCompositeExtract %uint %2693 0 + %2751 = OpCompositeExtract %uint %2695 0 + %2752 = OpShiftRightLogical %uint %2750 %uint_1 + %2753 = OpShiftRightLogical %uint %2751 %uint_1 + %2754 = OpIAdd %uint %2753 %2752 + %2755 = OpBitwiseAnd %uint %2750 %uint_1 + %2756 = OpBitwiseAnd %uint %2755 %2751 + %2757 = OpIAdd %uint %2754 %2756 + %2758 = OpShiftRightLogical %uint %2757 %uint_31 + %2759 = OpIAdd %uint %2751 %2750 + %2760 = OpIAdd %v2uint %2695 %2693 + %2761 = OpCompositeExtract %uint %2760 1 + %2762 = OpIAdd %uint %2758 %2761 + %2763 = OpCompositeConstruct %v2uint %2759 %2762 + OpBranch %2765 + %2765 = OpLabel + %2766 = OpPhi %v2uint %2763 %2749 %2745 %2744 + %2767 = OpCompositeExtract %uint %2766 1 + %2768 = OpSLessThan %bool %2767 %uint_0 + OpSelectionMerge %2784 None + OpBranchConditional %2768 %2771 %2784 + %2771 = OpLabel + %2772 = OpCompositeExtract %uint %2766 0 + %2773 = OpBitwiseXor %uint %2772 %uint_4294967295 + %2774 = OpBitwiseXor %uint %2767 %uint_4294967295 + %2775 = OpShiftRightLogical %uint %2773 %uint_1 + %2776 = OpBitwiseAnd %uint %2773 %uint_1 + %2777 = OpIAdd %uint %2775 %2776 + %2778 = OpShiftRightLogical %uint %2777 %uint_31 + %2779 = OpISub %uint %uint_0 %2772 + %2780 = OpIAdd %uint %2778 %2774 + %2781 = OpCompositeConstruct %v2uint %2779 %2780 + %2782 = OpBitwiseXor %uint %2527 %uint_2147483648 + OpBranch %2784 + %2784 = OpLabel + %2785 = OpPhi %uint %2782 %2771 %2527 %2765 + %2786 = OpPhi %v2uint %2781 %2771 %2766 %2765 + %2787 = OpCompositeExtract %uint %2786 1 + %2788 = OpExtInst %uint %184 FindUMsb %2787 + %2789 = OpISub %uint %uint_31 %2788 + %2790 = OpIEqual %bool %2787 %uint_0 + %2791 = OpCompositeExtract %uint %2786 0 + %2792 = OpExtInst %uint %184 FindUMsb %2791 + %2793 = OpISub %uint %uint_31 %2792 + %2794 = OpIAdd %uint %2793 %uint_32 + %2795 = OpSelect %uint %2790 %2794 %2789 + %2796 = OpISub %uint %uint_3 %2795 + %2797 = OpIAdd %uint %2796 %2696 + %2798 = OpUGreaterThan %bool %2795 %uint_3 + OpSelectionMerge %2829 None + OpBranchConditional %2798 %2801 %2829 + %2801 = OpLabel + %2802 = OpIAdd %uint %2795 %uint_4294967293 + %2803 = OpUGreaterThanEqual %bool %2802 %uint_32 + OpSelectionMerge %2811 None + OpBranchConditional %2803 %2806 %2811 + %2806 = OpLabel + %2807 = OpBitwiseAnd %uint %2802 %uint_31 + %2808 = OpShiftLeftLogical %uint %2791 %2807 + %2809 = OpCompositeInsert %v2uint %2808 %355 1 + OpBranch %2811 + %2811 = OpLabel + %2812 = OpPhi %uint %uint_0 %2806 %354 %2801 + %2813 = OpPhi %v2uint %2809 %2806 %528 %2801 + %2814 = OpPhi %bool %false %2806 %true %2801 + OpSelectionMerge %2825 None + OpBranchConditional %2814 %2817 %2825 + %2817 = OpLabel + %2818 = OpShiftLeftLogical %uint %2787 %2802 + %2819 = OpBitwiseAnd %uint %2796 %uint_31 + %2820 = OpShiftRightLogical %uint %2791 %2819 + %2821 = OpBitwiseOr %uint %2820 %2818 + %2822 = OpShiftLeftLogical %uint %2791 %2802 + %2823 = OpCompositeConstruct %v2uint %2822 %2821 + OpBranch %2825 + %2825 = OpLabel + %2826 = OpPhi %uint %uint_0 %2817 %2812 %2811 + %2827 = OpPhi %v2uint %2823 %2817 %2813 %2811 + OpBranch %2829 + %2829 = OpLabel + %2830 = OpPhi %v2uint %2786 %2784 %2827 %2825 + %2831 = OpPhi %uint %2796 %2784 %2826 %2825 + %2832 = OpIAdd %uint %2831 %uint_5 + %2833 = OpBitwiseAnd %uint %2832 %uint_31 + %2834 = OpShiftLeftLogical %uint %uint_1 %2833 + %2835 = OpCompositeInsert %v2uint %2834 %355 1 + %2836 = OpIAdd %uint %2834 %uint_4294967295 + %2837 = OpCompositeInsert %v2uint %2836 %650 1 + %2838 = OpBitwiseAnd %v2uint %2837 %2830 + %2839 = OpCompositeExtract %uint %2838 1 + %2840 = OpBitwiseAnd %v2uint %2835 %2830 + %2841 = OpIAdd %uint %2831 %uint_2 + %2842 = OpBitwiseAnd %uint %2841 %uint_31 + %2843 = OpShiftLeftLogical %uint %uint_4 %2842 + %2844 = OpUGreaterThan %bool %2839 %2843 + %2845 = OpLogicalNot %bool %2844 + OpSelectionMerge %2876 None + OpBranchConditional %2845 %2848 %2876 + %2848 = OpLabel + %2849 = OpCompositeExtract %uint %2838 0 + %2850 = OpVectorShuffle %v2uint %2694 %528 1 4294967295 + %2851 = OpBitwiseOr %v2uint %2850 %2694 + %2852 = OpCompositeExtract %uint %2851 0 + %2853 = OpINotEqual %bool %2852 %uint_0 + %2854 = OpSelect %uint %2853 %uint_1 %uint_0 + %2855 = OpBitwiseOr %uint %2849 %2854 + %2856 = OpIEqual %bool %2839 %2843 + %2857 = OpINotEqual %bool %2855 %uint_0 + %2858 = OpSelect %bool %2856 %2857 %false + %2859 = OpLogicalNot %bool %2858 + OpSelectionMerge %2872 None + OpBranchConditional %2859 %2862 %2872 + %2862 = OpLabel + %2863 = OpINotEqual %bool %2839 %2843 + %2864 = OpLogicalOr %bool %2863 %2857 + %2865 = OpVectorShuffle %v2uint %2840 %528 1 4294967295 + %2866 = OpBitwiseOr %v2uint %2865 %2840 + %2867 = OpCompositeExtract %uint %2866 0 + %2868 = OpIEqual %bool %2867 %uint_0 + %2869 = OpSelect %bool %2864 %true %2868 + %2870 = OpLogicalNot %bool %2869 + OpBranch %2872 + %2872 = OpLabel + %2873 = OpPhi %v2uint %2830 %2862 %528 %2848 + %2874 = OpPhi %bool %2870 %2862 %2858 %2848 + OpBranch %2876 + %2876 = OpLabel + %2877 = OpPhi %v2uint %2873 %2872 %528 %2829 + %2878 = OpPhi %bool %2874 %2872 %2844 %2829 + OpSelectionMerge %2886 None + OpBranchConditional %2878 %2881 %2886 + %2881 = OpLabel + %2882 = OpCompositeExtract %uint %2830 1 + %2883 = OpIAdd %uint %2834 %2882 + %2884 = OpCompositeInsert %v2uint %2883 %2830 1 + OpBranch %2886 + %2886 = OpLabel + %2887 = OpPhi %v2uint %2884 %2881 %2877 %2876 + %2888 = OpCompositeExtract %uint %2887 1 + %2889 = OpShiftRightLogical %uint %2888 %2833 + %2890 = OpUGreaterThan %bool %2889 %uint_16777215 + %2891 = OpSelect %uint %2890 %uint_1 %uint_0 + %2892 = OpShiftRightLogical %uint %2889 %2891 + %2893 = OpIAdd %uint %2797 %2891 + %2894 = OpINotEqual %bool %2892 %uint_0 + OpSelectionMerge %2936 None + OpBranchConditional %2894 %2897 %2936 + %2897 = OpLabel + %2898 = OpSLessThanEqual %bool %2893 %uint_127 + OpSelectionMerge %2924 None + OpBranchConditional %2898 %2901 %2924 + %2901 = OpLabel + %2902 = OpSGreaterThanEqual %bool %2893 %uint_4294967170 + OpSelectionMerge %2913 None + OpBranchConditional %2902 %2905 %2913 + %2905 = OpLabel + %2906 = OpShiftLeftLogical %uint %2893 %uint_23 + %2907 = OpIAdd %uint %2906 %uint_1065353216 + %2908 = OpBitwiseAnd %uint %2892 %uint_8388607 + %2909 = OpBitwiseOr %uint %2907 %2908 + %2910 = OpBitwiseOr %uint %2909 %2785 + %2911 = OpBitcast %float %2910 + OpBranch %2913 + %2913 = OpLabel + %2914 = OpPhi %float %2911 %2905 %261 %2901 + %2915 = OpPhi %bool %false %2905 %true %2901 + OpSelectionMerge %2921 None + OpBranchConditional %2915 %2918 %2921 + %2918 = OpLabel + %2919 = OpBitcast %float %2785 + OpBranch %2921 + %2921 = OpLabel + %2922 = OpPhi %float %2919 %2918 %2914 %2913 + OpBranch %2924 + %2924 = OpLabel + %2925 = OpPhi %float %2922 %2921 %261 %2897 + %2926 = OpPhi %bool %false %2921 %true %2897 + OpSelectionMerge %2933 None + OpBranchConditional %2926 %2929 %2933 + %2929 = OpLabel + %2930 = OpBitwiseOr %uint %2785 %uint_2139095040 + %2931 = OpBitcast %float %2930 + OpBranch %2933 + %2933 = OpLabel + %2934 = OpPhi %float %2931 %2929 %2925 %2924 + OpBranch %2936 + %2936 = OpLabel + %2937 = OpPhi %float %2934 %2933 %float_0 %2886 + OpBranch %2939 + %2939 = OpLabel + %2940 = OpPhi %float %2937 %2936 %2499 %2511 + OpBranch %2942 + %2942 = OpLabel + %2943 = OpPhi %float %2940 %2939 %261 %2507 + %2944 = OpPhi %bool %false %2939 %true %2507 + OpSelectionMerge %2952 None + OpBranchConditional %2944 %2947 %2952 + %2947 = OpLabel + %2948 = OpVectorShuffle %v2float %2490 %768 1 4294967295 + %2949 = OpFMul %v2float %2490 %2948 + %2950 = OpCompositeExtract %float %2949 0 + OpBranch %2952 + %2952 = OpLabel + %2953 = OpPhi %float %2950 %2947 %2943 %2942 + OpBranch %2955 + %2955 = OpLabel + %2956 = OpPhi %float %2953 %2952 %2499 %2480 + OpBranch %2958 + %2958 = OpLabel + %2959 = OpPhi %float %2956 %2955 %2452 %2475 + OpBranch %2961 + %2961 = OpLabel + %2962 = OpPhi %float %2959 %2958 %261 %2470 + %2963 = OpPhi %bool %false %2958 %true %2470 + OpBranch %2965 + %2965 = OpLabel + %2966 = OpPhi %float %2962 %2961 %261 %2465 + %2967 = OpPhi %bool %2963 %2961 %2466 %2465 + OpBranch %2969 + %2969 = OpLabel + %2970 = OpPhi %float %2966 %2965 %261 %2460 + %2971 = OpPhi %bool %2967 %2965 %2461 %2460 + OpBranch %2973 + %2973 = OpLabel + %2974 = OpPhi %float %2970 %2969 %261 %2455 + %2975 = OpPhi %bool %2971 %2969 %2456 %2455 + OpBranch %2977 + %2977 = OpLabel + %2978 = OpPhi %float %2974 %2973 %261 %2444 + %2979 = OpPhi %bool %2975 %2973 %1910 %2444 + OpSelectionMerge %2985 None + OpBranchConditional %2979 %2982 %2985 + %2982 = OpLabel + %2983 = OpFSub %float %2451 %2451 + OpBranch %2985 + %2985 = OpLabel + %2986 = OpPhi %float %2983 %2982 %2978 %2977 + %2987 = OpFSub %float %2450 %2451 + %2988 = OpFSub %float %2450 %2987 + %2989 = OpFSub %float %2988 %2451 + %2990 = OpFSub %float %2989 %2986 + %2991 = OpFAdd %float %2987 %2990 + %2993 = OpFMul %float %1907 %float_5_39030253en15 + %2994 = OpFNegate %float %2993 + OpSelectionMerge %3520 None + OpBranchConditional %1911 %2997 %3520 + %2997 = OpLabel + %2998 = OpIsNan %bool %float_5_39030253en15 + %2999 = OpLogicalNot %bool %2998 + OpSelectionMerge %3516 None + OpBranchConditional %2999 %3002 %3516 + %3002 = OpLabel + %3003 = OpIsNan %bool %2994 + %3004 = OpLogicalNot %bool %3003 + OpSelectionMerge %3512 None + OpBranchConditional %3004 %3007 %3512 + %3007 = OpLabel + %3008 = OpIsInf %bool %1907 + %3009 = OpLogicalNot %bool %3008 + OpSelectionMerge %3508 None + OpBranchConditional %3009 %3012 %3508 + %3012 = OpLabel + %3013 = OpIsInf %bool %float_5_39030253en15 + %3014 = OpLogicalNot %bool %3013 + OpSelectionMerge %3504 None + OpBranchConditional %3014 %3017 %3504 + %3017 = OpLabel + %3018 = OpIsInf %bool %2994 + %3019 = OpLogicalNot %bool %3018 + OpSelectionMerge %3501 None + OpBranchConditional %3019 %3022 %3501 + %3022 = OpLabel + %3024 = OpCompositeInsert %v2float %1907 %3023 1 + %3025 = OpBitcast %v2uint %3024 + %3026 = OpBitwiseAnd %v2uint %3025 %267 + %3027 = OpINotEqual %v2bool %3026 %270 + %3028 = OpBitwiseAnd %v2uint %3025 %272 + %3029 = OpIEqual %v2bool %3028 %270 + %3030 = OpLogicalOr %v2bool %3029 %3027 + %3031 = OpBitwiseAnd %v2uint %3025 %277 + %3032 = OpBitcast %v2float %3031 + %3033 = OpSelect %v2float %3030 %3024 %3032 + %3034 = OpBitcast %uint %2994 + %3035 = OpBitwiseAnd %uint %3034 %uint_2139095040 + %3036 = OpINotEqual %bool %3035 %uint_0 + %3037 = OpBitwiseAnd %uint %3034 %uint_8388607 + %3038 = OpIEqual %bool %3037 %uint_0 + %3039 = OpLogicalOr %bool %3038 %3036 + %3040 = OpBitwiseAnd %uint %3034 %uint_2147483648 + %3041 = OpBitcast %float %3040 + %3042 = OpSelect %float %3039 %2994 %3041 + %3043 = OpFOrdEqual %v2bool %3033 %290 + %3044 = OpVectorShuffle %v2bool %3043 %292 1 4294967295 + %3045 = OpLogicalOr %v2bool %3044 %3043 + %3046 = OpCompositeExtract %bool %3045 0 + %3047 = OpLogicalNot %bool %3046 + OpSelectionMerge %3498 None + OpBranchConditional %3047 %3050 %3498 + %3050 = OpLabel + %3051 = OpFUnordNotEqual %bool %3042 %float_0 + OpSelectionMerge %3485 None + OpBranchConditional %3051 %3054 %3485 + %3054 = OpLabel + %3055 = OpBitcast %v2uint %3033 + %3056 = OpCompositeExtract %uint %3055 1 + %3057 = OpShiftRightLogical %uint %3056 %uint_23 + %3058 = OpBitwiseAnd %uint %3057 %uint_255 + %3059 = OpCompositeExtract %uint %3055 0 + %3060 = OpShiftRightLogical %uint %3059 %uint_23 + %3061 = OpBitwiseAnd %uint %3060 %uint_255 + %3062 = OpBitcast %uint %3042 + %3063 = OpShiftRightLogical %uint %3062 %uint_23 + %3064 = OpBitwiseAnd %uint %3063 %uint_255 + %3065 = OpIAdd %uint %3064 %uint_4294967169 + %3066 = OpBitwiseAnd %v2uint %3055 %272 + %3067 = OpBitwiseOr %v2uint %3066 %319 + %3068 = OpBitwiseAnd %uint %3062 %uint_2147483648 + %3069 = OpBitwiseXor %uint %3059 %3056 + %3070 = OpBitwiseAnd %uint %3069 %uint_2147483648 + %3071 = OpCompositeExtract %uint %3067 0 + %3072 = OpCompositeExtract %uint %3067 1 + %3073 = OpUMulExtended %_struct_58 %3072 %3071 + %3074 = OpCompositeExtract %uint %3073 1 + %3075 = OpIMul %uint %3071 %3072 + %3076 = OpShiftLeftLogical %uint %3074 %uint_14 + %3077 = OpShiftRightLogical %uint %3075 %uint_18 + %3078 = OpBitwiseOr %uint %3077 %3076 + %3079 = OpShiftLeftLogical %uint %3075 %uint_14 + %3080 = OpCompositeConstruct %v2uint %3079 %3078 + %3081 = OpBitwiseOr %uint %3078 %3079 + %3082 = OpIEqual %bool %3081 %uint_0 + %3083 = OpIAdd %uint %3058 %uint_4294967042 + %3084 = OpIAdd %uint %3083 %3061 + %3085 = OpSelect %uint %3082 %uint_0 %3084 + %3086 = OpBitwiseOr %uint %3085 %3081 + %3087 = OpINotEqual %bool %3086 %uint_0 + OpSelectionMerge %3482 None + OpBranchConditional %3087 %3090 %3482 + %3090 = OpLabel + %3091 = OpISub %uint %3085 %3065 + %3092 = OpShiftLeftLogical %uint %3062 %uint_5 + %3093 = OpBitwiseAnd %uint %3092 %uint_268435424 + %3094 = OpBitwiseOr %uint %3093 %uint_268435456 + %3095 = OpCompositeInsert %v2uint %3094 %355 1 + %3096 = OpExtInst %uint %184 SAbs %3091 + %3097 = OpINotEqual %bool %3096 %uint_0 + OpSelectionMerge %3124 None + OpBranchConditional %3097 %3100 %3124 + %3100 = OpLabel + %3101 = OpUGreaterThanEqual %bool %3096 %uint_32 + OpSelectionMerge %3109 None + OpBranchConditional %3101 %3104 %3109 + %3104 = OpLabel + %3105 = OpBitwiseAnd %uint %3096 %uint_31 + %3106 = OpShiftLeftLogical %uint %uint_1 %3105 + %3107 = OpCompositeInsert %v2uint %3106 %355 1 + OpBranch %3109 + %3109 = OpLabel + %3110 = OpPhi %v2uint %3107 %3104 %528 %3100 + %3111 = OpPhi %bool %false %3104 %true %3100 + OpSelectionMerge %3121 None + OpBranchConditional %3111 %3114 %3121 + %3114 = OpLabel + %3115 = OpISub %uint %uint_0 %3096 + %3116 = OpBitwiseAnd %uint %3115 %uint_31 + %3117 = OpShiftRightLogical %uint %uint_1 %3116 + %3118 = OpShiftLeftLogical %uint %uint_1 %3096 + %3119 = OpCompositeConstruct %v2uint %3118 %3117 + OpBranch %3121 + %3121 = OpLabel + %3122 = OpPhi %v2uint %3119 %3114 %3110 %3109 + OpBranch %3124 + %3124 = OpLabel + %3125 = OpPhi %v2uint %7106 %3090 %3122 %3121 + %3126 = OpCompositeExtract %uint %3125 0 + %3127 = OpShiftRightLogical %uint %3126 %uint_1 + %3128 = OpIAdd %uint %3127 %uint_2147483647 + %3129 = OpBitwiseAnd %uint %3126 %uint_1 + %3130 = OpIAdd %uint %3128 %3129 + %3131 = OpShiftRightLogical %uint %3130 %uint_31 + %3132 = OpIAdd %uint %3126 %uint_4294967295 + %3133 = OpCompositeExtract %uint %3125 1 + %3134 = OpIAdd %uint %3133 %uint_4294967295 + %3135 = OpIAdd %uint %3134 %3131 + %3136 = OpCompositeConstruct %v2uint %3132 %3135 + %3137 = OpSLessThanEqual %bool %3091 %uint_0 + OpSelectionMerge %3189 None + OpBranchConditional %3137 %3140 %3189 + %3140 = OpLabel + %3141 = OpSGreaterThanEqual %bool %3091 %uint_4294967233 + OpSelectionMerge %3184 None + OpBranchConditional %3141 %3144 %3184 + %3144 = OpLabel + %3145 = OpISub %uint %uint_0 %3091 + %3146 = OpBitwiseAnd %v2uint %3136 %3080 + %3147 = OpINotEqual %bool %3085 %3065 + OpSelectionMerge %3179 None + OpBranchConditional %3147 %3150 %3179 + %3150 = OpLabel + %3151 = OpUGreaterThanEqual %bool %3145 %uint_32 + OpSelectionMerge %3159 None + OpBranchConditional %3151 %3154 %3159 + %3154 = OpLabel + %3155 = OpBitwiseAnd %uint %3145 %uint_31 + %3156 = OpShiftRightLogical %uint %3078 %3155 + %3157 = OpCompositeInsert %v2uint %3156 %420 0 + OpBranch %3159 + %3159 = OpLabel + %3160 = OpPhi %v2uint %3095 %3154 %528 %3150 + %3161 = OpPhi %v2uint %3146 %3154 %528 %3150 + %3162 = OpPhi %v2uint %3157 %3154 %528 %3150 + %3163 = OpPhi %bool %false %3154 %true %3150 + OpSelectionMerge %3174 None + OpBranchConditional %3163 %3166 %3174 + %3166 = OpLabel + %3167 = OpShiftRightLogical %uint %3079 %3145 + %3168 = OpBitwiseAnd %uint %3091 %uint_31 + %3169 = OpShiftLeftLogical %uint %3078 %3168 + %3170 = OpBitwiseOr %uint %3169 %3167 + %3171 = OpShiftRightLogical %uint %3078 %3145 + %3172 = OpCompositeConstruct %v2uint %3170 %3171 + OpBranch %3174 + %3174 = OpLabel + %3175 = OpPhi %v2uint %3095 %3166 %3160 %3159 + %3176 = OpPhi %v2uint %3146 %3166 %3161 %3159 + %3177 = OpPhi %v2uint %3172 %3166 %3162 %3159 + OpBranch %3179 + %3179 = OpLabel + %3180 = OpPhi %v2uint %3175 %3174 %3095 %3144 + %3181 = OpPhi %v2uint %3176 %3174 %3146 %3144 + %3182 = OpPhi %v2uint %3177 %3174 %3080 %3144 + OpBranch %3184 + %3184 = OpLabel + %3185 = OpPhi %v2uint %3180 %3179 %3095 %3140 + %3186 = OpPhi %v2uint %3181 %3179 %3080 %3140 + %3187 = OpPhi %v2uint %3182 %3179 %270 %3140 + OpBranch %3189 + %3189 = OpLabel + %3190 = OpPhi %v2uint %3185 %3184 %528 %3124 + %3191 = OpPhi %v2uint %3186 %3184 %528 %3124 + %3192 = OpPhi %v2uint %3187 %3184 %528 %3124 + %3193 = OpPhi %bool %false %3184 %true %3124 + OpSelectionMerge %3235 None + OpBranchConditional %3193 %3196 %3235 + %3196 = OpLabel + %3197 = OpULessThanEqual %bool %3091 %uint_63 + OpSelectionMerge %3230 None + OpBranchConditional %3197 %3200 %3230 + %3200 = OpLabel + %3201 = OpBitwiseAnd %uint %3135 %3094 + %3202 = OpCompositeInsert %v2uint %3201 %355 1 + %3203 = OpUGreaterThanEqual %bool %3091 %uint_32 + OpSelectionMerge %3211 None + OpBranchConditional %3203 %3206 %3211 + %3206 = OpLabel + %3207 = OpBitwiseAnd %uint %3091 %uint_31 + %3208 = OpShiftRightLogical %uint %3094 %3207 + %3209 = OpCompositeInsert %v2uint %3208 %420 0 + OpBranch %3211 + %3211 = OpLabel + %3212 = OpPhi %v2uint %3209 %3206 %528 %3200 + %3213 = OpPhi %v2uint %3202 %3206 %528 %3200 + %3214 = OpPhi %v2uint %3080 %3206 %528 %3200 + %3215 = OpPhi %bool %false %3206 %true %3200 + OpSelectionMerge %3225 None + OpBranchConditional %3215 %3218 %3225 + %3218 = OpLabel + %3219 = OpISub %uint %uint_0 %3091 + %3220 = OpBitwiseAnd %uint %3219 %uint_31 + %3221 = OpShiftLeftLogical %uint %3094 %3220 + %3222 = OpShiftRightLogical %uint %3094 %3091 + %3223 = OpCompositeConstruct %v2uint %3221 %3222 + OpBranch %3225 + %3225 = OpLabel + %3226 = OpPhi %v2uint %3223 %3218 %3212 %3211 + %3227 = OpPhi %v2uint %3202 %3218 %3213 %3211 + %3228 = OpPhi %v2uint %3080 %3218 %3214 %3211 + OpBranch %3230 + %3230 = OpLabel + %3231 = OpPhi %v2uint %3226 %3225 %270 %3196 + %3232 = OpPhi %v2uint %3227 %3225 %3095 %3196 + %3233 = OpPhi %v2uint %3228 %3225 %3080 %3196 + OpBranch %3235 + %3235 = OpLabel + %3236 = OpPhi %v2uint %3192 %3189 %3233 %3230 + %3237 = OpPhi %v2uint %3191 %3189 %3232 %3230 + %3238 = OpPhi %v2uint %3190 %3189 %3231 %3230 + %3239 = OpExtInst %uint %184 SMax %3085 %3065 + %3240 = OpINotEqual %bool %3068 %3070 + OpSelectionMerge %3287 None + OpBranchConditional %3240 %3243 %3287 + %3243 = OpLabel + %3244 = OpCompositeExtract %uint %3238 0 + %3245 = OpBitwiseXor %uint %3244 %uint_4294967295 + %3246 = OpCompositeExtract %uint %3238 1 + %3247 = OpBitwiseXor %uint %3246 %uint_4294967295 + %3248 = OpShiftRightLogical %uint %3245 %uint_1 + %3249 = OpBitwiseAnd %uint %3245 %uint_1 + %3250 = OpIAdd %uint %3248 %3249 + %3251 = OpShiftRightLogical %uint %3250 %uint_31 + %3252 = OpISub %uint %uint_0 %3244 + %3253 = OpCompositeExtract %uint %3236 0 + %3254 = OpShiftRightLogical %uint %3253 %uint_1 + %3255 = OpShiftRightLogical %uint %3252 %uint_1 + %3256 = OpIAdd %uint %3255 %3254 + %3257 = OpBitwiseAnd %uint %3253 %uint_1 + %3258 = OpBitwiseAnd %uint %3257 %3252 + %3259 = OpIAdd %uint %3256 %3258 + %3260 = OpShiftRightLogical %uint %3259 %uint_31 + %3261 = OpISub %uint %3253 %3244 + %3262 = OpCompositeExtract %uint %3236 1 + %3263 = OpVectorShuffle %v2uint %3237 %528 1 4294967295 + %3264 = OpBitwiseOr %v2uint %3263 %3237 + %3265 = OpCompositeExtract %uint %3264 0 + %3266 = OpINotEqual %bool %3265 %uint_0 + %3267 = OpSGreaterThan %bool %3085 %3065 + %3268 = OpSelect %bool %3266 %3267 %false + %3269 = OpSelect %v2uint %3268 %536 %270 + %3270 = OpCompositeExtract %uint %3269 0 + %3271 = OpShiftRightLogical %uint %3261 %uint_1 + %3272 = OpShiftRightLogical %uint %3270 %uint_1 + %3273 = OpIAdd %uint %3272 %3271 + %3274 = OpBitwiseAnd %uint %3261 %uint_1 + %3275 = OpBitwiseAnd %uint %3274 %3270 + %3276 = OpIAdd %uint %3273 %3275 + %3277 = OpShiftRightLogical %uint %3276 %uint_31 + %3278 = OpIAdd %uint %3270 %3261 + %3279 = OpCompositeExtract %uint %3269 1 + %3280 = OpIAdd %uint %3262 %3247 + %3281 = OpIAdd %uint %3280 %3251 + %3282 = OpIAdd %uint %3281 %3260 + %3283 = OpIAdd %uint %3282 %3279 + %3284 = OpIAdd %uint %3283 %3277 + %3285 = OpCompositeConstruct %v2uint %3278 %3284 + OpBranch %3287 + %3287 = OpLabel + %3288 = OpPhi %v2uint %3285 %3243 %528 %3235 + %3289 = OpPhi %bool %false %3243 %true %3235 + OpSelectionMerge %3308 None + OpBranchConditional %3289 %3292 %3308 + %3292 = OpLabel + %3293 = OpCompositeExtract %uint %3236 0 + %3294 = OpCompositeExtract %uint %3238 0 + %3295 = OpShiftRightLogical %uint %3293 %uint_1 + %3296 = OpShiftRightLogical %uint %3294 %uint_1 + %3297 = OpIAdd %uint %3296 %3295 + %3298 = OpBitwiseAnd %uint %3293 %uint_1 + %3299 = OpBitwiseAnd %uint %3298 %3294 + %3300 = OpIAdd %uint %3297 %3299 + %3301 = OpShiftRightLogical %uint %3300 %uint_31 + %3302 = OpIAdd %uint %3294 %3293 + %3303 = OpIAdd %v2uint %3238 %3236 + %3304 = OpCompositeExtract %uint %3303 1 + %3305 = OpIAdd %uint %3301 %3304 + %3306 = OpCompositeConstruct %v2uint %3302 %3305 + OpBranch %3308 + %3308 = OpLabel + %3309 = OpPhi %v2uint %3306 %3292 %3288 %3287 + %3310 = OpCompositeExtract %uint %3309 1 + %3311 = OpSLessThan %bool %3310 %uint_0 + OpSelectionMerge %3327 None + OpBranchConditional %3311 %3314 %3327 + %3314 = OpLabel + %3315 = OpCompositeExtract %uint %3309 0 + %3316 = OpBitwiseXor %uint %3315 %uint_4294967295 + %3317 = OpBitwiseXor %uint %3310 %uint_4294967295 + %3318 = OpShiftRightLogical %uint %3316 %uint_1 + %3319 = OpBitwiseAnd %uint %3316 %uint_1 + %3320 = OpIAdd %uint %3318 %3319 + %3321 = OpShiftRightLogical %uint %3320 %uint_31 + %3322 = OpISub %uint %uint_0 %3315 + %3323 = OpIAdd %uint %3321 %3317 + %3324 = OpCompositeConstruct %v2uint %3322 %3323 + %3325 = OpBitwiseXor %uint %3070 %uint_2147483648 + OpBranch %3327 + %3327 = OpLabel + %3328 = OpPhi %uint %3325 %3314 %3070 %3308 + %3329 = OpPhi %v2uint %3324 %3314 %3309 %3308 + %3330 = OpCompositeExtract %uint %3329 1 + %3331 = OpExtInst %uint %184 FindUMsb %3330 + %3332 = OpISub %uint %uint_31 %3331 + %3333 = OpIEqual %bool %3330 %uint_0 + %3334 = OpCompositeExtract %uint %3329 0 + %3335 = OpExtInst %uint %184 FindUMsb %3334 + %3336 = OpISub %uint %uint_31 %3335 + %3337 = OpIAdd %uint %3336 %uint_32 + %3338 = OpSelect %uint %3333 %3337 %3332 + %3339 = OpISub %uint %uint_3 %3338 + %3340 = OpIAdd %uint %3339 %3239 + %3341 = OpUGreaterThan %bool %3338 %uint_3 + OpSelectionMerge %3372 None + OpBranchConditional %3341 %3344 %3372 + %3344 = OpLabel + %3345 = OpIAdd %uint %3338 %uint_4294967293 + %3346 = OpUGreaterThanEqual %bool %3345 %uint_32 + OpSelectionMerge %3354 None + OpBranchConditional %3346 %3349 %3354 + %3349 = OpLabel + %3350 = OpBitwiseAnd %uint %3345 %uint_31 + %3351 = OpShiftLeftLogical %uint %3334 %3350 + %3352 = OpCompositeInsert %v2uint %3351 %355 1 + OpBranch %3354 + %3354 = OpLabel + %3355 = OpPhi %uint %uint_0 %3349 %354 %3344 + %3356 = OpPhi %v2uint %3352 %3349 %528 %3344 + %3357 = OpPhi %bool %false %3349 %true %3344 + OpSelectionMerge %3368 None + OpBranchConditional %3357 %3360 %3368 + %3360 = OpLabel + %3361 = OpShiftLeftLogical %uint %3330 %3345 + %3362 = OpBitwiseAnd %uint %3339 %uint_31 + %3363 = OpShiftRightLogical %uint %3334 %3362 + %3364 = OpBitwiseOr %uint %3363 %3361 + %3365 = OpShiftLeftLogical %uint %3334 %3345 + %3366 = OpCompositeConstruct %v2uint %3365 %3364 + OpBranch %3368 + %3368 = OpLabel + %3369 = OpPhi %uint %uint_0 %3360 %3355 %3354 + %3370 = OpPhi %v2uint %3366 %3360 %3356 %3354 + OpBranch %3372 + %3372 = OpLabel + %3373 = OpPhi %v2uint %3329 %3327 %3370 %3368 + %3374 = OpPhi %uint %3339 %3327 %3369 %3368 + %3375 = OpIAdd %uint %3374 %uint_5 + %3376 = OpBitwiseAnd %uint %3375 %uint_31 + %3377 = OpShiftLeftLogical %uint %uint_1 %3376 + %3378 = OpCompositeInsert %v2uint %3377 %355 1 + %3379 = OpIAdd %uint %3377 %uint_4294967295 + %3380 = OpCompositeInsert %v2uint %3379 %650 1 + %3381 = OpBitwiseAnd %v2uint %3380 %3373 + %3382 = OpCompositeExtract %uint %3381 1 + %3383 = OpBitwiseAnd %v2uint %3378 %3373 + %3384 = OpIAdd %uint %3374 %uint_2 + %3385 = OpBitwiseAnd %uint %3384 %uint_31 + %3386 = OpShiftLeftLogical %uint %uint_4 %3385 + %3387 = OpUGreaterThan %bool %3382 %3386 + %3388 = OpLogicalNot %bool %3387 + OpSelectionMerge %3419 None + OpBranchConditional %3388 %3391 %3419 + %3391 = OpLabel + %3392 = OpCompositeExtract %uint %3381 0 + %3393 = OpVectorShuffle %v2uint %3237 %528 1 4294967295 + %3394 = OpBitwiseOr %v2uint %3393 %3237 + %3395 = OpCompositeExtract %uint %3394 0 + %3396 = OpINotEqual %bool %3395 %uint_0 + %3397 = OpSelect %uint %3396 %uint_1 %uint_0 + %3398 = OpBitwiseOr %uint %3392 %3397 + %3399 = OpIEqual %bool %3382 %3386 + %3400 = OpINotEqual %bool %3398 %uint_0 + %3401 = OpSelect %bool %3399 %3400 %false + %3402 = OpLogicalNot %bool %3401 + OpSelectionMerge %3415 None + OpBranchConditional %3402 %3405 %3415 + %3405 = OpLabel + %3406 = OpINotEqual %bool %3382 %3386 + %3407 = OpLogicalOr %bool %3406 %3400 + %3408 = OpVectorShuffle %v2uint %3383 %528 1 4294967295 + %3409 = OpBitwiseOr %v2uint %3408 %3383 + %3410 = OpCompositeExtract %uint %3409 0 + %3411 = OpIEqual %bool %3410 %uint_0 + %3412 = OpSelect %bool %3407 %true %3411 + %3413 = OpLogicalNot %bool %3412 + OpBranch %3415 + %3415 = OpLabel + %3416 = OpPhi %v2uint %3373 %3405 %528 %3391 + %3417 = OpPhi %bool %3413 %3405 %3401 %3391 + OpBranch %3419 + %3419 = OpLabel + %3420 = OpPhi %v2uint %3416 %3415 %528 %3372 + %3421 = OpPhi %bool %3417 %3415 %3387 %3372 + OpSelectionMerge %3429 None + OpBranchConditional %3421 %3424 %3429 + %3424 = OpLabel + %3425 = OpCompositeExtract %uint %3373 1 + %3426 = OpIAdd %uint %3377 %3425 + %3427 = OpCompositeInsert %v2uint %3426 %3373 1 + OpBranch %3429 + %3429 = OpLabel + %3430 = OpPhi %v2uint %3427 %3424 %3420 %3419 + %3431 = OpCompositeExtract %uint %3430 1 + %3432 = OpShiftRightLogical %uint %3431 %3376 + %3433 = OpUGreaterThan %bool %3432 %uint_16777215 + %3434 = OpSelect %uint %3433 %uint_1 %uint_0 + %3435 = OpShiftRightLogical %uint %3432 %3434 + %3436 = OpIAdd %uint %3340 %3434 + %3437 = OpINotEqual %bool %3435 %uint_0 + OpSelectionMerge %3479 None + OpBranchConditional %3437 %3440 %3479 + %3440 = OpLabel + %3441 = OpSLessThanEqual %bool %3436 %uint_127 + OpSelectionMerge %3467 None + OpBranchConditional %3441 %3444 %3467 + %3444 = OpLabel + %3445 = OpSGreaterThanEqual %bool %3436 %uint_4294967170 + OpSelectionMerge %3456 None + OpBranchConditional %3445 %3448 %3456 + %3448 = OpLabel + %3449 = OpShiftLeftLogical %uint %3436 %uint_23 + %3450 = OpIAdd %uint %3449 %uint_1065353216 + %3451 = OpBitwiseAnd %uint %3435 %uint_8388607 + %3452 = OpBitwiseOr %uint %3450 %3451 + %3453 = OpBitwiseOr %uint %3452 %3328 + %3454 = OpBitcast %float %3453 + OpBranch %3456 + %3456 = OpLabel + %3457 = OpPhi %float %3454 %3448 %261 %3444 + %3458 = OpPhi %bool %false %3448 %true %3444 + OpSelectionMerge %3464 None + OpBranchConditional %3458 %3461 %3464 + %3461 = OpLabel + %3462 = OpBitcast %float %3328 + OpBranch %3464 + %3464 = OpLabel + %3465 = OpPhi %float %3462 %3461 %3457 %3456 + OpBranch %3467 + %3467 = OpLabel + %3468 = OpPhi %float %3465 %3464 %261 %3440 + %3469 = OpPhi %bool %false %3464 %true %3440 + OpSelectionMerge %3476 None + OpBranchConditional %3469 %3472 %3476 + %3472 = OpLabel + %3473 = OpBitwiseOr %uint %3328 %uint_2139095040 + %3474 = OpBitcast %float %3473 + OpBranch %3476 + %3476 = OpLabel + %3477 = OpPhi %float %3474 %3472 %3468 %3467 + OpBranch %3479 + %3479 = OpLabel + %3480 = OpPhi %float %3477 %3476 %float_0 %3429 + OpBranch %3482 + %3482 = OpLabel + %3483 = OpPhi %float %3480 %3479 %3042 %3054 + OpBranch %3485 + %3485 = OpLabel + %3486 = OpPhi %float %3483 %3482 %261 %3050 + %3487 = OpPhi %bool %false %3482 %true %3050 + OpSelectionMerge %3495 None + OpBranchConditional %3487 %3490 %3495 + %3490 = OpLabel + %3491 = OpVectorShuffle %v2float %3033 %768 1 4294967295 + %3492 = OpFMul %v2float %3033 %3491 + %3493 = OpCompositeExtract %float %3492 0 + OpBranch %3495 + %3495 = OpLabel + %3496 = OpPhi %float %3493 %3490 %3486 %3485 + OpBranch %3498 + %3498 = OpLabel + %3499 = OpPhi %float %3496 %3495 %3042 %3022 + OpBranch %3501 + %3501 = OpLabel + %3502 = OpPhi %float %3499 %3498 %2994 %3017 + OpBranch %3504 + %3504 = OpLabel + %3505 = OpPhi %float %3502 %3501 %261 %3012 + %3506 = OpPhi %bool %false %3501 %true %3012 + OpBranch %3508 + %3508 = OpLabel + %3509 = OpPhi %float %3505 %3504 %261 %3007 + %3510 = OpPhi %bool %3506 %3504 %3008 %3007 + OpBranch %3512 + %3512 = OpLabel + %3513 = OpPhi %float %3509 %3508 %261 %3002 + %3514 = OpPhi %bool %3510 %3508 %3003 %3002 + OpBranch %3516 + %3516 = OpLabel + %3517 = OpPhi %float %3513 %3512 %261 %2997 + %3518 = OpPhi %bool %3514 %3512 %2998 %2997 + OpBranch %3520 + %3520 = OpLabel + %3521 = OpPhi %float %3517 %3516 %261 %2985 + %3522 = OpPhi %bool %3518 %3516 %1910 %2985 + OpSelectionMerge %3528 None + OpBranchConditional %3522 %3525 %3528 + %3525 = OpLabel + %3526 = OpFSub %float %2993 %2993 + OpBranch %3528 + %3528 = OpLabel + %3529 = OpPhi %float %3526 %3525 %3521 %3520 + %3530 = OpFSub %float %2991 %2993 + %3531 = OpFSub %float %2991 %3530 + %3532 = OpFSub %float %3531 %2993 + %3533 = OpFAdd %float %3530 %3532 + %3534 = OpFNegate %float %3529 + %3535 = OpConvertFToS %uint %1907 + OpBranch %3537 + %3537 = OpLabel + %3538 = OpPhi %uint %3535 %3528 %1896 %1895 + %3539 = OpPhi %float %3533 %3528 %1897 %1895 + %3540 = OpPhi %float %3534 %3528 %1898 %1895 + OpBranch %3542 + %3542 = OpLabel + %3543 = OpFMul %float %3539 %3539 + %3544 = OpFMul %float %3539 %3543 + %3546 = OpFMul %float %3543 %float_1_58969102en10 + %3548 = OpFAdd %float %3546 %float_n2_50507597en08 + %3549 = OpFMul %float %3543 %3548 + %3551 = OpFAdd %float %3549 %float_2_72500006en06 + %3552 = OpFMul %float %3543 %3551 + %3554 = OpFAdd %float %3552 %float_n0_00019840087 + %3555 = OpFMul %float %3543 %3554 + %3557 = OpFAdd %float %3555 %float_0_00833333191 + %3558 = OpFMul %float %3540 %float_0_5 + %3559 = OpFMul %float %3544 %3557 + %3560 = OpFSub %float %3558 %3559 + %3561 = OpFMul %float %3543 %3560 + %3562 = OpFSub %float %3561 %3540 + %3564 = OpFMul %float %3544 %float_0_166666672 + %3565 = OpFAdd %float %3564 %3562 + %3566 = OpFSub %float %3539 %3565 + %3567 = OpFNegate %float %3566 + %3569 = OpFMul %float %3543 %float_1_13596476en11 + %3571 = OpFSub %float %float_2_08757234en09 %3569 + %3572 = OpFMul %float %3543 %3571 + %3574 = OpFAdd %float %3572 %float_n2_7301013en07 + %3575 = OpFMul %float %3543 %3574 + %3577 = OpFAdd %float %3575 %float_2_48005999en05 + %3578 = OpFMul %float %3543 %3577 + %3580 = OpFAdd %float %3578 %float_n0_00138888881 + %3581 = OpFMul %float %3543 %3580 + %3583 = OpFAdd %float %3581 %float_0_0416666679 + %3584 = OpFMul %float %3543 %3583 + %3585 = OpBitcast %uint %3539 + %3586 = OpBitwiseAnd %uint %3585 %uint_2147483647 + %3587 = OpBitcast %float %3586 + %3588 = OpBitcast %uint %3587 + %3590 = OpIAdd %uint %3588 %uint_4278190080 + %3591 = OpBitcast %float %3590 + %3593 = OpIAdd %uint %3588 %uint_3244713574 + %3595 = OpULessThan %bool %3593 %uint_11429479 + %3596 = OpSelect %float %3595 %3591 %float_0 + %3598 = OpUGreaterThan %bool %3588 %uint_1061683200 + %3600 = OpSelect %float %3598 %float_0_28125 %3596 + %3601 = OpFMul %float %3543 %float_0_5 + %3602 = OpFSub %float %3601 %3600 + %3604 = OpFSub %float %float_1 %3600 + %3605 = OpFMul %float %3543 %3584 + %3606 = OpFMul %float %3540 %3539 + %3607 = OpFSub %float %3605 %3606 + %3608 = OpFSub %float %3607 %3602 + %3609 = OpFAdd %float %3604 %3608 + %3610 = OpBitwiseAnd %uint %3538 %uint_1 + %3611 = OpIEqual %bool %3610 %uint_0 + %3612 = OpSelect %float %3611 %3609 %3567 + %3613 = OpBitcast %uint %3612 + %3614 = OpShiftLeftLogical %uint %3538 %uint_30 + %3615 = OpBitwiseAnd %uint %3614 %uint_2147483648 + %3616 = OpBitwiseXor %uint %3615 %3613 + %3617 = OpBitcast %float %3616 + %3619 = OpUGreaterThan %bool %43 %uint_2139095039 + %3621 = OpSelect %float %3619 %float_0x1_8p_128 %3617 + OpStore %38 %3621 + OpSelectionMerge %5401 None + OpBranchConditional %46 %3624 %5401 + %3624 = OpLabel + %3625 = OpShiftRightLogical %uint %43 %uint_23 + %3626 = OpBitwiseAnd %uint %43 %uint_8388607 + %3627 = OpBitwiseOr %uint %3626 %uint_8388608 + %3628 = OpIMul %uint %3627 %uint_4266746795 + %3629 = OpUMulExtended %_struct_58 %3627 %uint_4266746795 + %3630 = OpCompositeExtract %uint %3629 1 + %3631 = OpIMul %uint %3627 %uint_1011060801 + %3632 = OpIAdd %uint %3630 %3631 + %3633 = OpUMulExtended %_struct_58 %3627 %uint_1011060801 + %3634 = OpCompositeExtract %uint %3633 1 + %3635 = OpULessThan %bool %3632 %3630 + %3636 = OpSelect %uint %3635 %uint_1 %uint_0 + %3637 = OpIAdd %uint %3634 %3636 + %3638 = OpIMul %uint %3627 %uint_3680671129 + %3639 = OpIAdd %uint %3637 %3638 + %3640 = OpUMulExtended %_struct_58 %3627 %uint_3680671129 + %3641 = OpCompositeExtract %uint %3640 1 + %3642 = OpULessThan %bool %3639 %3637 + %3643 = OpSelect %uint %3642 %uint_1 %uint_0 + %3644 = OpIAdd %uint %3641 %3643 + %3645 = OpIMul %uint %3627 %uint_4113882560 + %3646 = OpIAdd %uint %3644 %3645 + %3647 = OpUMulExtended %_struct_58 %3627 %uint_4113882560 + %3648 = OpCompositeExtract %uint %3647 1 + %3649 = OpULessThan %bool %3646 %3644 + %3650 = OpSelect %uint %3649 %uint_1 %uint_0 + %3651 = OpIAdd %uint %3648 %3650 + %3652 = OpIMul %uint %3627 %uint_4230436817 + %3653 = OpIAdd %uint %3651 %3652 + %3654 = OpUMulExtended %_struct_58 %3627 %uint_4230436817 + %3655 = OpCompositeExtract %uint %3654 1 + %3656 = OpULessThan %bool %3653 %3651 + %3657 = OpSelect %uint %3656 %uint_1 %uint_0 + %3658 = OpIAdd %uint %3655 %3657 + %3659 = OpIMul %uint %3627 %uint_1313084713 + %3660 = OpIAdd %uint %3658 %3659 + %3661 = OpUMulExtended %_struct_58 %3627 %uint_1313084713 + %3662 = OpCompositeExtract %uint %3661 1 + %3663 = OpULessThan %bool %3660 %3658 + %3664 = OpSelect %uint %3663 %uint_1 %uint_0 + %3665 = OpIAdd %uint %3662 %3664 + %3666 = OpIMul %uint %3627 %uint_2734261102 + %3667 = OpIAdd %uint %3665 %3666 + %3668 = OpUMulExtended %_struct_58 %3627 %uint_2734261102 + %3669 = OpCompositeExtract %uint %3668 1 + %3670 = OpULessThan %bool %3667 %3665 + %3671 = OpSelect %uint %3670 %uint_1 %uint_0 + %3672 = OpIAdd %uint %3669 %3671 + %3673 = OpIAdd %uint %3625 %uint_4294967176 + %3674 = OpUGreaterThan %bool %3673 %uint_31 + %3675 = OpSelect %uint %3674 %3667 %3672 + %3676 = OpSelect %uint %3674 %3660 %3667 + %3677 = OpSelect %uint %3674 %3653 %3660 + %3678 = OpSelect %uint %3674 %3646 %3653 + %3679 = OpSelect %uint %3674 %3639 %3646 + %3680 = OpSelect %uint %3674 %3632 %3639 + %3681 = OpSelect %uint %3674 %3628 %3632 + %3682 = OpSelect %uint %3674 %uint_4294967264 %uint_0 + %3683 = OpIAdd %uint %3682 %3673 + %3684 = OpUGreaterThan %bool %3683 %uint_31 + %3685 = OpSelect %uint %3684 %3676 %3675 + %3686 = OpSelect %uint %3684 %3677 %3676 + %3687 = OpSelect %uint %3684 %3678 %3677 + %3688 = OpSelect %uint %3684 %3679 %3678 + %3689 = OpSelect %uint %3684 %3680 %3679 + %3690 = OpSelect %uint %3684 %3681 %3680 + %3691 = OpSelect %uint %3684 %uint_4294967264 %uint_0 + %3692 = OpIAdd %uint %3691 %3683 + %3693 = OpUGreaterThan %bool %3692 %uint_31 + %3694 = OpSelect %uint %3693 %3686 %3685 + %3695 = OpSelect %uint %3693 %3687 %3686 + %3696 = OpSelect %uint %3693 %3688 %3687 + %3697 = OpSelect %uint %3693 %3689 %3688 + %3698 = OpSelect %uint %3693 %3690 %3689 + %3699 = OpSelect %uint %3693 %uint_4294967264 %uint_0 + %3700 = OpIAdd %uint %3699 %3692 + %3701 = OpUGreaterThan %bool %3700 %uint_31 + %3702 = OpSelect %uint %3701 %3695 %3694 + %3703 = OpSelect %uint %3701 %3696 %3695 + %3704 = OpSelect %uint %3701 %3697 %3696 + %3705 = OpSelect %uint %3701 %3698 %3697 + %3706 = OpSelect %uint %3701 %uint_4294967264 %uint_0 + %3707 = OpISub %uint %uint_0 %3700 + %3708 = OpIEqual %bool %3706 %3707 + %3709 = OpISub %uint %uint_24 %3625 + %3710 = OpBitwiseAnd %uint %3673 %uint_31 + %3711 = OpShiftLeftLogical %uint %3702 %3710 + %3712 = OpBitwiseAnd %uint %3709 %uint_31 + %3713 = OpShiftRightLogical %uint %3703 %3712 + %3714 = OpBitwiseOr %uint %3711 %3713 + %3715 = OpShiftLeftLogical %uint %3703 %3710 + %3716 = OpShiftRightLogical %uint %3704 %3712 + %3717 = OpBitwiseOr %uint %3715 %3716 + %3718 = OpShiftLeftLogical %uint %3704 %3710 + %3719 = OpShiftRightLogical %uint %3705 %3712 + %3720 = OpBitwiseOr %uint %3718 %3719 + %3721 = OpSelect %uint %3708 %3702 %3714 + %3722 = OpSelect %uint %3708 %3703 %3717 + %3723 = OpSelect %uint %3708 %3704 %3720 + %3724 = OpShiftRightLogical %uint %3721 %uint_29 + %3725 = OpShiftLeftLogical %uint %3721 %uint_2 + %3726 = OpShiftRightLogical %uint %3722 %uint_30 + %3727 = OpBitwiseOr %uint %3726 %3725 + %3728 = OpShiftLeftLogical %uint %3722 %uint_2 + %3729 = OpShiftRightLogical %uint %3723 %uint_30 + %3730 = OpBitwiseOr %uint %3729 %3728 + %3731 = OpShiftLeftLogical %uint %3723 %uint_2 + %3732 = OpShiftRightLogical %uint %3705 %uint_30 + %3733 = OpBitwiseOr %uint %3732 %3731 + %3734 = OpBitwiseAnd %uint %3724 %uint_1 + %3735 = OpISub %uint %uint_0 %3734 + %3736 = OpShiftLeftLogical %uint %3724 %uint_31 + %3737 = OpBitwiseXor %uint %3727 %3735 + %3738 = OpBitwiseXor %uint %3730 %3735 + %3739 = OpBitwiseXor %uint %3733 %3735 + %3740 = OpExtInst %uint %184 FindUMsb %3737 + %3741 = OpISub %uint %uint_31 %3740 + %3742 = OpIAdd %uint %3741 %uint_1 + %3743 = OpISub %uint %uint_31 %3741 + %3744 = OpBitwiseAnd %uint %3742 %uint_31 + %3745 = OpShiftLeftLogical %uint %3737 %3744 + %3746 = OpBitwiseAnd %uint %3743 %uint_31 + %3747 = OpShiftRightLogical %uint %3738 %3746 + %3748 = OpBitwiseOr %uint %3745 %3747 + %3749 = OpShiftLeftLogical %uint %3738 %3744 + %3750 = OpShiftRightLogical %uint %3739 %3746 + %3751 = OpBitwiseOr %uint %3749 %3750 + %3752 = OpShiftRightLogical %uint %3748 %uint_9 + %3753 = OpShiftLeftLogical %uint %3741 %uint_23 + %3754 = OpISub %uint %3752 %3753 + %3755 = OpIAdd %uint %3754 %uint_1056964608 + %3756 = OpBitwiseOr %uint %3755 %3736 + %3757 = OpBitcast %float %3756 + %3758 = OpShiftLeftLogical %uint %3748 %uint_23 + %3759 = OpShiftRightLogical %uint %3751 %uint_9 + %3760 = OpBitwiseOr %uint %3759 %3758 + %3761 = OpExtInst %uint %184 FindUMsb %3760 + %3762 = OpISub %uint %uint_31 %3761 + %3763 = OpBitwiseXor %uint %3762 %uint_4294967295 + %3764 = OpIAdd %uint %3762 %uint_1 + %3765 = OpISub %uint %uint_31 %3762 + %3766 = OpBitwiseAnd %uint %3764 %uint_31 + %3767 = OpShiftLeftLogical %uint %3760 %3766 + %3768 = OpBitwiseAnd %uint %3765 %uint_31 + %3769 = OpShiftRightLogical %uint %3751 %3768 + %3770 = OpBitwiseOr %uint %3767 %3769 + %3771 = OpISub %uint %3763 %3741 + %3772 = OpShiftLeftLogical %uint %3771 %uint_23 + %3773 = OpShiftRightLogical %uint %3770 %uint_9 + %3774 = OpIAdd %uint %3772 %uint_864026624 + %3775 = OpBitwiseOr %uint %3773 %3774 + %3776 = OpBitwiseOr %uint %3775 %3736 + %3777 = OpBitcast %float %3776 + %3778 = OpFMul %float %3757 %float_1_57079625 + %3779 = OpFNegate %float %3778 + %3780 = OpIsNan %bool %3757 + %3781 = OpLogicalNot %bool %3780 + OpSelectionMerge %4836 None + OpBranchConditional %3781 %3784 %4836 + %3784 = OpLabel + %3785 = OpIsNan %bool %float_1_57079625 + %3786 = OpLogicalNot %bool %3785 + OpSelectionMerge %4301 None + OpBranchConditional %3786 %3789 %4301 + %3789 = OpLabel + %3790 = OpIsNan %bool %3779 + %3791 = OpLogicalNot %bool %3790 + OpSelectionMerge %4297 None + OpBranchConditional %3791 %3794 %4297 + %3794 = OpLabel + %3795 = OpIsInf %bool %3757 + %3796 = OpLogicalNot %bool %3795 + OpSelectionMerge %4293 None + OpBranchConditional %3796 %3799 %4293 + %3799 = OpLabel + %3800 = OpIsInf %bool %float_1_57079625 + %3801 = OpLogicalNot %bool %3800 + OpSelectionMerge %4290 None + OpBranchConditional %3801 %3804 %4290 + %3804 = OpLabel + %3805 = OpIsInf %bool %3779 + %3806 = OpLogicalNot %bool %3805 + OpSelectionMerge %4287 None + OpBranchConditional %3806 %3809 %4287 + %3809 = OpLabel + %3810 = OpCompositeInsert %v2float %3757 %262 1 + %3811 = OpBitcast %v2uint %3810 + %3812 = OpBitwiseAnd %v2uint %3811 %267 + %3813 = OpINotEqual %v2bool %3812 %270 + %3814 = OpBitwiseAnd %v2uint %3811 %272 + %3815 = OpIEqual %v2bool %3814 %270 + %3816 = OpLogicalOr %v2bool %3815 %3813 + %3817 = OpBitwiseAnd %v2uint %3811 %277 + %3818 = OpBitcast %v2float %3817 + %3819 = OpSelect %v2float %3816 %3810 %3818 + %3820 = OpBitcast %uint %3779 + %3821 = OpBitwiseAnd %uint %3820 %uint_2139095040 + %3822 = OpINotEqual %bool %3821 %uint_0 + %3823 = OpBitwiseAnd %uint %3820 %uint_8388607 + %3824 = OpIEqual %bool %3823 %uint_0 + %3825 = OpLogicalOr %bool %3824 %3822 + %3826 = OpBitwiseAnd %uint %3820 %uint_2147483648 + %3827 = OpBitcast %float %3826 + %3828 = OpSelect %float %3825 %3779 %3827 + %3829 = OpFOrdEqual %v2bool %3819 %290 + %3830 = OpVectorShuffle %v2bool %3829 %292 1 4294967295 + %3831 = OpLogicalOr %v2bool %3830 %3829 + %3832 = OpCompositeExtract %bool %3831 0 + %3833 = OpLogicalNot %bool %3832 + OpSelectionMerge %4284 None + OpBranchConditional %3833 %3836 %4284 + %3836 = OpLabel + %3837 = OpFUnordNotEqual %bool %3828 %float_0 + OpSelectionMerge %4271 None + OpBranchConditional %3837 %3840 %4271 + %3840 = OpLabel + %3841 = OpBitcast %v2uint %3819 + %3842 = OpCompositeExtract %uint %3841 1 + %3843 = OpShiftRightLogical %uint %3842 %uint_23 + %3844 = OpBitwiseAnd %uint %3843 %uint_255 + %3845 = OpCompositeExtract %uint %3841 0 + %3846 = OpShiftRightLogical %uint %3845 %uint_23 + %3847 = OpBitwiseAnd %uint %3846 %uint_255 + %3848 = OpBitcast %uint %3828 + %3849 = OpShiftRightLogical %uint %3848 %uint_23 + %3850 = OpBitwiseAnd %uint %3849 %uint_255 + %3851 = OpIAdd %uint %3850 %uint_4294967169 + %3852 = OpBitwiseAnd %v2uint %3841 %272 + %3853 = OpBitwiseOr %v2uint %3852 %319 + %3854 = OpBitwiseAnd %uint %3848 %uint_2147483648 + %3855 = OpBitwiseXor %uint %3845 %3842 + %3856 = OpBitwiseAnd %uint %3855 %uint_2147483648 + %3857 = OpCompositeExtract %uint %3853 0 + %3858 = OpCompositeExtract %uint %3853 1 + %3859 = OpUMulExtended %_struct_58 %3858 %3857 + %3860 = OpCompositeExtract %uint %3859 1 + %3861 = OpIMul %uint %3857 %3858 + %3862 = OpShiftLeftLogical %uint %3860 %uint_14 + %3863 = OpShiftRightLogical %uint %3861 %uint_18 + %3864 = OpBitwiseOr %uint %3863 %3862 + %3865 = OpShiftLeftLogical %uint %3861 %uint_14 + %3866 = OpCompositeConstruct %v2uint %3865 %3864 + %3867 = OpBitwiseOr %uint %3864 %3865 + %3868 = OpIEqual %bool %3867 %uint_0 + %3869 = OpIAdd %uint %3844 %uint_4294967042 + %3870 = OpIAdd %uint %3869 %3847 + %3871 = OpSelect %uint %3868 %uint_0 %3870 + %3872 = OpBitwiseOr %uint %3871 %3867 + %3873 = OpINotEqual %bool %3872 %uint_0 + OpSelectionMerge %4268 None + OpBranchConditional %3873 %3876 %4268 + %3876 = OpLabel + %3877 = OpISub %uint %3871 %3851 + %3878 = OpShiftLeftLogical %uint %3848 %uint_5 + %3879 = OpBitwiseAnd %uint %3878 %uint_268435424 + %3880 = OpBitwiseOr %uint %3879 %uint_268435456 + %3881 = OpCompositeInsert %v2uint %3880 %355 1 + %3882 = OpExtInst %uint %184 SAbs %3877 + %3883 = OpINotEqual %bool %3882 %uint_0 + OpSelectionMerge %3910 None + OpBranchConditional %3883 %3886 %3910 + %3886 = OpLabel + %3887 = OpUGreaterThanEqual %bool %3882 %uint_32 + OpSelectionMerge %3895 None + OpBranchConditional %3887 %3890 %3895 + %3890 = OpLabel + %3891 = OpBitwiseAnd %uint %3882 %uint_31 + %3892 = OpShiftLeftLogical %uint %uint_1 %3891 + %3893 = OpCompositeInsert %v2uint %3892 %355 1 + OpBranch %3895 + %3895 = OpLabel + %3896 = OpPhi %v2uint %3893 %3890 %528 %3886 + %3897 = OpPhi %bool %false %3890 %true %3886 + OpSelectionMerge %3907 None + OpBranchConditional %3897 %3900 %3907 + %3900 = OpLabel + %3901 = OpISub %uint %uint_0 %3882 + %3902 = OpBitwiseAnd %uint %3901 %uint_31 + %3903 = OpShiftRightLogical %uint %uint_1 %3902 + %3904 = OpShiftLeftLogical %uint %uint_1 %3882 + %3905 = OpCompositeConstruct %v2uint %3904 %3903 + OpBranch %3907 + %3907 = OpLabel + %3908 = OpPhi %v2uint %3905 %3900 %3896 %3895 + OpBranch %3910 + %3910 = OpLabel + %3911 = OpPhi %v2uint %7106 %3876 %3908 %3907 + %3912 = OpCompositeExtract %uint %3911 0 + %3913 = OpShiftRightLogical %uint %3912 %uint_1 + %3914 = OpIAdd %uint %3913 %uint_2147483647 + %3915 = OpBitwiseAnd %uint %3912 %uint_1 + %3916 = OpIAdd %uint %3914 %3915 + %3917 = OpShiftRightLogical %uint %3916 %uint_31 + %3918 = OpIAdd %uint %3912 %uint_4294967295 + %3919 = OpCompositeExtract %uint %3911 1 + %3920 = OpIAdd %uint %3919 %uint_4294967295 + %3921 = OpIAdd %uint %3920 %3917 + %3922 = OpCompositeConstruct %v2uint %3918 %3921 + %3923 = OpSLessThanEqual %bool %3877 %uint_0 + OpSelectionMerge %3975 None + OpBranchConditional %3923 %3926 %3975 + %3926 = OpLabel + %3927 = OpSGreaterThanEqual %bool %3877 %uint_4294967233 + OpSelectionMerge %3970 None + OpBranchConditional %3927 %3930 %3970 + %3930 = OpLabel + %3931 = OpISub %uint %uint_0 %3877 + %3932 = OpBitwiseAnd %v2uint %3922 %3866 + %3933 = OpINotEqual %bool %3871 %3851 + OpSelectionMerge %3965 None + OpBranchConditional %3933 %3936 %3965 + %3936 = OpLabel + %3937 = OpUGreaterThanEqual %bool %3931 %uint_32 + OpSelectionMerge %3945 None + OpBranchConditional %3937 %3940 %3945 + %3940 = OpLabel + %3941 = OpBitwiseAnd %uint %3931 %uint_31 + %3942 = OpShiftRightLogical %uint %3864 %3941 + %3943 = OpCompositeInsert %v2uint %3942 %420 0 + OpBranch %3945 + %3945 = OpLabel + %3946 = OpPhi %v2uint %3881 %3940 %528 %3936 + %3947 = OpPhi %v2uint %3932 %3940 %528 %3936 + %3948 = OpPhi %v2uint %3943 %3940 %528 %3936 + %3949 = OpPhi %bool %false %3940 %true %3936 + OpSelectionMerge %3960 None + OpBranchConditional %3949 %3952 %3960 + %3952 = OpLabel + %3953 = OpShiftRightLogical %uint %3865 %3931 + %3954 = OpBitwiseAnd %uint %3877 %uint_31 + %3955 = OpShiftLeftLogical %uint %3864 %3954 + %3956 = OpBitwiseOr %uint %3955 %3953 + %3957 = OpShiftRightLogical %uint %3864 %3931 + %3958 = OpCompositeConstruct %v2uint %3956 %3957 + OpBranch %3960 + %3960 = OpLabel + %3961 = OpPhi %v2uint %3881 %3952 %3946 %3945 + %3962 = OpPhi %v2uint %3932 %3952 %3947 %3945 + %3963 = OpPhi %v2uint %3958 %3952 %3948 %3945 + OpBranch %3965 + %3965 = OpLabel + %3966 = OpPhi %v2uint %3961 %3960 %3881 %3930 + %3967 = OpPhi %v2uint %3962 %3960 %3932 %3930 + %3968 = OpPhi %v2uint %3963 %3960 %3866 %3930 + OpBranch %3970 + %3970 = OpLabel + %3971 = OpPhi %v2uint %3966 %3965 %3881 %3926 + %3972 = OpPhi %v2uint %3967 %3965 %3866 %3926 + %3973 = OpPhi %v2uint %3968 %3965 %270 %3926 + OpBranch %3975 + %3975 = OpLabel + %3976 = OpPhi %v2uint %3971 %3970 %528 %3910 + %3977 = OpPhi %v2uint %3972 %3970 %528 %3910 + %3978 = OpPhi %v2uint %3973 %3970 %528 %3910 + %3979 = OpPhi %bool %false %3970 %true %3910 + OpSelectionMerge %4021 None + OpBranchConditional %3979 %3982 %4021 + %3982 = OpLabel + %3983 = OpULessThanEqual %bool %3877 %uint_63 + OpSelectionMerge %4016 None + OpBranchConditional %3983 %3986 %4016 + %3986 = OpLabel + %3987 = OpBitwiseAnd %uint %3921 %3880 + %3988 = OpCompositeInsert %v2uint %3987 %355 1 + %3989 = OpUGreaterThanEqual %bool %3877 %uint_32 + OpSelectionMerge %3997 None + OpBranchConditional %3989 %3992 %3997 + %3992 = OpLabel + %3993 = OpBitwiseAnd %uint %3877 %uint_31 + %3994 = OpShiftRightLogical %uint %3880 %3993 + %3995 = OpCompositeInsert %v2uint %3994 %420 0 + OpBranch %3997 + %3997 = OpLabel + %3998 = OpPhi %v2uint %3995 %3992 %528 %3986 + %3999 = OpPhi %v2uint %3988 %3992 %528 %3986 + %4000 = OpPhi %v2uint %3866 %3992 %528 %3986 + %4001 = OpPhi %bool %false %3992 %true %3986 + OpSelectionMerge %4011 None + OpBranchConditional %4001 %4004 %4011 + %4004 = OpLabel + %4005 = OpISub %uint %uint_0 %3877 + %4006 = OpBitwiseAnd %uint %4005 %uint_31 + %4007 = OpShiftLeftLogical %uint %3880 %4006 + %4008 = OpShiftRightLogical %uint %3880 %3877 + %4009 = OpCompositeConstruct %v2uint %4007 %4008 + OpBranch %4011 + %4011 = OpLabel + %4012 = OpPhi %v2uint %4009 %4004 %3998 %3997 + %4013 = OpPhi %v2uint %3988 %4004 %3999 %3997 + %4014 = OpPhi %v2uint %3866 %4004 %4000 %3997 + OpBranch %4016 + %4016 = OpLabel + %4017 = OpPhi %v2uint %4012 %4011 %270 %3982 + %4018 = OpPhi %v2uint %4013 %4011 %3881 %3982 + %4019 = OpPhi %v2uint %4014 %4011 %3866 %3982 + OpBranch %4021 + %4021 = OpLabel + %4022 = OpPhi %v2uint %3978 %3975 %4019 %4016 + %4023 = OpPhi %v2uint %3977 %3975 %4018 %4016 + %4024 = OpPhi %v2uint %3976 %3975 %4017 %4016 + %4025 = OpExtInst %uint %184 SMax %3871 %3851 + %4026 = OpINotEqual %bool %3854 %3856 + OpSelectionMerge %4073 None + OpBranchConditional %4026 %4029 %4073 + %4029 = OpLabel + %4030 = OpCompositeExtract %uint %4024 0 + %4031 = OpBitwiseXor %uint %4030 %uint_4294967295 + %4032 = OpCompositeExtract %uint %4024 1 + %4033 = OpBitwiseXor %uint %4032 %uint_4294967295 + %4034 = OpShiftRightLogical %uint %4031 %uint_1 + %4035 = OpBitwiseAnd %uint %4031 %uint_1 + %4036 = OpIAdd %uint %4034 %4035 + %4037 = OpShiftRightLogical %uint %4036 %uint_31 + %4038 = OpISub %uint %uint_0 %4030 + %4039 = OpCompositeExtract %uint %4022 0 + %4040 = OpShiftRightLogical %uint %4039 %uint_1 + %4041 = OpShiftRightLogical %uint %4038 %uint_1 + %4042 = OpIAdd %uint %4041 %4040 + %4043 = OpBitwiseAnd %uint %4039 %uint_1 + %4044 = OpBitwiseAnd %uint %4043 %4038 + %4045 = OpIAdd %uint %4042 %4044 + %4046 = OpShiftRightLogical %uint %4045 %uint_31 + %4047 = OpISub %uint %4039 %4030 + %4048 = OpCompositeExtract %uint %4022 1 + %4049 = OpVectorShuffle %v2uint %4023 %528 1 4294967295 + %4050 = OpBitwiseOr %v2uint %4049 %4023 + %4051 = OpCompositeExtract %uint %4050 0 + %4052 = OpINotEqual %bool %4051 %uint_0 + %4053 = OpSGreaterThan %bool %3871 %3851 + %4054 = OpSelect %bool %4052 %4053 %false + %4055 = OpSelect %v2uint %4054 %536 %270 + %4056 = OpCompositeExtract %uint %4055 0 + %4057 = OpShiftRightLogical %uint %4047 %uint_1 + %4058 = OpShiftRightLogical %uint %4056 %uint_1 + %4059 = OpIAdd %uint %4058 %4057 + %4060 = OpBitwiseAnd %uint %4047 %uint_1 + %4061 = OpBitwiseAnd %uint %4060 %4056 + %4062 = OpIAdd %uint %4059 %4061 + %4063 = OpShiftRightLogical %uint %4062 %uint_31 + %4064 = OpIAdd %uint %4056 %4047 + %4065 = OpCompositeExtract %uint %4055 1 + %4066 = OpIAdd %uint %4048 %4033 + %4067 = OpIAdd %uint %4066 %4037 + %4068 = OpIAdd %uint %4067 %4046 + %4069 = OpIAdd %uint %4068 %4065 + %4070 = OpIAdd %uint %4069 %4063 + %4071 = OpCompositeConstruct %v2uint %4064 %4070 + OpBranch %4073 + %4073 = OpLabel + %4074 = OpPhi %v2uint %4071 %4029 %528 %4021 + %4075 = OpPhi %bool %false %4029 %true %4021 + OpSelectionMerge %4094 None + OpBranchConditional %4075 %4078 %4094 + %4078 = OpLabel + %4079 = OpCompositeExtract %uint %4022 0 + %4080 = OpCompositeExtract %uint %4024 0 + %4081 = OpShiftRightLogical %uint %4079 %uint_1 + %4082 = OpShiftRightLogical %uint %4080 %uint_1 + %4083 = OpIAdd %uint %4082 %4081 + %4084 = OpBitwiseAnd %uint %4079 %uint_1 + %4085 = OpBitwiseAnd %uint %4084 %4080 + %4086 = OpIAdd %uint %4083 %4085 + %4087 = OpShiftRightLogical %uint %4086 %uint_31 + %4088 = OpIAdd %uint %4080 %4079 + %4089 = OpIAdd %v2uint %4024 %4022 + %4090 = OpCompositeExtract %uint %4089 1 + %4091 = OpIAdd %uint %4087 %4090 + %4092 = OpCompositeConstruct %v2uint %4088 %4091 + OpBranch %4094 + %4094 = OpLabel + %4095 = OpPhi %v2uint %4092 %4078 %4074 %4073 + %4096 = OpCompositeExtract %uint %4095 1 + %4097 = OpSLessThan %bool %4096 %uint_0 + OpSelectionMerge %4113 None + OpBranchConditional %4097 %4100 %4113 + %4100 = OpLabel + %4101 = OpCompositeExtract %uint %4095 0 + %4102 = OpBitwiseXor %uint %4101 %uint_4294967295 + %4103 = OpBitwiseXor %uint %4096 %uint_4294967295 + %4104 = OpShiftRightLogical %uint %4102 %uint_1 + %4105 = OpBitwiseAnd %uint %4102 %uint_1 + %4106 = OpIAdd %uint %4104 %4105 + %4107 = OpShiftRightLogical %uint %4106 %uint_31 + %4108 = OpISub %uint %uint_0 %4101 + %4109 = OpIAdd %uint %4107 %4103 + %4110 = OpCompositeConstruct %v2uint %4108 %4109 + %4111 = OpBitwiseXor %uint %3856 %uint_2147483648 + OpBranch %4113 + %4113 = OpLabel + %4114 = OpPhi %uint %4111 %4100 %3856 %4094 + %4115 = OpPhi %v2uint %4110 %4100 %4095 %4094 + %4116 = OpCompositeExtract %uint %4115 1 + %4117 = OpExtInst %uint %184 FindUMsb %4116 + %4118 = OpISub %uint %uint_31 %4117 + %4119 = OpIEqual %bool %4116 %uint_0 + %4120 = OpCompositeExtract %uint %4115 0 + %4121 = OpExtInst %uint %184 FindUMsb %4120 + %4122 = OpISub %uint %uint_31 %4121 + %4123 = OpIAdd %uint %4122 %uint_32 + %4124 = OpSelect %uint %4119 %4123 %4118 + %4125 = OpISub %uint %uint_3 %4124 + %4126 = OpIAdd %uint %4125 %4025 + %4127 = OpUGreaterThan %bool %4124 %uint_3 + OpSelectionMerge %4158 None + OpBranchConditional %4127 %4130 %4158 + %4130 = OpLabel + %4131 = OpIAdd %uint %4124 %uint_4294967293 + %4132 = OpUGreaterThanEqual %bool %4131 %uint_32 + OpSelectionMerge %4140 None + OpBranchConditional %4132 %4135 %4140 + %4135 = OpLabel + %4136 = OpBitwiseAnd %uint %4131 %uint_31 + %4137 = OpShiftLeftLogical %uint %4120 %4136 + %4138 = OpCompositeInsert %v2uint %4137 %355 1 + OpBranch %4140 + %4140 = OpLabel + %4141 = OpPhi %uint %uint_0 %4135 %354 %4130 + %4142 = OpPhi %v2uint %4138 %4135 %528 %4130 + %4143 = OpPhi %bool %false %4135 %true %4130 + OpSelectionMerge %4154 None + OpBranchConditional %4143 %4146 %4154 + %4146 = OpLabel + %4147 = OpShiftLeftLogical %uint %4116 %4131 + %4148 = OpBitwiseAnd %uint %4125 %uint_31 + %4149 = OpShiftRightLogical %uint %4120 %4148 + %4150 = OpBitwiseOr %uint %4149 %4147 + %4151 = OpShiftLeftLogical %uint %4120 %4131 + %4152 = OpCompositeConstruct %v2uint %4151 %4150 + OpBranch %4154 + %4154 = OpLabel + %4155 = OpPhi %uint %uint_0 %4146 %4141 %4140 + %4156 = OpPhi %v2uint %4152 %4146 %4142 %4140 + OpBranch %4158 + %4158 = OpLabel + %4159 = OpPhi %v2uint %4115 %4113 %4156 %4154 + %4160 = OpPhi %uint %4125 %4113 %4155 %4154 + %4161 = OpIAdd %uint %4160 %uint_5 + %4162 = OpBitwiseAnd %uint %4161 %uint_31 + %4163 = OpShiftLeftLogical %uint %uint_1 %4162 + %4164 = OpCompositeInsert %v2uint %4163 %355 1 + %4165 = OpIAdd %uint %4163 %uint_4294967295 + %4166 = OpCompositeInsert %v2uint %4165 %650 1 + %4167 = OpBitwiseAnd %v2uint %4166 %4159 + %4168 = OpCompositeExtract %uint %4167 1 + %4169 = OpBitwiseAnd %v2uint %4164 %4159 + %4170 = OpIAdd %uint %4160 %uint_2 + %4171 = OpBitwiseAnd %uint %4170 %uint_31 + %4172 = OpShiftLeftLogical %uint %uint_4 %4171 + %4173 = OpUGreaterThan %bool %4168 %4172 + %4174 = OpLogicalNot %bool %4173 + OpSelectionMerge %4205 None + OpBranchConditional %4174 %4177 %4205 + %4177 = OpLabel + %4178 = OpCompositeExtract %uint %4167 0 + %4179 = OpVectorShuffle %v2uint %4023 %528 1 4294967295 + %4180 = OpBitwiseOr %v2uint %4179 %4023 + %4181 = OpCompositeExtract %uint %4180 0 + %4182 = OpINotEqual %bool %4181 %uint_0 + %4183 = OpSelect %uint %4182 %uint_1 %uint_0 + %4184 = OpBitwiseOr %uint %4178 %4183 + %4185 = OpIEqual %bool %4168 %4172 + %4186 = OpINotEqual %bool %4184 %uint_0 + %4187 = OpSelect %bool %4185 %4186 %false + %4188 = OpLogicalNot %bool %4187 + OpSelectionMerge %4201 None + OpBranchConditional %4188 %4191 %4201 + %4191 = OpLabel + %4192 = OpINotEqual %bool %4168 %4172 + %4193 = OpLogicalOr %bool %4192 %4186 + %4194 = OpVectorShuffle %v2uint %4169 %528 1 4294967295 + %4195 = OpBitwiseOr %v2uint %4194 %4169 + %4196 = OpCompositeExtract %uint %4195 0 + %4197 = OpIEqual %bool %4196 %uint_0 + %4198 = OpSelect %bool %4193 %true %4197 + %4199 = OpLogicalNot %bool %4198 + OpBranch %4201 + %4201 = OpLabel + %4202 = OpPhi %v2uint %4159 %4191 %528 %4177 + %4203 = OpPhi %bool %4199 %4191 %4187 %4177 + OpBranch %4205 + %4205 = OpLabel + %4206 = OpPhi %v2uint %4202 %4201 %528 %4158 + %4207 = OpPhi %bool %4203 %4201 %4173 %4158 + OpSelectionMerge %4215 None + OpBranchConditional %4207 %4210 %4215 + %4210 = OpLabel + %4211 = OpCompositeExtract %uint %4159 1 + %4212 = OpIAdd %uint %4163 %4211 + %4213 = OpCompositeInsert %v2uint %4212 %4159 1 + OpBranch %4215 + %4215 = OpLabel + %4216 = OpPhi %v2uint %4213 %4210 %4206 %4205 + %4217 = OpCompositeExtract %uint %4216 1 + %4218 = OpShiftRightLogical %uint %4217 %4162 + %4219 = OpUGreaterThan %bool %4218 %uint_16777215 + %4220 = OpSelect %uint %4219 %uint_1 %uint_0 + %4221 = OpShiftRightLogical %uint %4218 %4220 + %4222 = OpIAdd %uint %4126 %4220 + %4223 = OpINotEqual %bool %4221 %uint_0 + OpSelectionMerge %4265 None + OpBranchConditional %4223 %4226 %4265 + %4226 = OpLabel + %4227 = OpSLessThanEqual %bool %4222 %uint_127 + OpSelectionMerge %4253 None + OpBranchConditional %4227 %4230 %4253 + %4230 = OpLabel + %4231 = OpSGreaterThanEqual %bool %4222 %uint_4294967170 + OpSelectionMerge %4242 None + OpBranchConditional %4231 %4234 %4242 + %4234 = OpLabel + %4235 = OpShiftLeftLogical %uint %4222 %uint_23 + %4236 = OpIAdd %uint %4235 %uint_1065353216 + %4237 = OpBitwiseAnd %uint %4221 %uint_8388607 + %4238 = OpBitwiseOr %uint %4236 %4237 + %4239 = OpBitwiseOr %uint %4238 %4114 + %4240 = OpBitcast %float %4239 + OpBranch %4242 + %4242 = OpLabel + %4243 = OpPhi %float %4240 %4234 %261 %4230 + %4244 = OpPhi %bool %false %4234 %true %4230 + OpSelectionMerge %4250 None + OpBranchConditional %4244 %4247 %4250 + %4247 = OpLabel + %4248 = OpBitcast %float %4114 + OpBranch %4250 + %4250 = OpLabel + %4251 = OpPhi %float %4248 %4247 %4243 %4242 + OpBranch %4253 + %4253 = OpLabel + %4254 = OpPhi %float %4251 %4250 %261 %4226 + %4255 = OpPhi %bool %false %4250 %true %4226 + OpSelectionMerge %4262 None + OpBranchConditional %4255 %4258 %4262 + %4258 = OpLabel + %4259 = OpBitwiseOr %uint %4114 %uint_2139095040 + %4260 = OpBitcast %float %4259 + OpBranch %4262 + %4262 = OpLabel + %4263 = OpPhi %float %4260 %4258 %4254 %4253 + OpBranch %4265 + %4265 = OpLabel + %4266 = OpPhi %float %4263 %4262 %float_0 %4215 + OpBranch %4268 + %4268 = OpLabel + %4269 = OpPhi %float %4266 %4265 %3828 %3840 + OpBranch %4271 + %4271 = OpLabel + %4272 = OpPhi %float %4269 %4268 %261 %3836 + %4273 = OpPhi %bool %false %4268 %true %3836 + OpSelectionMerge %4281 None + OpBranchConditional %4273 %4276 %4281 + %4276 = OpLabel + %4277 = OpVectorShuffle %v2float %3819 %768 1 4294967295 + %4278 = OpFMul %v2float %3819 %4277 + %4279 = OpCompositeExtract %float %4278 0 + OpBranch %4281 + %4281 = OpLabel + %4282 = OpPhi %float %4279 %4276 %4272 %4271 + OpBranch %4284 + %4284 = OpLabel + %4285 = OpPhi %float %4282 %4281 %3828 %3809 + OpBranch %4287 + %4287 = OpLabel + %4288 = OpPhi %float %4285 %4284 %3779 %3804 + OpBranch %4290 + %4290 = OpLabel + %4291 = OpPhi %float %4288 %4287 %261 %3799 + OpBranch %4293 + %4293 = OpLabel + %4294 = OpPhi %float %4291 %4290 %261 %3794 + %4295 = OpPhi %bool %3800 %4290 %true %3794 + OpBranch %4297 + %4297 = OpLabel + %4298 = OpPhi %float %4294 %4293 %261 %3789 + %4299 = OpPhi %bool %4295 %4293 %3790 %3789 + OpBranch %4301 + %4301 = OpLabel + %4302 = OpPhi %float %4298 %4297 %261 %3784 + %4303 = OpPhi %bool %4299 %4297 %true %3784 + OpSelectionMerge %4309 None + OpBranchConditional %4303 %4306 %4309 + %4306 = OpLabel + %4307 = OpFSub %float %3778 %3778 + OpBranch %4309 + %4309 = OpLabel + %4310 = OpPhi %float %4307 %4306 %4302 %4301 + %4311 = OpIsNan %bool %float_7_54978942en08 + %4312 = OpLogicalNot %bool %4311 + OpSelectionMerge %4831 None + OpBranchConditional %4312 %4315 %4831 + %4315 = OpLabel + %4316 = OpIsNan %bool %4310 + %4317 = OpLogicalNot %bool %4316 + OpSelectionMerge %4826 None + OpBranchConditional %4317 %4320 %4826 + %4320 = OpLabel + %4321 = OpIsInf %bool %3757 + %4322 = OpLogicalNot %bool %4321 + OpSelectionMerge %4821 None + OpBranchConditional %4322 %4325 %4821 + %4325 = OpLabel + %4326 = OpIsInf %bool %float_7_54978942en08 + %4327 = OpLogicalNot %bool %4326 + OpSelectionMerge %4816 None + OpBranchConditional %4327 %4330 %4816 + %4330 = OpLabel + %4331 = OpIsInf %bool %4310 + %4332 = OpLogicalNot %bool %4331 + OpSelectionMerge %4813 None + OpBranchConditional %4332 %4335 %4813 + %4335 = OpLabel + %4336 = OpCompositeInsert %v2float %3757 %829 1 + %4337 = OpBitcast %v2uint %4336 + %4338 = OpBitwiseAnd %v2uint %4337 %267 + %4339 = OpINotEqual %v2bool %4338 %270 + %4340 = OpBitwiseAnd %v2uint %4337 %272 + %4341 = OpIEqual %v2bool %4340 %270 + %4342 = OpLogicalOr %v2bool %4341 %4339 + %4343 = OpBitwiseAnd %v2uint %4337 %277 + %4344 = OpBitcast %v2float %4343 + %4345 = OpSelect %v2float %4342 %4336 %4344 + %4346 = OpBitcast %uint %4310 + %4347 = OpBitwiseAnd %uint %4346 %uint_2139095040 + %4348 = OpINotEqual %bool %4347 %uint_0 + %4349 = OpBitwiseAnd %uint %4346 %uint_8388607 + %4350 = OpIEqual %bool %4349 %uint_0 + %4351 = OpLogicalOr %bool %4350 %4348 + %4352 = OpBitwiseAnd %uint %4346 %uint_2147483648 + %4353 = OpBitcast %float %4352 + %4354 = OpSelect %float %4351 %4310 %4353 + %4355 = OpFOrdEqual %v2bool %4345 %290 + %4356 = OpVectorShuffle %v2bool %4355 %292 1 4294967295 + %4357 = OpLogicalOr %v2bool %4356 %4355 + %4358 = OpCompositeExtract %bool %4357 0 + %4359 = OpLogicalNot %bool %4358 + OpSelectionMerge %4810 None + OpBranchConditional %4359 %4362 %4810 + %4362 = OpLabel + %4363 = OpFUnordNotEqual %bool %4354 %float_0 + OpSelectionMerge %4797 None + OpBranchConditional %4363 %4366 %4797 + %4366 = OpLabel + %4367 = OpBitcast %v2uint %4345 + %4368 = OpCompositeExtract %uint %4367 1 + %4369 = OpShiftRightLogical %uint %4368 %uint_23 + %4370 = OpBitwiseAnd %uint %4369 %uint_255 + %4371 = OpCompositeExtract %uint %4367 0 + %4372 = OpShiftRightLogical %uint %4371 %uint_23 + %4373 = OpBitwiseAnd %uint %4372 %uint_255 + %4374 = OpBitcast %uint %4354 + %4375 = OpShiftRightLogical %uint %4374 %uint_23 + %4376 = OpBitwiseAnd %uint %4375 %uint_255 + %4377 = OpIAdd %uint %4376 %uint_4294967169 + %4378 = OpBitwiseAnd %v2uint %4367 %272 + %4379 = OpBitwiseOr %v2uint %4378 %319 + %4380 = OpBitwiseAnd %uint %4374 %uint_2147483648 + %4381 = OpBitwiseXor %uint %4371 %4368 + %4382 = OpBitwiseAnd %uint %4381 %uint_2147483648 + %4383 = OpCompositeExtract %uint %4379 0 + %4384 = OpCompositeExtract %uint %4379 1 + %4385 = OpUMulExtended %_struct_58 %4384 %4383 + %4386 = OpCompositeExtract %uint %4385 1 + %4387 = OpIMul %uint %4383 %4384 + %4388 = OpShiftLeftLogical %uint %4386 %uint_14 + %4389 = OpShiftRightLogical %uint %4387 %uint_18 + %4390 = OpBitwiseOr %uint %4389 %4388 + %4391 = OpShiftLeftLogical %uint %4387 %uint_14 + %4392 = OpCompositeConstruct %v2uint %4391 %4390 + %4393 = OpBitwiseOr %uint %4390 %4391 + %4394 = OpIEqual %bool %4393 %uint_0 + %4395 = OpIAdd %uint %4370 %uint_4294967042 + %4396 = OpIAdd %uint %4395 %4373 + %4397 = OpSelect %uint %4394 %uint_0 %4396 + %4398 = OpBitwiseOr %uint %4397 %4393 + %4399 = OpINotEqual %bool %4398 %uint_0 + OpSelectionMerge %4794 None + OpBranchConditional %4399 %4402 %4794 + %4402 = OpLabel + %4403 = OpISub %uint %4397 %4377 + %4404 = OpShiftLeftLogical %uint %4374 %uint_5 + %4405 = OpBitwiseAnd %uint %4404 %uint_268435424 + %4406 = OpBitwiseOr %uint %4405 %uint_268435456 + %4407 = OpCompositeInsert %v2uint %4406 %355 1 + %4408 = OpExtInst %uint %184 SAbs %4403 + %4409 = OpINotEqual %bool %4408 %uint_0 + OpSelectionMerge %4436 None + OpBranchConditional %4409 %4412 %4436 + %4412 = OpLabel + %4413 = OpUGreaterThanEqual %bool %4408 %uint_32 + OpSelectionMerge %4421 None + OpBranchConditional %4413 %4416 %4421 + %4416 = OpLabel + %4417 = OpBitwiseAnd %uint %4408 %uint_31 + %4418 = OpShiftLeftLogical %uint %uint_1 %4417 + %4419 = OpCompositeInsert %v2uint %4418 %355 1 + OpBranch %4421 + %4421 = OpLabel + %4422 = OpPhi %v2uint %4419 %4416 %528 %4412 + %4423 = OpPhi %bool %false %4416 %true %4412 + OpSelectionMerge %4433 None + OpBranchConditional %4423 %4426 %4433 + %4426 = OpLabel + %4427 = OpISub %uint %uint_0 %4408 + %4428 = OpBitwiseAnd %uint %4427 %uint_31 + %4429 = OpShiftRightLogical %uint %uint_1 %4428 + %4430 = OpShiftLeftLogical %uint %uint_1 %4408 + %4431 = OpCompositeConstruct %v2uint %4430 %4429 + OpBranch %4433 + %4433 = OpLabel + %4434 = OpPhi %v2uint %4431 %4426 %4422 %4421 + OpBranch %4436 + %4436 = OpLabel + %4437 = OpPhi %v2uint %7106 %4402 %4434 %4433 + %4438 = OpCompositeExtract %uint %4437 0 + %4439 = OpShiftRightLogical %uint %4438 %uint_1 + %4440 = OpIAdd %uint %4439 %uint_2147483647 + %4441 = OpBitwiseAnd %uint %4438 %uint_1 + %4442 = OpIAdd %uint %4440 %4441 + %4443 = OpShiftRightLogical %uint %4442 %uint_31 + %4444 = OpIAdd %uint %4438 %uint_4294967295 + %4445 = OpCompositeExtract %uint %4437 1 + %4446 = OpIAdd %uint %4445 %uint_4294967295 + %4447 = OpIAdd %uint %4446 %4443 + %4448 = OpCompositeConstruct %v2uint %4444 %4447 + %4449 = OpSLessThanEqual %bool %4403 %uint_0 + OpSelectionMerge %4501 None + OpBranchConditional %4449 %4452 %4501 + %4452 = OpLabel + %4453 = OpSGreaterThanEqual %bool %4403 %uint_4294967233 + OpSelectionMerge %4496 None + OpBranchConditional %4453 %4456 %4496 + %4456 = OpLabel + %4457 = OpISub %uint %uint_0 %4403 + %4458 = OpBitwiseAnd %v2uint %4448 %4392 + %4459 = OpINotEqual %bool %4397 %4377 + OpSelectionMerge %4491 None + OpBranchConditional %4459 %4462 %4491 + %4462 = OpLabel + %4463 = OpUGreaterThanEqual %bool %4457 %uint_32 + OpSelectionMerge %4471 None + OpBranchConditional %4463 %4466 %4471 + %4466 = OpLabel + %4467 = OpBitwiseAnd %uint %4457 %uint_31 + %4468 = OpShiftRightLogical %uint %4390 %4467 + %4469 = OpCompositeInsert %v2uint %4468 %420 0 + OpBranch %4471 + %4471 = OpLabel + %4472 = OpPhi %v2uint %4407 %4466 %528 %4462 + %4473 = OpPhi %v2uint %4458 %4466 %528 %4462 + %4474 = OpPhi %v2uint %4469 %4466 %528 %4462 + %4475 = OpPhi %bool %false %4466 %true %4462 + OpSelectionMerge %4486 None + OpBranchConditional %4475 %4478 %4486 + %4478 = OpLabel + %4479 = OpShiftRightLogical %uint %4391 %4457 + %4480 = OpBitwiseAnd %uint %4403 %uint_31 + %4481 = OpShiftLeftLogical %uint %4390 %4480 + %4482 = OpBitwiseOr %uint %4481 %4479 + %4483 = OpShiftRightLogical %uint %4390 %4457 + %4484 = OpCompositeConstruct %v2uint %4482 %4483 + OpBranch %4486 + %4486 = OpLabel + %4487 = OpPhi %v2uint %4407 %4478 %4472 %4471 + %4488 = OpPhi %v2uint %4458 %4478 %4473 %4471 + %4489 = OpPhi %v2uint %4484 %4478 %4474 %4471 + OpBranch %4491 + %4491 = OpLabel + %4492 = OpPhi %v2uint %4487 %4486 %4407 %4456 + %4493 = OpPhi %v2uint %4488 %4486 %4458 %4456 + %4494 = OpPhi %v2uint %4489 %4486 %4392 %4456 + OpBranch %4496 + %4496 = OpLabel + %4497 = OpPhi %v2uint %4492 %4491 %4407 %4452 + %4498 = OpPhi %v2uint %4493 %4491 %4392 %4452 + %4499 = OpPhi %v2uint %4494 %4491 %270 %4452 + OpBranch %4501 + %4501 = OpLabel + %4502 = OpPhi %v2uint %4497 %4496 %528 %4436 + %4503 = OpPhi %v2uint %4498 %4496 %528 %4436 + %4504 = OpPhi %v2uint %4499 %4496 %528 %4436 + %4505 = OpPhi %bool %false %4496 %true %4436 + OpSelectionMerge %4547 None + OpBranchConditional %4505 %4508 %4547 + %4508 = OpLabel + %4509 = OpULessThanEqual %bool %4403 %uint_63 + OpSelectionMerge %4542 None + OpBranchConditional %4509 %4512 %4542 + %4512 = OpLabel + %4513 = OpBitwiseAnd %uint %4447 %4406 + %4514 = OpCompositeInsert %v2uint %4513 %355 1 + %4515 = OpUGreaterThanEqual %bool %4403 %uint_32 + OpSelectionMerge %4523 None + OpBranchConditional %4515 %4518 %4523 + %4518 = OpLabel + %4519 = OpBitwiseAnd %uint %4403 %uint_31 + %4520 = OpShiftRightLogical %uint %4406 %4519 + %4521 = OpCompositeInsert %v2uint %4520 %420 0 + OpBranch %4523 + %4523 = OpLabel + %4524 = OpPhi %v2uint %4521 %4518 %528 %4512 + %4525 = OpPhi %v2uint %4514 %4518 %528 %4512 + %4526 = OpPhi %v2uint %4392 %4518 %528 %4512 + %4527 = OpPhi %bool %false %4518 %true %4512 + OpSelectionMerge %4537 None + OpBranchConditional %4527 %4530 %4537 + %4530 = OpLabel + %4531 = OpISub %uint %uint_0 %4403 + %4532 = OpBitwiseAnd %uint %4531 %uint_31 + %4533 = OpShiftLeftLogical %uint %4406 %4532 + %4534 = OpShiftRightLogical %uint %4406 %4403 + %4535 = OpCompositeConstruct %v2uint %4533 %4534 + OpBranch %4537 + %4537 = OpLabel + %4538 = OpPhi %v2uint %4535 %4530 %4524 %4523 + %4539 = OpPhi %v2uint %4514 %4530 %4525 %4523 + %4540 = OpPhi %v2uint %4392 %4530 %4526 %4523 + OpBranch %4542 + %4542 = OpLabel + %4543 = OpPhi %v2uint %4538 %4537 %270 %4508 + %4544 = OpPhi %v2uint %4539 %4537 %4407 %4508 + %4545 = OpPhi %v2uint %4540 %4537 %4392 %4508 + OpBranch %4547 + %4547 = OpLabel + %4548 = OpPhi %v2uint %4504 %4501 %4545 %4542 + %4549 = OpPhi %v2uint %4503 %4501 %4544 %4542 + %4550 = OpPhi %v2uint %4502 %4501 %4543 %4542 + %4551 = OpExtInst %uint %184 SMax %4397 %4377 + %4552 = OpINotEqual %bool %4380 %4382 + OpSelectionMerge %4599 None + OpBranchConditional %4552 %4555 %4599 + %4555 = OpLabel + %4556 = OpCompositeExtract %uint %4550 0 + %4557 = OpBitwiseXor %uint %4556 %uint_4294967295 + %4558 = OpCompositeExtract %uint %4550 1 + %4559 = OpBitwiseXor %uint %4558 %uint_4294967295 + %4560 = OpShiftRightLogical %uint %4557 %uint_1 + %4561 = OpBitwiseAnd %uint %4557 %uint_1 + %4562 = OpIAdd %uint %4560 %4561 + %4563 = OpShiftRightLogical %uint %4562 %uint_31 + %4564 = OpISub %uint %uint_0 %4556 + %4565 = OpCompositeExtract %uint %4548 0 + %4566 = OpShiftRightLogical %uint %4565 %uint_1 + %4567 = OpShiftRightLogical %uint %4564 %uint_1 + %4568 = OpIAdd %uint %4567 %4566 + %4569 = OpBitwiseAnd %uint %4565 %uint_1 + %4570 = OpBitwiseAnd %uint %4569 %4564 + %4571 = OpIAdd %uint %4568 %4570 + %4572 = OpShiftRightLogical %uint %4571 %uint_31 + %4573 = OpISub %uint %4565 %4556 + %4574 = OpCompositeExtract %uint %4548 1 + %4575 = OpVectorShuffle %v2uint %4549 %528 1 4294967295 + %4576 = OpBitwiseOr %v2uint %4575 %4549 + %4577 = OpCompositeExtract %uint %4576 0 + %4578 = OpINotEqual %bool %4577 %uint_0 + %4579 = OpSGreaterThan %bool %4397 %4377 + %4580 = OpSelect %bool %4578 %4579 %false + %4581 = OpSelect %v2uint %4580 %536 %270 + %4582 = OpCompositeExtract %uint %4581 0 + %4583 = OpShiftRightLogical %uint %4573 %uint_1 + %4584 = OpShiftRightLogical %uint %4582 %uint_1 + %4585 = OpIAdd %uint %4584 %4583 + %4586 = OpBitwiseAnd %uint %4573 %uint_1 + %4587 = OpBitwiseAnd %uint %4586 %4582 + %4588 = OpIAdd %uint %4585 %4587 + %4589 = OpShiftRightLogical %uint %4588 %uint_31 + %4590 = OpIAdd %uint %4582 %4573 + %4591 = OpCompositeExtract %uint %4581 1 + %4592 = OpIAdd %uint %4574 %4559 + %4593 = OpIAdd %uint %4592 %4563 + %4594 = OpIAdd %uint %4593 %4572 + %4595 = OpIAdd %uint %4594 %4591 + %4596 = OpIAdd %uint %4595 %4589 + %4597 = OpCompositeConstruct %v2uint %4590 %4596 + OpBranch %4599 + %4599 = OpLabel + %4600 = OpPhi %v2uint %4597 %4555 %528 %4547 + %4601 = OpPhi %bool %false %4555 %true %4547 + OpSelectionMerge %4620 None + OpBranchConditional %4601 %4604 %4620 + %4604 = OpLabel + %4605 = OpCompositeExtract %uint %4548 0 + %4606 = OpCompositeExtract %uint %4550 0 + %4607 = OpShiftRightLogical %uint %4605 %uint_1 + %4608 = OpShiftRightLogical %uint %4606 %uint_1 + %4609 = OpIAdd %uint %4608 %4607 + %4610 = OpBitwiseAnd %uint %4605 %uint_1 + %4611 = OpBitwiseAnd %uint %4610 %4606 + %4612 = OpIAdd %uint %4609 %4611 + %4613 = OpShiftRightLogical %uint %4612 %uint_31 + %4614 = OpIAdd %uint %4606 %4605 + %4615 = OpIAdd %v2uint %4550 %4548 + %4616 = OpCompositeExtract %uint %4615 1 + %4617 = OpIAdd %uint %4613 %4616 + %4618 = OpCompositeConstruct %v2uint %4614 %4617 + OpBranch %4620 + %4620 = OpLabel + %4621 = OpPhi %v2uint %4618 %4604 %4600 %4599 + %4622 = OpCompositeExtract %uint %4621 1 + %4623 = OpSLessThan %bool %4622 %uint_0 + OpSelectionMerge %4639 None + OpBranchConditional %4623 %4626 %4639 + %4626 = OpLabel + %4627 = OpCompositeExtract %uint %4621 0 + %4628 = OpBitwiseXor %uint %4627 %uint_4294967295 + %4629 = OpBitwiseXor %uint %4622 %uint_4294967295 + %4630 = OpShiftRightLogical %uint %4628 %uint_1 + %4631 = OpBitwiseAnd %uint %4628 %uint_1 + %4632 = OpIAdd %uint %4630 %4631 + %4633 = OpShiftRightLogical %uint %4632 %uint_31 + %4634 = OpISub %uint %uint_0 %4627 + %4635 = OpIAdd %uint %4633 %4629 + %4636 = OpCompositeConstruct %v2uint %4634 %4635 + %4637 = OpBitwiseXor %uint %4382 %uint_2147483648 + OpBranch %4639 + %4639 = OpLabel + %4640 = OpPhi %uint %4637 %4626 %4382 %4620 + %4641 = OpPhi %v2uint %4636 %4626 %4621 %4620 + %4642 = OpCompositeExtract %uint %4641 1 + %4643 = OpExtInst %uint %184 FindUMsb %4642 + %4644 = OpISub %uint %uint_31 %4643 + %4645 = OpIEqual %bool %4642 %uint_0 + %4646 = OpCompositeExtract %uint %4641 0 + %4647 = OpExtInst %uint %184 FindUMsb %4646 + %4648 = OpISub %uint %uint_31 %4647 + %4649 = OpIAdd %uint %4648 %uint_32 + %4650 = OpSelect %uint %4645 %4649 %4644 + %4651 = OpISub %uint %uint_3 %4650 + %4652 = OpIAdd %uint %4651 %4551 + %4653 = OpUGreaterThan %bool %4650 %uint_3 + OpSelectionMerge %4684 None + OpBranchConditional %4653 %4656 %4684 + %4656 = OpLabel + %4657 = OpIAdd %uint %4650 %uint_4294967293 + %4658 = OpUGreaterThanEqual %bool %4657 %uint_32 + OpSelectionMerge %4666 None + OpBranchConditional %4658 %4661 %4666 + %4661 = OpLabel + %4662 = OpBitwiseAnd %uint %4657 %uint_31 + %4663 = OpShiftLeftLogical %uint %4646 %4662 + %4664 = OpCompositeInsert %v2uint %4663 %355 1 + OpBranch %4666 + %4666 = OpLabel + %4667 = OpPhi %uint %uint_0 %4661 %354 %4656 + %4668 = OpPhi %v2uint %4664 %4661 %528 %4656 + %4669 = OpPhi %bool %false %4661 %true %4656 + OpSelectionMerge %4680 None + OpBranchConditional %4669 %4672 %4680 + %4672 = OpLabel + %4673 = OpShiftLeftLogical %uint %4642 %4657 + %4674 = OpBitwiseAnd %uint %4651 %uint_31 + %4675 = OpShiftRightLogical %uint %4646 %4674 + %4676 = OpBitwiseOr %uint %4675 %4673 + %4677 = OpShiftLeftLogical %uint %4646 %4657 + %4678 = OpCompositeConstruct %v2uint %4677 %4676 + OpBranch %4680 + %4680 = OpLabel + %4681 = OpPhi %uint %uint_0 %4672 %4667 %4666 + %4682 = OpPhi %v2uint %4678 %4672 %4668 %4666 + OpBranch %4684 + %4684 = OpLabel + %4685 = OpPhi %v2uint %4641 %4639 %4682 %4680 + %4686 = OpPhi %uint %4651 %4639 %4681 %4680 + %4687 = OpIAdd %uint %4686 %uint_5 + %4688 = OpBitwiseAnd %uint %4687 %uint_31 + %4689 = OpShiftLeftLogical %uint %uint_1 %4688 + %4690 = OpCompositeInsert %v2uint %4689 %355 1 + %4691 = OpIAdd %uint %4689 %uint_4294967295 + %4692 = OpCompositeInsert %v2uint %4691 %650 1 + %4693 = OpBitwiseAnd %v2uint %4692 %4685 + %4694 = OpCompositeExtract %uint %4693 1 + %4695 = OpBitwiseAnd %v2uint %4690 %4685 + %4696 = OpIAdd %uint %4686 %uint_2 + %4697 = OpBitwiseAnd %uint %4696 %uint_31 + %4698 = OpShiftLeftLogical %uint %uint_4 %4697 + %4699 = OpUGreaterThan %bool %4694 %4698 + %4700 = OpLogicalNot %bool %4699 + OpSelectionMerge %4731 None + OpBranchConditional %4700 %4703 %4731 + %4703 = OpLabel + %4704 = OpCompositeExtract %uint %4693 0 + %4705 = OpVectorShuffle %v2uint %4549 %528 1 4294967295 + %4706 = OpBitwiseOr %v2uint %4705 %4549 + %4707 = OpCompositeExtract %uint %4706 0 + %4708 = OpINotEqual %bool %4707 %uint_0 + %4709 = OpSelect %uint %4708 %uint_1 %uint_0 + %4710 = OpBitwiseOr %uint %4704 %4709 + %4711 = OpIEqual %bool %4694 %4698 + %4712 = OpINotEqual %bool %4710 %uint_0 + %4713 = OpSelect %bool %4711 %4712 %false + %4714 = OpLogicalNot %bool %4713 + OpSelectionMerge %4727 None + OpBranchConditional %4714 %4717 %4727 + %4717 = OpLabel + %4718 = OpINotEqual %bool %4694 %4698 + %4719 = OpLogicalOr %bool %4718 %4712 + %4720 = OpVectorShuffle %v2uint %4695 %528 1 4294967295 + %4721 = OpBitwiseOr %v2uint %4720 %4695 + %4722 = OpCompositeExtract %uint %4721 0 + %4723 = OpIEqual %bool %4722 %uint_0 + %4724 = OpSelect %bool %4719 %true %4723 + %4725 = OpLogicalNot %bool %4724 + OpBranch %4727 + %4727 = OpLabel + %4728 = OpPhi %v2uint %4685 %4717 %528 %4703 + %4729 = OpPhi %bool %4725 %4717 %4713 %4703 + OpBranch %4731 + %4731 = OpLabel + %4732 = OpPhi %v2uint %4728 %4727 %528 %4684 + %4733 = OpPhi %bool %4729 %4727 %4699 %4684 + OpSelectionMerge %4741 None + OpBranchConditional %4733 %4736 %4741 + %4736 = OpLabel + %4737 = OpCompositeExtract %uint %4685 1 + %4738 = OpIAdd %uint %4689 %4737 + %4739 = OpCompositeInsert %v2uint %4738 %4685 1 + OpBranch %4741 + %4741 = OpLabel + %4742 = OpPhi %v2uint %4739 %4736 %4732 %4731 + %4743 = OpCompositeExtract %uint %4742 1 + %4744 = OpShiftRightLogical %uint %4743 %4688 + %4745 = OpUGreaterThan %bool %4744 %uint_16777215 + %4746 = OpSelect %uint %4745 %uint_1 %uint_0 + %4747 = OpShiftRightLogical %uint %4744 %4746 + %4748 = OpIAdd %uint %4652 %4746 + %4749 = OpINotEqual %bool %4747 %uint_0 + OpSelectionMerge %4791 None + OpBranchConditional %4749 %4752 %4791 + %4752 = OpLabel + %4753 = OpSLessThanEqual %bool %4748 %uint_127 + OpSelectionMerge %4779 None + OpBranchConditional %4753 %4756 %4779 + %4756 = OpLabel + %4757 = OpSGreaterThanEqual %bool %4748 %uint_4294967170 + OpSelectionMerge %4768 None + OpBranchConditional %4757 %4760 %4768 + %4760 = OpLabel + %4761 = OpShiftLeftLogical %uint %4748 %uint_23 + %4762 = OpIAdd %uint %4761 %uint_1065353216 + %4763 = OpBitwiseAnd %uint %4747 %uint_8388607 + %4764 = OpBitwiseOr %uint %4762 %4763 + %4765 = OpBitwiseOr %uint %4764 %4640 + %4766 = OpBitcast %float %4765 + OpBranch %4768 + %4768 = OpLabel + %4769 = OpPhi %float %4766 %4760 %261 %4756 + %4770 = OpPhi %bool %false %4760 %true %4756 + OpSelectionMerge %4776 None + OpBranchConditional %4770 %4773 %4776 + %4773 = OpLabel + %4774 = OpBitcast %float %4640 + OpBranch %4776 + %4776 = OpLabel + %4777 = OpPhi %float %4774 %4773 %4769 %4768 + OpBranch %4779 + %4779 = OpLabel + %4780 = OpPhi %float %4777 %4776 %261 %4752 + %4781 = OpPhi %bool %false %4776 %true %4752 + OpSelectionMerge %4788 None + OpBranchConditional %4781 %4784 %4788 + %4784 = OpLabel + %4785 = OpBitwiseOr %uint %4640 %uint_2139095040 + %4786 = OpBitcast %float %4785 + OpBranch %4788 + %4788 = OpLabel + %4789 = OpPhi %float %4786 %4784 %4780 %4779 + OpBranch %4791 + %4791 = OpLabel + %4792 = OpPhi %float %4789 %4788 %float_0 %4741 + OpBranch %4794 + %4794 = OpLabel + %4795 = OpPhi %float %4792 %4791 %4354 %4366 + OpBranch %4797 + %4797 = OpLabel + %4798 = OpPhi %float %4795 %4794 %261 %4362 + %4799 = OpPhi %bool %false %4794 %true %4362 + OpSelectionMerge %4807 None + OpBranchConditional %4799 %4802 %4807 + %4802 = OpLabel + %4803 = OpVectorShuffle %v2float %4345 %768 1 4294967295 + %4804 = OpFMul %v2float %4345 %4803 + %4805 = OpCompositeExtract %float %4804 0 + OpBranch %4807 + %4807 = OpLabel + %4808 = OpPhi %float %4805 %4802 %4798 %4797 + OpBranch %4810 + %4810 = OpLabel + %4811 = OpPhi %float %4808 %4807 %4354 %4335 + OpBranch %4813 + %4813 = OpLabel + %4814 = OpPhi %float %4811 %4810 %4310 %4330 + OpBranch %4816 + %4816 = OpLabel + %4817 = OpPhi %float %261 %4813 %4310 %4325 + %4818 = OpPhi %float %4814 %4813 %261 %4325 + %4819 = OpPhi %bool %false %4813 %true %4325 + OpBranch %4821 + %4821 = OpLabel + %4822 = OpPhi %float %4817 %4816 %4310 %4320 + %4823 = OpPhi %float %4818 %4816 %261 %4320 + %4824 = OpPhi %bool %4819 %4816 %4321 %4320 + OpBranch %4826 + %4826 = OpLabel + %4827 = OpPhi %float %4822 %4821 %4310 %4315 + %4828 = OpPhi %float %4823 %4821 %261 %4315 + %4829 = OpPhi %bool %4824 %4821 %4316 %4315 + OpBranch %4831 + %4831 = OpLabel + %4832 = OpPhi %float %4827 %4826 %4310 %4309 + %4833 = OpPhi %float %4828 %4826 %261 %4309 + %4834 = OpPhi %bool %4829 %4826 %4311 %4309 + OpBranch %4836 + %4836 = OpLabel + %4837 = OpPhi %float %4832 %4831 %261 %3624 + %4838 = OpPhi %float %4833 %4831 %261 %3624 + %4839 = OpPhi %bool %4834 %4831 %false %3624 + %4840 = OpPhi %bool %false %4831 %true %3624 + OpSelectionMerge %4846 None + OpBranchConditional %4840 %4843 %4846 + %4843 = OpLabel + %4844 = OpFSub %float %3778 %3778 + OpBranch %4846 + %4846 = OpLabel + %4847 = OpPhi %float %4844 %4843 %4837 %4836 + %4848 = OpPhi %float %261 %4843 %4838 %4836 + %4849 = OpPhi %bool %true %4843 %4839 %4836 + OpSelectionMerge %4856 None + OpBranchConditional %4849 %4852 %4856 + %4852 = OpLabel + %4853 = OpFMul %float %3757 %float_7_54978942en08 + %4854 = OpFAdd %float %4853 %4847 + OpBranch %4856 + %4856 = OpLabel + %4857 = OpPhi %float %4854 %4852 %4848 %4846 + %4858 = OpIsNan %bool %3777 + %4859 = OpLogicalNot %bool %4858 + OpSelectionMerge %5384 None + OpBranchConditional %4859 %4862 %5384 + %4862 = OpLabel + %4863 = OpIsNan %bool %float_1_57079625 + %4864 = OpLogicalNot %bool %4863 + OpSelectionMerge %5380 None + OpBranchConditional %4864 %4867 %5380 + %4867 = OpLabel + %4868 = OpIsNan %bool %4857 + %4869 = OpLogicalNot %bool %4868 + OpSelectionMerge %5376 None + OpBranchConditional %4869 %4872 %5376 + %4872 = OpLabel + %4873 = OpIsInf %bool %3777 + %4874 = OpLogicalNot %bool %4873 + OpSelectionMerge %5372 None + OpBranchConditional %4874 %4877 %5372 + %4877 = OpLabel + %4878 = OpIsInf %bool %float_1_57079625 + %4879 = OpLogicalNot %bool %4878 + OpSelectionMerge %5368 None + OpBranchConditional %4879 %4882 %5368 + %4882 = OpLabel + %4883 = OpIsInf %bool %4857 + %4884 = OpLogicalNot %bool %4883 + OpSelectionMerge %5365 None + OpBranchConditional %4884 %4887 %5365 + %4887 = OpLabel + %4888 = OpCompositeInsert %v2float %3777 %262 1 + %4889 = OpBitcast %v2uint %4888 + %4890 = OpBitwiseAnd %v2uint %4889 %267 + %4891 = OpINotEqual %v2bool %4890 %270 + %4892 = OpBitwiseAnd %v2uint %4889 %272 + %4893 = OpIEqual %v2bool %4892 %270 + %4894 = OpLogicalOr %v2bool %4893 %4891 + %4895 = OpBitwiseAnd %v2uint %4889 %277 + %4896 = OpBitcast %v2float %4895 + %4897 = OpSelect %v2float %4894 %4888 %4896 + %4898 = OpBitcast %uint %4857 + %4899 = OpBitwiseAnd %uint %4898 %uint_2139095040 + %4900 = OpINotEqual %bool %4899 %uint_0 + %4901 = OpBitwiseAnd %uint %4898 %uint_8388607 + %4902 = OpIEqual %bool %4901 %uint_0 + %4903 = OpLogicalOr %bool %4902 %4900 + %4904 = OpBitwiseAnd %uint %4898 %uint_2147483648 + %4905 = OpBitcast %float %4904 + %4906 = OpSelect %float %4903 %4857 %4905 + %4907 = OpFOrdEqual %v2bool %4897 %290 + %4908 = OpVectorShuffle %v2bool %4907 %292 1 4294967295 + %4909 = OpLogicalOr %v2bool %4908 %4907 + %4910 = OpCompositeExtract %bool %4909 0 + %4911 = OpLogicalNot %bool %4910 + OpSelectionMerge %5362 None + OpBranchConditional %4911 %4914 %5362 + %4914 = OpLabel + %4915 = OpFUnordNotEqual %bool %4906 %float_0 + OpSelectionMerge %5349 None + OpBranchConditional %4915 %4918 %5349 + %4918 = OpLabel + %4919 = OpBitcast %v2uint %4897 + %4920 = OpCompositeExtract %uint %4919 1 + %4921 = OpShiftRightLogical %uint %4920 %uint_23 + %4922 = OpBitwiseAnd %uint %4921 %uint_255 + %4923 = OpCompositeExtract %uint %4919 0 + %4924 = OpShiftRightLogical %uint %4923 %uint_23 + %4925 = OpBitwiseAnd %uint %4924 %uint_255 + %4926 = OpBitcast %uint %4906 + %4927 = OpShiftRightLogical %uint %4926 %uint_23 + %4928 = OpBitwiseAnd %uint %4927 %uint_255 + %4929 = OpIAdd %uint %4928 %uint_4294967169 + %4930 = OpBitwiseAnd %v2uint %4919 %272 + %4931 = OpBitwiseOr %v2uint %4930 %319 + %4932 = OpBitwiseAnd %uint %4926 %uint_2147483648 + %4933 = OpBitwiseXor %uint %4923 %4920 + %4934 = OpBitwiseAnd %uint %4933 %uint_2147483648 + %4935 = OpCompositeExtract %uint %4931 0 + %4936 = OpCompositeExtract %uint %4931 1 + %4937 = OpUMulExtended %_struct_58 %4936 %4935 + %4938 = OpCompositeExtract %uint %4937 1 + %4939 = OpIMul %uint %4935 %4936 + %4940 = OpShiftLeftLogical %uint %4938 %uint_14 + %4941 = OpShiftRightLogical %uint %4939 %uint_18 + %4942 = OpBitwiseOr %uint %4941 %4940 + %4943 = OpShiftLeftLogical %uint %4939 %uint_14 + %4944 = OpCompositeConstruct %v2uint %4943 %4942 + %4945 = OpBitwiseOr %uint %4942 %4943 + %4946 = OpIEqual %bool %4945 %uint_0 + %4947 = OpIAdd %uint %4922 %uint_4294967042 + %4948 = OpIAdd %uint %4947 %4925 + %4949 = OpSelect %uint %4946 %uint_0 %4948 + %4950 = OpBitwiseOr %uint %4949 %4945 + %4951 = OpINotEqual %bool %4950 %uint_0 + OpSelectionMerge %5346 None + OpBranchConditional %4951 %4954 %5346 + %4954 = OpLabel + %4955 = OpISub %uint %4949 %4929 + %4956 = OpShiftLeftLogical %uint %4926 %uint_5 + %4957 = OpBitwiseAnd %uint %4956 %uint_268435424 + %4958 = OpBitwiseOr %uint %4957 %uint_268435456 + %4959 = OpCompositeInsert %v2uint %4958 %355 1 + %4960 = OpExtInst %uint %184 SAbs %4955 + %4961 = OpINotEqual %bool %4960 %uint_0 + OpSelectionMerge %4988 None + OpBranchConditional %4961 %4964 %4988 + %4964 = OpLabel + %4965 = OpUGreaterThanEqual %bool %4960 %uint_32 + OpSelectionMerge %4973 None + OpBranchConditional %4965 %4968 %4973 + %4968 = OpLabel + %4969 = OpBitwiseAnd %uint %4960 %uint_31 + %4970 = OpShiftLeftLogical %uint %uint_1 %4969 + %4971 = OpCompositeInsert %v2uint %4970 %355 1 + OpBranch %4973 + %4973 = OpLabel + %4974 = OpPhi %v2uint %4971 %4968 %528 %4964 + %4975 = OpPhi %bool %false %4968 %true %4964 + OpSelectionMerge %4985 None + OpBranchConditional %4975 %4978 %4985 + %4978 = OpLabel + %4979 = OpISub %uint %uint_0 %4960 + %4980 = OpBitwiseAnd %uint %4979 %uint_31 + %4981 = OpShiftRightLogical %uint %uint_1 %4980 + %4982 = OpShiftLeftLogical %uint %uint_1 %4960 + %4983 = OpCompositeConstruct %v2uint %4982 %4981 + OpBranch %4985 + %4985 = OpLabel + %4986 = OpPhi %v2uint %4983 %4978 %4974 %4973 + OpBranch %4988 + %4988 = OpLabel + %4989 = OpPhi %v2uint %7106 %4954 %4986 %4985 + %4990 = OpCompositeExtract %uint %4989 0 + %4991 = OpShiftRightLogical %uint %4990 %uint_1 + %4992 = OpIAdd %uint %4991 %uint_2147483647 + %4993 = OpBitwiseAnd %uint %4990 %uint_1 + %4994 = OpIAdd %uint %4992 %4993 + %4995 = OpShiftRightLogical %uint %4994 %uint_31 + %4996 = OpIAdd %uint %4990 %uint_4294967295 + %4997 = OpCompositeExtract %uint %4989 1 + %4998 = OpIAdd %uint %4997 %uint_4294967295 + %4999 = OpIAdd %uint %4998 %4995 + %5000 = OpCompositeConstruct %v2uint %4996 %4999 + %5001 = OpSLessThanEqual %bool %4955 %uint_0 + OpSelectionMerge %5053 None + OpBranchConditional %5001 %5004 %5053 + %5004 = OpLabel + %5005 = OpSGreaterThanEqual %bool %4955 %uint_4294967233 + OpSelectionMerge %5048 None + OpBranchConditional %5005 %5008 %5048 + %5008 = OpLabel + %5009 = OpISub %uint %uint_0 %4955 + %5010 = OpBitwiseAnd %v2uint %5000 %4944 + %5011 = OpINotEqual %bool %4949 %4929 + OpSelectionMerge %5043 None + OpBranchConditional %5011 %5014 %5043 + %5014 = OpLabel + %5015 = OpUGreaterThanEqual %bool %5009 %uint_32 + OpSelectionMerge %5023 None + OpBranchConditional %5015 %5018 %5023 + %5018 = OpLabel + %5019 = OpBitwiseAnd %uint %5009 %uint_31 + %5020 = OpShiftRightLogical %uint %4942 %5019 + %5021 = OpCompositeInsert %v2uint %5020 %420 0 + OpBranch %5023 + %5023 = OpLabel + %5024 = OpPhi %v2uint %4959 %5018 %528 %5014 + %5025 = OpPhi %v2uint %5010 %5018 %528 %5014 + %5026 = OpPhi %v2uint %5021 %5018 %528 %5014 + %5027 = OpPhi %bool %false %5018 %true %5014 + OpSelectionMerge %5038 None + OpBranchConditional %5027 %5030 %5038 + %5030 = OpLabel + %5031 = OpShiftRightLogical %uint %4943 %5009 + %5032 = OpBitwiseAnd %uint %4955 %uint_31 + %5033 = OpShiftLeftLogical %uint %4942 %5032 + %5034 = OpBitwiseOr %uint %5033 %5031 + %5035 = OpShiftRightLogical %uint %4942 %5009 + %5036 = OpCompositeConstruct %v2uint %5034 %5035 + OpBranch %5038 + %5038 = OpLabel + %5039 = OpPhi %v2uint %4959 %5030 %5024 %5023 + %5040 = OpPhi %v2uint %5010 %5030 %5025 %5023 + %5041 = OpPhi %v2uint %5036 %5030 %5026 %5023 + OpBranch %5043 + %5043 = OpLabel + %5044 = OpPhi %v2uint %5039 %5038 %4959 %5008 + %5045 = OpPhi %v2uint %5040 %5038 %5010 %5008 + %5046 = OpPhi %v2uint %5041 %5038 %4944 %5008 + OpBranch %5048 + %5048 = OpLabel + %5049 = OpPhi %v2uint %5044 %5043 %4959 %5004 + %5050 = OpPhi %v2uint %5045 %5043 %4944 %5004 + %5051 = OpPhi %v2uint %5046 %5043 %270 %5004 + OpBranch %5053 + %5053 = OpLabel + %5054 = OpPhi %v2uint %5049 %5048 %528 %4988 + %5055 = OpPhi %v2uint %5050 %5048 %528 %4988 + %5056 = OpPhi %v2uint %5051 %5048 %528 %4988 + %5057 = OpPhi %bool %false %5048 %true %4988 + OpSelectionMerge %5099 None + OpBranchConditional %5057 %5060 %5099 + %5060 = OpLabel + %5061 = OpULessThanEqual %bool %4955 %uint_63 + OpSelectionMerge %5094 None + OpBranchConditional %5061 %5064 %5094 + %5064 = OpLabel + %5065 = OpBitwiseAnd %uint %4999 %4958 + %5066 = OpCompositeInsert %v2uint %5065 %355 1 + %5067 = OpUGreaterThanEqual %bool %4955 %uint_32 + OpSelectionMerge %5075 None + OpBranchConditional %5067 %5070 %5075 + %5070 = OpLabel + %5071 = OpBitwiseAnd %uint %4955 %uint_31 + %5072 = OpShiftRightLogical %uint %4958 %5071 + %5073 = OpCompositeInsert %v2uint %5072 %420 0 + OpBranch %5075 + %5075 = OpLabel + %5076 = OpPhi %v2uint %5073 %5070 %528 %5064 + %5077 = OpPhi %v2uint %5066 %5070 %528 %5064 + %5078 = OpPhi %v2uint %4944 %5070 %528 %5064 + %5079 = OpPhi %bool %false %5070 %true %5064 + OpSelectionMerge %5089 None + OpBranchConditional %5079 %5082 %5089 + %5082 = OpLabel + %5083 = OpISub %uint %uint_0 %4955 + %5084 = OpBitwiseAnd %uint %5083 %uint_31 + %5085 = OpShiftLeftLogical %uint %4958 %5084 + %5086 = OpShiftRightLogical %uint %4958 %4955 + %5087 = OpCompositeConstruct %v2uint %5085 %5086 + OpBranch %5089 + %5089 = OpLabel + %5090 = OpPhi %v2uint %5087 %5082 %5076 %5075 + %5091 = OpPhi %v2uint %5066 %5082 %5077 %5075 + %5092 = OpPhi %v2uint %4944 %5082 %5078 %5075 + OpBranch %5094 + %5094 = OpLabel + %5095 = OpPhi %v2uint %5090 %5089 %270 %5060 + %5096 = OpPhi %v2uint %5091 %5089 %4959 %5060 + %5097 = OpPhi %v2uint %5092 %5089 %4944 %5060 + OpBranch %5099 + %5099 = OpLabel + %5100 = OpPhi %v2uint %5056 %5053 %5097 %5094 + %5101 = OpPhi %v2uint %5055 %5053 %5096 %5094 + %5102 = OpPhi %v2uint %5054 %5053 %5095 %5094 + %5103 = OpExtInst %uint %184 SMax %4949 %4929 + %5104 = OpINotEqual %bool %4932 %4934 + OpSelectionMerge %5151 None + OpBranchConditional %5104 %5107 %5151 + %5107 = OpLabel + %5108 = OpCompositeExtract %uint %5102 0 + %5109 = OpBitwiseXor %uint %5108 %uint_4294967295 + %5110 = OpCompositeExtract %uint %5102 1 + %5111 = OpBitwiseXor %uint %5110 %uint_4294967295 + %5112 = OpShiftRightLogical %uint %5109 %uint_1 + %5113 = OpBitwiseAnd %uint %5109 %uint_1 + %5114 = OpIAdd %uint %5112 %5113 + %5115 = OpShiftRightLogical %uint %5114 %uint_31 + %5116 = OpISub %uint %uint_0 %5108 + %5117 = OpCompositeExtract %uint %5100 0 + %5118 = OpShiftRightLogical %uint %5117 %uint_1 + %5119 = OpShiftRightLogical %uint %5116 %uint_1 + %5120 = OpIAdd %uint %5119 %5118 + %5121 = OpBitwiseAnd %uint %5117 %uint_1 + %5122 = OpBitwiseAnd %uint %5121 %5116 + %5123 = OpIAdd %uint %5120 %5122 + %5124 = OpShiftRightLogical %uint %5123 %uint_31 + %5125 = OpISub %uint %5117 %5108 + %5126 = OpCompositeExtract %uint %5100 1 + %5127 = OpVectorShuffle %v2uint %5101 %528 1 4294967295 + %5128 = OpBitwiseOr %v2uint %5127 %5101 + %5129 = OpCompositeExtract %uint %5128 0 + %5130 = OpINotEqual %bool %5129 %uint_0 + %5131 = OpSGreaterThan %bool %4949 %4929 + %5132 = OpSelect %bool %5130 %5131 %false + %5133 = OpSelect %v2uint %5132 %536 %270 + %5134 = OpCompositeExtract %uint %5133 0 + %5135 = OpShiftRightLogical %uint %5125 %uint_1 + %5136 = OpShiftRightLogical %uint %5134 %uint_1 + %5137 = OpIAdd %uint %5136 %5135 + %5138 = OpBitwiseAnd %uint %5125 %uint_1 + %5139 = OpBitwiseAnd %uint %5138 %5134 + %5140 = OpIAdd %uint %5137 %5139 + %5141 = OpShiftRightLogical %uint %5140 %uint_31 + %5142 = OpIAdd %uint %5134 %5125 + %5143 = OpCompositeExtract %uint %5133 1 + %5144 = OpIAdd %uint %5126 %5111 + %5145 = OpIAdd %uint %5144 %5115 + %5146 = OpIAdd %uint %5145 %5124 + %5147 = OpIAdd %uint %5146 %5143 + %5148 = OpIAdd %uint %5147 %5141 + %5149 = OpCompositeConstruct %v2uint %5142 %5148 + OpBranch %5151 + %5151 = OpLabel + %5152 = OpPhi %v2uint %5149 %5107 %528 %5099 + %5153 = OpPhi %bool %false %5107 %true %5099 + OpSelectionMerge %5172 None + OpBranchConditional %5153 %5156 %5172 + %5156 = OpLabel + %5157 = OpCompositeExtract %uint %5100 0 + %5158 = OpCompositeExtract %uint %5102 0 + %5159 = OpShiftRightLogical %uint %5157 %uint_1 + %5160 = OpShiftRightLogical %uint %5158 %uint_1 + %5161 = OpIAdd %uint %5160 %5159 + %5162 = OpBitwiseAnd %uint %5157 %uint_1 + %5163 = OpBitwiseAnd %uint %5162 %5158 + %5164 = OpIAdd %uint %5161 %5163 + %5165 = OpShiftRightLogical %uint %5164 %uint_31 + %5166 = OpIAdd %uint %5158 %5157 + %5167 = OpIAdd %v2uint %5102 %5100 + %5168 = OpCompositeExtract %uint %5167 1 + %5169 = OpIAdd %uint %5165 %5168 + %5170 = OpCompositeConstruct %v2uint %5166 %5169 + OpBranch %5172 + %5172 = OpLabel + %5173 = OpPhi %v2uint %5170 %5156 %5152 %5151 + %5174 = OpCompositeExtract %uint %5173 1 + %5175 = OpSLessThan %bool %5174 %uint_0 + OpSelectionMerge %5191 None + OpBranchConditional %5175 %5178 %5191 + %5178 = OpLabel + %5179 = OpCompositeExtract %uint %5173 0 + %5180 = OpBitwiseXor %uint %5179 %uint_4294967295 + %5181 = OpBitwiseXor %uint %5174 %uint_4294967295 + %5182 = OpShiftRightLogical %uint %5180 %uint_1 + %5183 = OpBitwiseAnd %uint %5180 %uint_1 + %5184 = OpIAdd %uint %5182 %5183 + %5185 = OpShiftRightLogical %uint %5184 %uint_31 + %5186 = OpISub %uint %uint_0 %5179 + %5187 = OpIAdd %uint %5185 %5181 + %5188 = OpCompositeConstruct %v2uint %5186 %5187 + %5189 = OpBitwiseXor %uint %4934 %uint_2147483648 + OpBranch %5191 + %5191 = OpLabel + %5192 = OpPhi %uint %5189 %5178 %4934 %5172 + %5193 = OpPhi %v2uint %5188 %5178 %5173 %5172 + %5194 = OpCompositeExtract %uint %5193 1 + %5195 = OpExtInst %uint %184 FindUMsb %5194 + %5196 = OpISub %uint %uint_31 %5195 + %5197 = OpIEqual %bool %5194 %uint_0 + %5198 = OpCompositeExtract %uint %5193 0 + %5199 = OpExtInst %uint %184 FindUMsb %5198 + %5200 = OpISub %uint %uint_31 %5199 + %5201 = OpIAdd %uint %5200 %uint_32 + %5202 = OpSelect %uint %5197 %5201 %5196 + %5203 = OpISub %uint %uint_3 %5202 + %5204 = OpIAdd %uint %5203 %5103 + %5205 = OpUGreaterThan %bool %5202 %uint_3 + OpSelectionMerge %5236 None + OpBranchConditional %5205 %5208 %5236 + %5208 = OpLabel + %5209 = OpIAdd %uint %5202 %uint_4294967293 + %5210 = OpUGreaterThanEqual %bool %5209 %uint_32 + OpSelectionMerge %5218 None + OpBranchConditional %5210 %5213 %5218 + %5213 = OpLabel + %5214 = OpBitwiseAnd %uint %5209 %uint_31 + %5215 = OpShiftLeftLogical %uint %5198 %5214 + %5216 = OpCompositeInsert %v2uint %5215 %355 1 + OpBranch %5218 + %5218 = OpLabel + %5219 = OpPhi %uint %uint_0 %5213 %354 %5208 + %5220 = OpPhi %v2uint %5216 %5213 %528 %5208 + %5221 = OpPhi %bool %false %5213 %true %5208 + OpSelectionMerge %5232 None + OpBranchConditional %5221 %5224 %5232 + %5224 = OpLabel + %5225 = OpShiftLeftLogical %uint %5194 %5209 + %5226 = OpBitwiseAnd %uint %5203 %uint_31 + %5227 = OpShiftRightLogical %uint %5198 %5226 + %5228 = OpBitwiseOr %uint %5227 %5225 + %5229 = OpShiftLeftLogical %uint %5198 %5209 + %5230 = OpCompositeConstruct %v2uint %5229 %5228 + OpBranch %5232 + %5232 = OpLabel + %5233 = OpPhi %uint %uint_0 %5224 %5219 %5218 + %5234 = OpPhi %v2uint %5230 %5224 %5220 %5218 + OpBranch %5236 + %5236 = OpLabel + %5237 = OpPhi %v2uint %5193 %5191 %5234 %5232 + %5238 = OpPhi %uint %5203 %5191 %5233 %5232 + %5239 = OpIAdd %uint %5238 %uint_5 + %5240 = OpBitwiseAnd %uint %5239 %uint_31 + %5241 = OpShiftLeftLogical %uint %uint_1 %5240 + %5242 = OpCompositeInsert %v2uint %5241 %355 1 + %5243 = OpIAdd %uint %5241 %uint_4294967295 + %5244 = OpCompositeInsert %v2uint %5243 %650 1 + %5245 = OpBitwiseAnd %v2uint %5244 %5237 + %5246 = OpCompositeExtract %uint %5245 1 + %5247 = OpBitwiseAnd %v2uint %5242 %5237 + %5248 = OpIAdd %uint %5238 %uint_2 + %5249 = OpBitwiseAnd %uint %5248 %uint_31 + %5250 = OpShiftLeftLogical %uint %uint_4 %5249 + %5251 = OpUGreaterThan %bool %5246 %5250 + %5252 = OpLogicalNot %bool %5251 + OpSelectionMerge %5283 None + OpBranchConditional %5252 %5255 %5283 + %5255 = OpLabel + %5256 = OpCompositeExtract %uint %5245 0 + %5257 = OpVectorShuffle %v2uint %5101 %528 1 4294967295 + %5258 = OpBitwiseOr %v2uint %5257 %5101 + %5259 = OpCompositeExtract %uint %5258 0 + %5260 = OpINotEqual %bool %5259 %uint_0 + %5261 = OpSelect %uint %5260 %uint_1 %uint_0 + %5262 = OpBitwiseOr %uint %5256 %5261 + %5263 = OpIEqual %bool %5246 %5250 + %5264 = OpINotEqual %bool %5262 %uint_0 + %5265 = OpSelect %bool %5263 %5264 %false + %5266 = OpLogicalNot %bool %5265 + OpSelectionMerge %5279 None + OpBranchConditional %5266 %5269 %5279 + %5269 = OpLabel + %5270 = OpINotEqual %bool %5246 %5250 + %5271 = OpLogicalOr %bool %5270 %5264 + %5272 = OpVectorShuffle %v2uint %5247 %528 1 4294967295 + %5273 = OpBitwiseOr %v2uint %5272 %5247 + %5274 = OpCompositeExtract %uint %5273 0 + %5275 = OpIEqual %bool %5274 %uint_0 + %5276 = OpSelect %bool %5271 %true %5275 + %5277 = OpLogicalNot %bool %5276 + OpBranch %5279 + %5279 = OpLabel + %5280 = OpPhi %v2uint %5237 %5269 %528 %5255 + %5281 = OpPhi %bool %5277 %5269 %5265 %5255 + OpBranch %5283 + %5283 = OpLabel + %5284 = OpPhi %v2uint %5280 %5279 %528 %5236 + %5285 = OpPhi %bool %5281 %5279 %5251 %5236 + OpSelectionMerge %5293 None + OpBranchConditional %5285 %5288 %5293 + %5288 = OpLabel + %5289 = OpCompositeExtract %uint %5237 1 + %5290 = OpIAdd %uint %5241 %5289 + %5291 = OpCompositeInsert %v2uint %5290 %5237 1 + OpBranch %5293 + %5293 = OpLabel + %5294 = OpPhi %v2uint %5291 %5288 %5284 %5283 + %5295 = OpCompositeExtract %uint %5294 1 + %5296 = OpShiftRightLogical %uint %5295 %5240 + %5297 = OpUGreaterThan %bool %5296 %uint_16777215 + %5298 = OpSelect %uint %5297 %uint_1 %uint_0 + %5299 = OpShiftRightLogical %uint %5296 %5298 + %5300 = OpIAdd %uint %5204 %5298 + %5301 = OpINotEqual %bool %5299 %uint_0 + OpSelectionMerge %5343 None + OpBranchConditional %5301 %5304 %5343 + %5304 = OpLabel + %5305 = OpSLessThanEqual %bool %5300 %uint_127 + OpSelectionMerge %5331 None + OpBranchConditional %5305 %5308 %5331 + %5308 = OpLabel + %5309 = OpSGreaterThanEqual %bool %5300 %uint_4294967170 + OpSelectionMerge %5320 None + OpBranchConditional %5309 %5312 %5320 + %5312 = OpLabel + %5313 = OpShiftLeftLogical %uint %5300 %uint_23 + %5314 = OpIAdd %uint %5313 %uint_1065353216 + %5315 = OpBitwiseAnd %uint %5299 %uint_8388607 + %5316 = OpBitwiseOr %uint %5314 %5315 + %5317 = OpBitwiseOr %uint %5316 %5192 + %5318 = OpBitcast %float %5317 + OpBranch %5320 + %5320 = OpLabel + %5321 = OpPhi %float %5318 %5312 %261 %5308 + %5322 = OpPhi %bool %false %5312 %true %5308 + OpSelectionMerge %5328 None + OpBranchConditional %5322 %5325 %5328 + %5325 = OpLabel + %5326 = OpBitcast %float %5192 + OpBranch %5328 + %5328 = OpLabel + %5329 = OpPhi %float %5326 %5325 %5321 %5320 + OpBranch %5331 + %5331 = OpLabel + %5332 = OpPhi %float %5329 %5328 %261 %5304 + %5333 = OpPhi %bool %false %5328 %true %5304 + OpSelectionMerge %5340 None + OpBranchConditional %5333 %5336 %5340 + %5336 = OpLabel + %5337 = OpBitwiseOr %uint %5192 %uint_2139095040 + %5338 = OpBitcast %float %5337 + OpBranch %5340 + %5340 = OpLabel + %5341 = OpPhi %float %5338 %5336 %5332 %5331 + OpBranch %5343 + %5343 = OpLabel + %5344 = OpPhi %float %5341 %5340 %float_0 %5293 + OpBranch %5346 + %5346 = OpLabel + %5347 = OpPhi %float %5344 %5343 %4906 %4918 + OpBranch %5349 + %5349 = OpLabel + %5350 = OpPhi %float %5347 %5346 %261 %4914 + %5351 = OpPhi %bool %false %5346 %true %4914 + OpSelectionMerge %5359 None + OpBranchConditional %5351 %5354 %5359 + %5354 = OpLabel + %5355 = OpVectorShuffle %v2float %4897 %768 1 4294967295 + %5356 = OpFMul %v2float %4897 %5355 + %5357 = OpCompositeExtract %float %5356 0 + OpBranch %5359 + %5359 = OpLabel + %5360 = OpPhi %float %5357 %5354 %5350 %5349 + OpBranch %5362 + %5362 = OpLabel + %5363 = OpPhi %float %5360 %5359 %4906 %4887 + OpBranch %5365 + %5365 = OpLabel + %5366 = OpPhi %float %5363 %5362 %4857 %4882 + OpBranch %5368 + %5368 = OpLabel + %5369 = OpPhi %float %5366 %5365 %261 %4877 + %5370 = OpPhi %bool %false %5365 %true %4877 + OpBranch %5372 + %5372 = OpLabel + %5373 = OpPhi %float %5369 %5368 %261 %4872 + %5374 = OpPhi %bool %5370 %5368 %4873 %4872 + OpBranch %5376 + %5376 = OpLabel + %5377 = OpPhi %float %5373 %5372 %261 %4867 + %5378 = OpPhi %bool %5374 %5372 %4868 %4867 + OpBranch %5380 + %5380 = OpLabel + %5381 = OpPhi %float %5377 %5376 %261 %4862 + %5382 = OpPhi %bool %5378 %5376 %4863 %4862 + OpBranch %5384 + %5384 = OpLabel + %5385 = OpPhi %float %5381 %5380 %261 %4856 + %5386 = OpPhi %bool %5382 %5380 %4858 %4856 + OpSelectionMerge %5393 None + OpBranchConditional %5386 %5389 %5393 + %5389 = OpLabel + %5390 = OpFMul %float %3777 %float_1_57079625 + %5391 = OpFAdd %float %5390 %4857 + OpBranch %5393 + %5393 = OpLabel + %5394 = OpPhi %float %5391 %5389 %5385 %5384 + %5395 = OpFAdd %float %3778 %5394 + %5396 = OpFSub %float %5395 %3778 + %5397 = OpFSub %float %5394 %5396 + %5398 = OpShiftRightLogical %uint %3721 %uint_30 + %5399 = OpIAdd %uint %3734 %5398 + OpBranch %5401 + %5401 = OpLabel + %5402 = OpPhi %uint %5399 %5393 %354 %3542 + %5403 = OpPhi %float %5395 %5393 %261 %3542 + %5404 = OpPhi %float %5397 %5393 %261 %3542 + %5405 = OpPhi %bool %false %5393 %true %3542 + OpSelectionMerge %7039 None + OpBranchConditional %5405 %5408 %7039 + %5408 = OpLabel + %5409 = OpFMul %float %42 %float_0_636619747 + %5410 = OpFAdd %float %5409 %float_0_5 + %5411 = OpExtInst %float %184 Trunc %5410 + %5412 = OpFMul %float %5411 %float_1_57079625 + %5413 = OpFNegate %float %5412 + %5414 = OpIsNan %bool %5411 + %5415 = OpLogicalNot %bool %5414 + OpSelectionMerge %5940 None + OpBranchConditional %5415 %5418 %5940 + %5418 = OpLabel + %5419 = OpIsNan %bool %float_1_57079625 + %5420 = OpLogicalNot %bool %5419 + OpSelectionMerge %5936 None + OpBranchConditional %5420 %5423 %5936 + %5423 = OpLabel + %5424 = OpIsNan %bool %5413 + %5425 = OpLogicalNot %bool %5424 + OpSelectionMerge %5932 None + OpBranchConditional %5425 %5428 %5932 + %5428 = OpLabel + %5429 = OpIsInf %bool %5411 + %5430 = OpLogicalNot %bool %5429 + OpSelectionMerge %5928 None + OpBranchConditional %5430 %5433 %5928 + %5433 = OpLabel + %5434 = OpIsInf %bool %float_1_57079625 + %5435 = OpLogicalNot %bool %5434 + OpSelectionMerge %5924 None + OpBranchConditional %5435 %5438 %5924 + %5438 = OpLabel + %5439 = OpIsInf %bool %5413 + %5440 = OpLogicalNot %bool %5439 + OpSelectionMerge %5921 None + OpBranchConditional %5440 %5443 %5921 + %5443 = OpLabel + %5444 = OpCompositeInsert %v2float %5411 %262 1 + %5445 = OpBitcast %v2uint %5444 + %5446 = OpBitwiseAnd %v2uint %5445 %267 + %5447 = OpINotEqual %v2bool %5446 %270 + %5448 = OpBitwiseAnd %v2uint %5445 %272 + %5449 = OpIEqual %v2bool %5448 %270 + %5450 = OpLogicalOr %v2bool %5449 %5447 + %5451 = OpBitwiseAnd %v2uint %5445 %277 + %5452 = OpBitcast %v2float %5451 + %5453 = OpSelect %v2float %5450 %5444 %5452 + %5454 = OpBitcast %uint %5413 + %5455 = OpBitwiseAnd %uint %5454 %uint_2139095040 + %5456 = OpINotEqual %bool %5455 %uint_0 + %5457 = OpBitwiseAnd %uint %5454 %uint_8388607 + %5458 = OpIEqual %bool %5457 %uint_0 + %5459 = OpLogicalOr %bool %5458 %5456 + %5460 = OpBitwiseAnd %uint %5454 %uint_2147483648 + %5461 = OpBitcast %float %5460 + %5462 = OpSelect %float %5459 %5413 %5461 + %5463 = OpFOrdEqual %v2bool %5453 %290 + %5464 = OpVectorShuffle %v2bool %5463 %292 1 4294967295 + %5465 = OpLogicalOr %v2bool %5464 %5463 + %5466 = OpCompositeExtract %bool %5465 0 + %5467 = OpLogicalNot %bool %5466 + OpSelectionMerge %5918 None + OpBranchConditional %5467 %5470 %5918 + %5470 = OpLabel + %5471 = OpFUnordNotEqual %bool %5462 %float_0 + OpSelectionMerge %5905 None + OpBranchConditional %5471 %5474 %5905 + %5474 = OpLabel + %5475 = OpBitcast %v2uint %5453 + %5476 = OpCompositeExtract %uint %5475 1 + %5477 = OpShiftRightLogical %uint %5476 %uint_23 + %5478 = OpBitwiseAnd %uint %5477 %uint_255 + %5479 = OpCompositeExtract %uint %5475 0 + %5480 = OpShiftRightLogical %uint %5479 %uint_23 + %5481 = OpBitwiseAnd %uint %5480 %uint_255 + %5482 = OpBitcast %uint %5462 + %5483 = OpShiftRightLogical %uint %5482 %uint_23 + %5484 = OpBitwiseAnd %uint %5483 %uint_255 + %5485 = OpIAdd %uint %5484 %uint_4294967169 + %5486 = OpBitwiseAnd %v2uint %5475 %272 + %5487 = OpBitwiseOr %v2uint %5486 %319 + %5488 = OpBitwiseAnd %uint %5482 %uint_2147483648 + %5489 = OpBitwiseXor %uint %5479 %5476 + %5490 = OpBitwiseAnd %uint %5489 %uint_2147483648 + %5491 = OpCompositeExtract %uint %5487 0 + %5492 = OpCompositeExtract %uint %5487 1 + %5493 = OpUMulExtended %_struct_58 %5492 %5491 + %5494 = OpCompositeExtract %uint %5493 1 + %5495 = OpIMul %uint %5491 %5492 + %5496 = OpShiftLeftLogical %uint %5494 %uint_14 + %5497 = OpShiftRightLogical %uint %5495 %uint_18 + %5498 = OpBitwiseOr %uint %5497 %5496 + %5499 = OpShiftLeftLogical %uint %5495 %uint_14 + %5500 = OpCompositeConstruct %v2uint %5499 %5498 + %5501 = OpBitwiseOr %uint %5498 %5499 + %5502 = OpIEqual %bool %5501 %uint_0 + %5503 = OpIAdd %uint %5478 %uint_4294967042 + %5504 = OpIAdd %uint %5503 %5481 + %5505 = OpSelect %uint %5502 %uint_0 %5504 + %5506 = OpBitwiseOr %uint %5505 %5501 + %5507 = OpINotEqual %bool %5506 %uint_0 + OpSelectionMerge %5902 None + OpBranchConditional %5507 %5510 %5902 + %5510 = OpLabel + %5511 = OpISub %uint %5505 %5485 + %5512 = OpShiftLeftLogical %uint %5482 %uint_5 + %5513 = OpBitwiseAnd %uint %5512 %uint_268435424 + %5514 = OpBitwiseOr %uint %5513 %uint_268435456 + %5515 = OpCompositeInsert %v2uint %5514 %355 1 + %5516 = OpExtInst %uint %184 SAbs %5511 + %5517 = OpINotEqual %bool %5516 %uint_0 + OpSelectionMerge %5544 None + OpBranchConditional %5517 %5520 %5544 + %5520 = OpLabel + %5521 = OpUGreaterThanEqual %bool %5516 %uint_32 + OpSelectionMerge %5529 None + OpBranchConditional %5521 %5524 %5529 + %5524 = OpLabel + %5525 = OpBitwiseAnd %uint %5516 %uint_31 + %5526 = OpShiftLeftLogical %uint %uint_1 %5525 + %5527 = OpCompositeInsert %v2uint %5526 %355 1 + OpBranch %5529 + %5529 = OpLabel + %5530 = OpPhi %v2uint %5527 %5524 %528 %5520 + %5531 = OpPhi %bool %false %5524 %true %5520 + OpSelectionMerge %5541 None + OpBranchConditional %5531 %5534 %5541 + %5534 = OpLabel + %5535 = OpISub %uint %uint_0 %5516 + %5536 = OpBitwiseAnd %uint %5535 %uint_31 + %5537 = OpShiftRightLogical %uint %uint_1 %5536 + %5538 = OpShiftLeftLogical %uint %uint_1 %5516 + %5539 = OpCompositeConstruct %v2uint %5538 %5537 + OpBranch %5541 + %5541 = OpLabel + %5542 = OpPhi %v2uint %5539 %5534 %5530 %5529 + OpBranch %5544 + %5544 = OpLabel + %5545 = OpPhi %v2uint %7106 %5510 %5542 %5541 + %5546 = OpCompositeExtract %uint %5545 0 + %5547 = OpShiftRightLogical %uint %5546 %uint_1 + %5548 = OpIAdd %uint %5547 %uint_2147483647 + %5549 = OpBitwiseAnd %uint %5546 %uint_1 + %5550 = OpIAdd %uint %5548 %5549 + %5551 = OpShiftRightLogical %uint %5550 %uint_31 + %5552 = OpIAdd %uint %5546 %uint_4294967295 + %5553 = OpCompositeExtract %uint %5545 1 + %5554 = OpIAdd %uint %5553 %uint_4294967295 + %5555 = OpIAdd %uint %5554 %5551 + %5556 = OpCompositeConstruct %v2uint %5552 %5555 + %5557 = OpSLessThanEqual %bool %5511 %uint_0 + OpSelectionMerge %5609 None + OpBranchConditional %5557 %5560 %5609 + %5560 = OpLabel + %5561 = OpSGreaterThanEqual %bool %5511 %uint_4294967233 + OpSelectionMerge %5604 None + OpBranchConditional %5561 %5564 %5604 + %5564 = OpLabel + %5565 = OpISub %uint %uint_0 %5511 + %5566 = OpBitwiseAnd %v2uint %5556 %5500 + %5567 = OpINotEqual %bool %5505 %5485 + OpSelectionMerge %5599 None + OpBranchConditional %5567 %5570 %5599 + %5570 = OpLabel + %5571 = OpUGreaterThanEqual %bool %5565 %uint_32 + OpSelectionMerge %5579 None + OpBranchConditional %5571 %5574 %5579 + %5574 = OpLabel + %5575 = OpBitwiseAnd %uint %5565 %uint_31 + %5576 = OpShiftRightLogical %uint %5498 %5575 + %5577 = OpCompositeInsert %v2uint %5576 %420 0 + OpBranch %5579 + %5579 = OpLabel + %5580 = OpPhi %v2uint %5515 %5574 %528 %5570 + %5581 = OpPhi %v2uint %5566 %5574 %528 %5570 + %5582 = OpPhi %v2uint %5577 %5574 %528 %5570 + %5583 = OpPhi %bool %false %5574 %true %5570 + OpSelectionMerge %5594 None + OpBranchConditional %5583 %5586 %5594 + %5586 = OpLabel + %5587 = OpShiftRightLogical %uint %5499 %5565 + %5588 = OpBitwiseAnd %uint %5511 %uint_31 + %5589 = OpShiftLeftLogical %uint %5498 %5588 + %5590 = OpBitwiseOr %uint %5589 %5587 + %5591 = OpShiftRightLogical %uint %5498 %5565 + %5592 = OpCompositeConstruct %v2uint %5590 %5591 + OpBranch %5594 + %5594 = OpLabel + %5595 = OpPhi %v2uint %5515 %5586 %5580 %5579 + %5596 = OpPhi %v2uint %5566 %5586 %5581 %5579 + %5597 = OpPhi %v2uint %5592 %5586 %5582 %5579 + OpBranch %5599 + %5599 = OpLabel + %5600 = OpPhi %v2uint %5595 %5594 %5515 %5564 + %5601 = OpPhi %v2uint %5596 %5594 %5566 %5564 + %5602 = OpPhi %v2uint %5597 %5594 %5500 %5564 + OpBranch %5604 + %5604 = OpLabel + %5605 = OpPhi %v2uint %5600 %5599 %5515 %5560 + %5606 = OpPhi %v2uint %5601 %5599 %5500 %5560 + %5607 = OpPhi %v2uint %5602 %5599 %270 %5560 + OpBranch %5609 + %5609 = OpLabel + %5610 = OpPhi %v2uint %5605 %5604 %528 %5544 + %5611 = OpPhi %v2uint %5606 %5604 %528 %5544 + %5612 = OpPhi %v2uint %5607 %5604 %528 %5544 + %5613 = OpPhi %bool %false %5604 %true %5544 + OpSelectionMerge %5655 None + OpBranchConditional %5613 %5616 %5655 + %5616 = OpLabel + %5617 = OpULessThanEqual %bool %5511 %uint_63 + OpSelectionMerge %5650 None + OpBranchConditional %5617 %5620 %5650 + %5620 = OpLabel + %5621 = OpBitwiseAnd %uint %5555 %5514 + %5622 = OpCompositeInsert %v2uint %5621 %355 1 + %5623 = OpUGreaterThanEqual %bool %5511 %uint_32 + OpSelectionMerge %5631 None + OpBranchConditional %5623 %5626 %5631 + %5626 = OpLabel + %5627 = OpBitwiseAnd %uint %5511 %uint_31 + %5628 = OpShiftRightLogical %uint %5514 %5627 + %5629 = OpCompositeInsert %v2uint %5628 %420 0 + OpBranch %5631 + %5631 = OpLabel + %5632 = OpPhi %v2uint %5629 %5626 %528 %5620 + %5633 = OpPhi %v2uint %5622 %5626 %528 %5620 + %5634 = OpPhi %v2uint %5500 %5626 %528 %5620 + %5635 = OpPhi %bool %false %5626 %true %5620 + OpSelectionMerge %5645 None + OpBranchConditional %5635 %5638 %5645 + %5638 = OpLabel + %5639 = OpISub %uint %uint_0 %5511 + %5640 = OpBitwiseAnd %uint %5639 %uint_31 + %5641 = OpShiftLeftLogical %uint %5514 %5640 + %5642 = OpShiftRightLogical %uint %5514 %5511 + %5643 = OpCompositeConstruct %v2uint %5641 %5642 + OpBranch %5645 + %5645 = OpLabel + %5646 = OpPhi %v2uint %5643 %5638 %5632 %5631 + %5647 = OpPhi %v2uint %5622 %5638 %5633 %5631 + %5648 = OpPhi %v2uint %5500 %5638 %5634 %5631 + OpBranch %5650 + %5650 = OpLabel + %5651 = OpPhi %v2uint %5646 %5645 %270 %5616 + %5652 = OpPhi %v2uint %5647 %5645 %5515 %5616 + %5653 = OpPhi %v2uint %5648 %5645 %5500 %5616 + OpBranch %5655 + %5655 = OpLabel + %5656 = OpPhi %v2uint %5612 %5609 %5653 %5650 + %5657 = OpPhi %v2uint %5611 %5609 %5652 %5650 + %5658 = OpPhi %v2uint %5610 %5609 %5651 %5650 + %5659 = OpExtInst %uint %184 SMax %5505 %5485 + %5660 = OpINotEqual %bool %5488 %5490 + OpSelectionMerge %5707 None + OpBranchConditional %5660 %5663 %5707 + %5663 = OpLabel + %5664 = OpCompositeExtract %uint %5658 0 + %5665 = OpBitwiseXor %uint %5664 %uint_4294967295 + %5666 = OpCompositeExtract %uint %5658 1 + %5667 = OpBitwiseXor %uint %5666 %uint_4294967295 + %5668 = OpShiftRightLogical %uint %5665 %uint_1 + %5669 = OpBitwiseAnd %uint %5665 %uint_1 + %5670 = OpIAdd %uint %5668 %5669 + %5671 = OpShiftRightLogical %uint %5670 %uint_31 + %5672 = OpISub %uint %uint_0 %5664 + %5673 = OpCompositeExtract %uint %5656 0 + %5674 = OpShiftRightLogical %uint %5673 %uint_1 + %5675 = OpShiftRightLogical %uint %5672 %uint_1 + %5676 = OpIAdd %uint %5675 %5674 + %5677 = OpBitwiseAnd %uint %5673 %uint_1 + %5678 = OpBitwiseAnd %uint %5677 %5672 + %5679 = OpIAdd %uint %5676 %5678 + %5680 = OpShiftRightLogical %uint %5679 %uint_31 + %5681 = OpISub %uint %5673 %5664 + %5682 = OpCompositeExtract %uint %5656 1 + %5683 = OpVectorShuffle %v2uint %5657 %528 1 4294967295 + %5684 = OpBitwiseOr %v2uint %5683 %5657 + %5685 = OpCompositeExtract %uint %5684 0 + %5686 = OpINotEqual %bool %5685 %uint_0 + %5687 = OpSGreaterThan %bool %5505 %5485 + %5688 = OpSelect %bool %5686 %5687 %false + %5689 = OpSelect %v2uint %5688 %536 %270 + %5690 = OpCompositeExtract %uint %5689 0 + %5691 = OpShiftRightLogical %uint %5681 %uint_1 + %5692 = OpShiftRightLogical %uint %5690 %uint_1 + %5693 = OpIAdd %uint %5692 %5691 + %5694 = OpBitwiseAnd %uint %5681 %uint_1 + %5695 = OpBitwiseAnd %uint %5694 %5690 + %5696 = OpIAdd %uint %5693 %5695 + %5697 = OpShiftRightLogical %uint %5696 %uint_31 + %5698 = OpIAdd %uint %5690 %5681 + %5699 = OpCompositeExtract %uint %5689 1 + %5700 = OpIAdd %uint %5682 %5667 + %5701 = OpIAdd %uint %5700 %5671 + %5702 = OpIAdd %uint %5701 %5680 + %5703 = OpIAdd %uint %5702 %5699 + %5704 = OpIAdd %uint %5703 %5697 + %5705 = OpCompositeConstruct %v2uint %5698 %5704 + OpBranch %5707 + %5707 = OpLabel + %5708 = OpPhi %v2uint %5705 %5663 %528 %5655 + %5709 = OpPhi %bool %false %5663 %true %5655 + OpSelectionMerge %5728 None + OpBranchConditional %5709 %5712 %5728 + %5712 = OpLabel + %5713 = OpCompositeExtract %uint %5656 0 + %5714 = OpCompositeExtract %uint %5658 0 + %5715 = OpShiftRightLogical %uint %5713 %uint_1 + %5716 = OpShiftRightLogical %uint %5714 %uint_1 + %5717 = OpIAdd %uint %5716 %5715 + %5718 = OpBitwiseAnd %uint %5713 %uint_1 + %5719 = OpBitwiseAnd %uint %5718 %5714 + %5720 = OpIAdd %uint %5717 %5719 + %5721 = OpShiftRightLogical %uint %5720 %uint_31 + %5722 = OpIAdd %uint %5714 %5713 + %5723 = OpIAdd %v2uint %5658 %5656 + %5724 = OpCompositeExtract %uint %5723 1 + %5725 = OpIAdd %uint %5721 %5724 + %5726 = OpCompositeConstruct %v2uint %5722 %5725 + OpBranch %5728 + %5728 = OpLabel + %5729 = OpPhi %v2uint %5726 %5712 %5708 %5707 + %5730 = OpCompositeExtract %uint %5729 1 + %5731 = OpSLessThan %bool %5730 %uint_0 + OpSelectionMerge %5747 None + OpBranchConditional %5731 %5734 %5747 + %5734 = OpLabel + %5735 = OpCompositeExtract %uint %5729 0 + %5736 = OpBitwiseXor %uint %5735 %uint_4294967295 + %5737 = OpBitwiseXor %uint %5730 %uint_4294967295 + %5738 = OpShiftRightLogical %uint %5736 %uint_1 + %5739 = OpBitwiseAnd %uint %5736 %uint_1 + %5740 = OpIAdd %uint %5738 %5739 + %5741 = OpShiftRightLogical %uint %5740 %uint_31 + %5742 = OpISub %uint %uint_0 %5735 + %5743 = OpIAdd %uint %5741 %5737 + %5744 = OpCompositeConstruct %v2uint %5742 %5743 + %5745 = OpBitwiseXor %uint %5490 %uint_2147483648 + OpBranch %5747 + %5747 = OpLabel + %5748 = OpPhi %uint %5745 %5734 %5490 %5728 + %5749 = OpPhi %v2uint %5744 %5734 %5729 %5728 + %5750 = OpCompositeExtract %uint %5749 1 + %5751 = OpExtInst %uint %184 FindUMsb %5750 + %5752 = OpISub %uint %uint_31 %5751 + %5753 = OpIEqual %bool %5750 %uint_0 + %5754 = OpCompositeExtract %uint %5749 0 + %5755 = OpExtInst %uint %184 FindUMsb %5754 + %5756 = OpISub %uint %uint_31 %5755 + %5757 = OpIAdd %uint %5756 %uint_32 + %5758 = OpSelect %uint %5753 %5757 %5752 + %5759 = OpISub %uint %uint_3 %5758 + %5760 = OpIAdd %uint %5759 %5659 + %5761 = OpUGreaterThan %bool %5758 %uint_3 + OpSelectionMerge %5792 None + OpBranchConditional %5761 %5764 %5792 + %5764 = OpLabel + %5765 = OpIAdd %uint %5758 %uint_4294967293 + %5766 = OpUGreaterThanEqual %bool %5765 %uint_32 + OpSelectionMerge %5774 None + OpBranchConditional %5766 %5769 %5774 + %5769 = OpLabel + %5770 = OpBitwiseAnd %uint %5765 %uint_31 + %5771 = OpShiftLeftLogical %uint %5754 %5770 + %5772 = OpCompositeInsert %v2uint %5771 %355 1 + OpBranch %5774 + %5774 = OpLabel + %5775 = OpPhi %uint %uint_0 %5769 %354 %5764 + %5776 = OpPhi %v2uint %5772 %5769 %528 %5764 + %5777 = OpPhi %bool %false %5769 %true %5764 + OpSelectionMerge %5788 None + OpBranchConditional %5777 %5780 %5788 + %5780 = OpLabel + %5781 = OpShiftLeftLogical %uint %5750 %5765 + %5782 = OpBitwiseAnd %uint %5759 %uint_31 + %5783 = OpShiftRightLogical %uint %5754 %5782 + %5784 = OpBitwiseOr %uint %5783 %5781 + %5785 = OpShiftLeftLogical %uint %5754 %5765 + %5786 = OpCompositeConstruct %v2uint %5785 %5784 + OpBranch %5788 + %5788 = OpLabel + %5789 = OpPhi %uint %uint_0 %5780 %5775 %5774 + %5790 = OpPhi %v2uint %5786 %5780 %5776 %5774 + OpBranch %5792 + %5792 = OpLabel + %5793 = OpPhi %v2uint %5749 %5747 %5790 %5788 + %5794 = OpPhi %uint %5759 %5747 %5789 %5788 + %5795 = OpIAdd %uint %5794 %uint_5 + %5796 = OpBitwiseAnd %uint %5795 %uint_31 + %5797 = OpShiftLeftLogical %uint %uint_1 %5796 + %5798 = OpCompositeInsert %v2uint %5797 %355 1 + %5799 = OpIAdd %uint %5797 %uint_4294967295 + %5800 = OpCompositeInsert %v2uint %5799 %650 1 + %5801 = OpBitwiseAnd %v2uint %5800 %5793 + %5802 = OpCompositeExtract %uint %5801 1 + %5803 = OpBitwiseAnd %v2uint %5798 %5793 + %5804 = OpIAdd %uint %5794 %uint_2 + %5805 = OpBitwiseAnd %uint %5804 %uint_31 + %5806 = OpShiftLeftLogical %uint %uint_4 %5805 + %5807 = OpUGreaterThan %bool %5802 %5806 + %5808 = OpLogicalNot %bool %5807 + OpSelectionMerge %5839 None + OpBranchConditional %5808 %5811 %5839 + %5811 = OpLabel + %5812 = OpCompositeExtract %uint %5801 0 + %5813 = OpVectorShuffle %v2uint %5657 %528 1 4294967295 + %5814 = OpBitwiseOr %v2uint %5813 %5657 + %5815 = OpCompositeExtract %uint %5814 0 + %5816 = OpINotEqual %bool %5815 %uint_0 + %5817 = OpSelect %uint %5816 %uint_1 %uint_0 + %5818 = OpBitwiseOr %uint %5812 %5817 + %5819 = OpIEqual %bool %5802 %5806 + %5820 = OpINotEqual %bool %5818 %uint_0 + %5821 = OpSelect %bool %5819 %5820 %false + %5822 = OpLogicalNot %bool %5821 + OpSelectionMerge %5835 None + OpBranchConditional %5822 %5825 %5835 + %5825 = OpLabel + %5826 = OpINotEqual %bool %5802 %5806 + %5827 = OpLogicalOr %bool %5826 %5820 + %5828 = OpVectorShuffle %v2uint %5803 %528 1 4294967295 + %5829 = OpBitwiseOr %v2uint %5828 %5803 + %5830 = OpCompositeExtract %uint %5829 0 + %5831 = OpIEqual %bool %5830 %uint_0 + %5832 = OpSelect %bool %5827 %true %5831 + %5833 = OpLogicalNot %bool %5832 + OpBranch %5835 + %5835 = OpLabel + %5836 = OpPhi %v2uint %5793 %5825 %528 %5811 + %5837 = OpPhi %bool %5833 %5825 %5821 %5811 + OpBranch %5839 + %5839 = OpLabel + %5840 = OpPhi %v2uint %5836 %5835 %528 %5792 + %5841 = OpPhi %bool %5837 %5835 %5807 %5792 + OpSelectionMerge %5849 None + OpBranchConditional %5841 %5844 %5849 + %5844 = OpLabel + %5845 = OpCompositeExtract %uint %5793 1 + %5846 = OpIAdd %uint %5797 %5845 + %5847 = OpCompositeInsert %v2uint %5846 %5793 1 + OpBranch %5849 + %5849 = OpLabel + %5850 = OpPhi %v2uint %5847 %5844 %5840 %5839 + %5851 = OpCompositeExtract %uint %5850 1 + %5852 = OpShiftRightLogical %uint %5851 %5796 + %5853 = OpUGreaterThan %bool %5852 %uint_16777215 + %5854 = OpSelect %uint %5853 %uint_1 %uint_0 + %5855 = OpShiftRightLogical %uint %5852 %5854 + %5856 = OpIAdd %uint %5760 %5854 + %5857 = OpINotEqual %bool %5855 %uint_0 + OpSelectionMerge %5899 None + OpBranchConditional %5857 %5860 %5899 + %5860 = OpLabel + %5861 = OpSLessThanEqual %bool %5856 %uint_127 + OpSelectionMerge %5887 None + OpBranchConditional %5861 %5864 %5887 + %5864 = OpLabel + %5865 = OpSGreaterThanEqual %bool %5856 %uint_4294967170 + OpSelectionMerge %5876 None + OpBranchConditional %5865 %5868 %5876 + %5868 = OpLabel + %5869 = OpShiftLeftLogical %uint %5856 %uint_23 + %5870 = OpIAdd %uint %5869 %uint_1065353216 + %5871 = OpBitwiseAnd %uint %5855 %uint_8388607 + %5872 = OpBitwiseOr %uint %5870 %5871 + %5873 = OpBitwiseOr %uint %5872 %5748 + %5874 = OpBitcast %float %5873 + OpBranch %5876 + %5876 = OpLabel + %5877 = OpPhi %float %5874 %5868 %261 %5864 + %5878 = OpPhi %bool %false %5868 %true %5864 + OpSelectionMerge %5884 None + OpBranchConditional %5878 %5881 %5884 + %5881 = OpLabel + %5882 = OpBitcast %float %5748 + OpBranch %5884 + %5884 = OpLabel + %5885 = OpPhi %float %5882 %5881 %5877 %5876 + OpBranch %5887 + %5887 = OpLabel + %5888 = OpPhi %float %5885 %5884 %261 %5860 + %5889 = OpPhi %bool %false %5884 %true %5860 + OpSelectionMerge %5896 None + OpBranchConditional %5889 %5892 %5896 + %5892 = OpLabel + %5893 = OpBitwiseOr %uint %5748 %uint_2139095040 + %5894 = OpBitcast %float %5893 + OpBranch %5896 + %5896 = OpLabel + %5897 = OpPhi %float %5894 %5892 %5888 %5887 + OpBranch %5899 + %5899 = OpLabel + %5900 = OpPhi %float %5897 %5896 %float_0 %5849 + OpBranch %5902 + %5902 = OpLabel + %5903 = OpPhi %float %5900 %5899 %5462 %5474 + OpBranch %5905 + %5905 = OpLabel + %5906 = OpPhi %float %5903 %5902 %261 %5470 + %5907 = OpPhi %bool %false %5902 %true %5470 + OpSelectionMerge %5915 None + OpBranchConditional %5907 %5910 %5915 + %5910 = OpLabel + %5911 = OpVectorShuffle %v2float %5453 %768 1 4294967295 + %5912 = OpFMul %v2float %5453 %5911 + %5913 = OpCompositeExtract %float %5912 0 + OpBranch %5915 + %5915 = OpLabel + %5916 = OpPhi %float %5913 %5910 %5906 %5905 + OpBranch %5918 + %5918 = OpLabel + %5919 = OpPhi %float %5916 %5915 %5462 %5443 + OpBranch %5921 + %5921 = OpLabel + %5922 = OpPhi %float %5919 %5918 %5413 %5438 + OpBranch %5924 + %5924 = OpLabel + %5925 = OpPhi %float %5922 %5921 %261 %5433 + %5926 = OpPhi %bool %false %5921 %true %5433 + OpBranch %5928 + %5928 = OpLabel + %5929 = OpPhi %float %5925 %5924 %261 %5428 + %5930 = OpPhi %bool %5926 %5924 %5429 %5428 + OpBranch %5932 + %5932 = OpLabel + %5933 = OpPhi %float %5929 %5928 %261 %5423 + %5934 = OpPhi %bool %5930 %5928 %5424 %5423 + OpBranch %5936 + %5936 = OpLabel + %5937 = OpPhi %float %5933 %5932 %261 %5418 + %5938 = OpPhi %bool %5934 %5932 %5419 %5418 + OpBranch %5940 + %5940 = OpLabel + %5941 = OpPhi %float %5937 %5936 %261 %5408 + %5942 = OpPhi %bool %5938 %5936 %5414 %5408 + OpSelectionMerge %5948 None + OpBranchConditional %5942 %5945 %5948 + %5945 = OpLabel + %5946 = OpFSub %float %5412 %5412 + OpBranch %5948 + %5948 = OpLabel + %5949 = OpPhi %float %5946 %5945 %5941 %5940 + %5950 = OpFSub %float %42 %5412 + %5951 = OpFSub %float %42 %5950 + %5952 = OpFSub %float %5951 %5412 + %5953 = OpFSub %float %5952 %5949 + %5954 = OpFAdd %float %5950 %5953 + %5955 = OpFMul %float %5411 %float_7_54978942en08 + %5956 = OpFNegate %float %5955 + OpSelectionMerge %6481 None + OpBranchConditional %5415 %5959 %6481 + %5959 = OpLabel + %5960 = OpIsNan %bool %float_7_54978942en08 + %5961 = OpLogicalNot %bool %5960 + OpSelectionMerge %6477 None + OpBranchConditional %5961 %5964 %6477 + %5964 = OpLabel + %5965 = OpIsNan %bool %5956 + %5966 = OpLogicalNot %bool %5965 + OpSelectionMerge %6473 None + OpBranchConditional %5966 %5969 %6473 + %5969 = OpLabel + %5970 = OpIsInf %bool %5411 + %5971 = OpLogicalNot %bool %5970 + OpSelectionMerge %6469 None + OpBranchConditional %5971 %5974 %6469 + %5974 = OpLabel + %5975 = OpIsInf %bool %float_7_54978942en08 + %5976 = OpLogicalNot %bool %5975 + OpSelectionMerge %6465 None + OpBranchConditional %5976 %5979 %6465 + %5979 = OpLabel + %5980 = OpIsInf %bool %5956 + %5981 = OpLogicalNot %bool %5980 + OpSelectionMerge %6462 None + OpBranchConditional %5981 %5984 %6462 + %5984 = OpLabel + %5985 = OpCompositeInsert %v2float %5411 %829 1 + %5986 = OpBitcast %v2uint %5985 + %5987 = OpBitwiseAnd %v2uint %5986 %267 + %5988 = OpINotEqual %v2bool %5987 %270 + %5989 = OpBitwiseAnd %v2uint %5986 %272 + %5990 = OpIEqual %v2bool %5989 %270 + %5991 = OpLogicalOr %v2bool %5990 %5988 + %5992 = OpBitwiseAnd %v2uint %5986 %277 + %5993 = OpBitcast %v2float %5992 + %5994 = OpSelect %v2float %5991 %5985 %5993 + %5995 = OpBitcast %uint %5956 + %5996 = OpBitwiseAnd %uint %5995 %uint_2139095040 + %5997 = OpINotEqual %bool %5996 %uint_0 + %5998 = OpBitwiseAnd %uint %5995 %uint_8388607 + %5999 = OpIEqual %bool %5998 %uint_0 + %6000 = OpLogicalOr %bool %5999 %5997 + %6001 = OpBitwiseAnd %uint %5995 %uint_2147483648 + %6002 = OpBitcast %float %6001 + %6003 = OpSelect %float %6000 %5956 %6002 + %6004 = OpFOrdEqual %v2bool %5994 %290 + %6005 = OpVectorShuffle %v2bool %6004 %292 1 4294967295 + %6006 = OpLogicalOr %v2bool %6005 %6004 + %6007 = OpCompositeExtract %bool %6006 0 + %6008 = OpLogicalNot %bool %6007 + OpSelectionMerge %6459 None + OpBranchConditional %6008 %6011 %6459 + %6011 = OpLabel + %6012 = OpFUnordNotEqual %bool %6003 %float_0 + OpSelectionMerge %6446 None + OpBranchConditional %6012 %6015 %6446 + %6015 = OpLabel + %6016 = OpBitcast %v2uint %5994 + %6017 = OpCompositeExtract %uint %6016 1 + %6018 = OpShiftRightLogical %uint %6017 %uint_23 + %6019 = OpBitwiseAnd %uint %6018 %uint_255 + %6020 = OpCompositeExtract %uint %6016 0 + %6021 = OpShiftRightLogical %uint %6020 %uint_23 + %6022 = OpBitwiseAnd %uint %6021 %uint_255 + %6023 = OpBitcast %uint %6003 + %6024 = OpShiftRightLogical %uint %6023 %uint_23 + %6025 = OpBitwiseAnd %uint %6024 %uint_255 + %6026 = OpIAdd %uint %6025 %uint_4294967169 + %6027 = OpBitwiseAnd %v2uint %6016 %272 + %6028 = OpBitwiseOr %v2uint %6027 %319 + %6029 = OpBitwiseAnd %uint %6023 %uint_2147483648 + %6030 = OpBitwiseXor %uint %6020 %6017 + %6031 = OpBitwiseAnd %uint %6030 %uint_2147483648 + %6032 = OpCompositeExtract %uint %6028 0 + %6033 = OpCompositeExtract %uint %6028 1 + %6034 = OpUMulExtended %_struct_58 %6033 %6032 + %6035 = OpCompositeExtract %uint %6034 1 + %6036 = OpIMul %uint %6032 %6033 + %6037 = OpShiftLeftLogical %uint %6035 %uint_14 + %6038 = OpShiftRightLogical %uint %6036 %uint_18 + %6039 = OpBitwiseOr %uint %6038 %6037 + %6040 = OpShiftLeftLogical %uint %6036 %uint_14 + %6041 = OpCompositeConstruct %v2uint %6040 %6039 + %6042 = OpBitwiseOr %uint %6039 %6040 + %6043 = OpIEqual %bool %6042 %uint_0 + %6044 = OpIAdd %uint %6019 %uint_4294967042 + %6045 = OpIAdd %uint %6044 %6022 + %6046 = OpSelect %uint %6043 %uint_0 %6045 + %6047 = OpBitwiseOr %uint %6046 %6042 + %6048 = OpINotEqual %bool %6047 %uint_0 + OpSelectionMerge %6443 None + OpBranchConditional %6048 %6051 %6443 + %6051 = OpLabel + %6052 = OpISub %uint %6046 %6026 + %6053 = OpShiftLeftLogical %uint %6023 %uint_5 + %6054 = OpBitwiseAnd %uint %6053 %uint_268435424 + %6055 = OpBitwiseOr %uint %6054 %uint_268435456 + %6056 = OpCompositeInsert %v2uint %6055 %355 1 + %6057 = OpExtInst %uint %184 SAbs %6052 + %6058 = OpINotEqual %bool %6057 %uint_0 + OpSelectionMerge %6085 None + OpBranchConditional %6058 %6061 %6085 + %6061 = OpLabel + %6062 = OpUGreaterThanEqual %bool %6057 %uint_32 + OpSelectionMerge %6070 None + OpBranchConditional %6062 %6065 %6070 + %6065 = OpLabel + %6066 = OpBitwiseAnd %uint %6057 %uint_31 + %6067 = OpShiftLeftLogical %uint %uint_1 %6066 + %6068 = OpCompositeInsert %v2uint %6067 %355 1 + OpBranch %6070 + %6070 = OpLabel + %6071 = OpPhi %v2uint %6068 %6065 %528 %6061 + %6072 = OpPhi %bool %false %6065 %true %6061 + OpSelectionMerge %6082 None + OpBranchConditional %6072 %6075 %6082 + %6075 = OpLabel + %6076 = OpISub %uint %uint_0 %6057 + %6077 = OpBitwiseAnd %uint %6076 %uint_31 + %6078 = OpShiftRightLogical %uint %uint_1 %6077 + %6079 = OpShiftLeftLogical %uint %uint_1 %6057 + %6080 = OpCompositeConstruct %v2uint %6079 %6078 + OpBranch %6082 + %6082 = OpLabel + %6083 = OpPhi %v2uint %6080 %6075 %6071 %6070 + OpBranch %6085 + %6085 = OpLabel + %6086 = OpPhi %v2uint %7106 %6051 %6083 %6082 + %6087 = OpCompositeExtract %uint %6086 0 + %6088 = OpShiftRightLogical %uint %6087 %uint_1 + %6089 = OpIAdd %uint %6088 %uint_2147483647 + %6090 = OpBitwiseAnd %uint %6087 %uint_1 + %6091 = OpIAdd %uint %6089 %6090 + %6092 = OpShiftRightLogical %uint %6091 %uint_31 + %6093 = OpIAdd %uint %6087 %uint_4294967295 + %6094 = OpCompositeExtract %uint %6086 1 + %6095 = OpIAdd %uint %6094 %uint_4294967295 + %6096 = OpIAdd %uint %6095 %6092 + %6097 = OpCompositeConstruct %v2uint %6093 %6096 + %6098 = OpSLessThanEqual %bool %6052 %uint_0 + OpSelectionMerge %6150 None + OpBranchConditional %6098 %6101 %6150 + %6101 = OpLabel + %6102 = OpSGreaterThanEqual %bool %6052 %uint_4294967233 + OpSelectionMerge %6145 None + OpBranchConditional %6102 %6105 %6145 + %6105 = OpLabel + %6106 = OpISub %uint %uint_0 %6052 + %6107 = OpBitwiseAnd %v2uint %6097 %6041 + %6108 = OpINotEqual %bool %6046 %6026 + OpSelectionMerge %6140 None + OpBranchConditional %6108 %6111 %6140 + %6111 = OpLabel + %6112 = OpUGreaterThanEqual %bool %6106 %uint_32 + OpSelectionMerge %6120 None + OpBranchConditional %6112 %6115 %6120 + %6115 = OpLabel + %6116 = OpBitwiseAnd %uint %6106 %uint_31 + %6117 = OpShiftRightLogical %uint %6039 %6116 + %6118 = OpCompositeInsert %v2uint %6117 %420 0 + OpBranch %6120 + %6120 = OpLabel + %6121 = OpPhi %v2uint %6056 %6115 %528 %6111 + %6122 = OpPhi %v2uint %6107 %6115 %528 %6111 + %6123 = OpPhi %v2uint %6118 %6115 %528 %6111 + %6124 = OpPhi %bool %false %6115 %true %6111 + OpSelectionMerge %6135 None + OpBranchConditional %6124 %6127 %6135 + %6127 = OpLabel + %6128 = OpShiftRightLogical %uint %6040 %6106 + %6129 = OpBitwiseAnd %uint %6052 %uint_31 + %6130 = OpShiftLeftLogical %uint %6039 %6129 + %6131 = OpBitwiseOr %uint %6130 %6128 + %6132 = OpShiftRightLogical %uint %6039 %6106 + %6133 = OpCompositeConstruct %v2uint %6131 %6132 + OpBranch %6135 + %6135 = OpLabel + %6136 = OpPhi %v2uint %6056 %6127 %6121 %6120 + %6137 = OpPhi %v2uint %6107 %6127 %6122 %6120 + %6138 = OpPhi %v2uint %6133 %6127 %6123 %6120 + OpBranch %6140 + %6140 = OpLabel + %6141 = OpPhi %v2uint %6136 %6135 %6056 %6105 + %6142 = OpPhi %v2uint %6137 %6135 %6107 %6105 + %6143 = OpPhi %v2uint %6138 %6135 %6041 %6105 + OpBranch %6145 + %6145 = OpLabel + %6146 = OpPhi %v2uint %6141 %6140 %6056 %6101 + %6147 = OpPhi %v2uint %6142 %6140 %6041 %6101 + %6148 = OpPhi %v2uint %6143 %6140 %270 %6101 + OpBranch %6150 + %6150 = OpLabel + %6151 = OpPhi %v2uint %6146 %6145 %528 %6085 + %6152 = OpPhi %v2uint %6147 %6145 %528 %6085 + %6153 = OpPhi %v2uint %6148 %6145 %528 %6085 + %6154 = OpPhi %bool %false %6145 %true %6085 + OpSelectionMerge %6196 None + OpBranchConditional %6154 %6157 %6196 + %6157 = OpLabel + %6158 = OpULessThanEqual %bool %6052 %uint_63 + OpSelectionMerge %6191 None + OpBranchConditional %6158 %6161 %6191 + %6161 = OpLabel + %6162 = OpBitwiseAnd %uint %6096 %6055 + %6163 = OpCompositeInsert %v2uint %6162 %355 1 + %6164 = OpUGreaterThanEqual %bool %6052 %uint_32 + OpSelectionMerge %6172 None + OpBranchConditional %6164 %6167 %6172 + %6167 = OpLabel + %6168 = OpBitwiseAnd %uint %6052 %uint_31 + %6169 = OpShiftRightLogical %uint %6055 %6168 + %6170 = OpCompositeInsert %v2uint %6169 %420 0 + OpBranch %6172 + %6172 = OpLabel + %6173 = OpPhi %v2uint %6170 %6167 %528 %6161 + %6174 = OpPhi %v2uint %6163 %6167 %528 %6161 + %6175 = OpPhi %v2uint %6041 %6167 %528 %6161 + %6176 = OpPhi %bool %false %6167 %true %6161 + OpSelectionMerge %6186 None + OpBranchConditional %6176 %6179 %6186 + %6179 = OpLabel + %6180 = OpISub %uint %uint_0 %6052 + %6181 = OpBitwiseAnd %uint %6180 %uint_31 + %6182 = OpShiftLeftLogical %uint %6055 %6181 + %6183 = OpShiftRightLogical %uint %6055 %6052 + %6184 = OpCompositeConstruct %v2uint %6182 %6183 + OpBranch %6186 + %6186 = OpLabel + %6187 = OpPhi %v2uint %6184 %6179 %6173 %6172 + %6188 = OpPhi %v2uint %6163 %6179 %6174 %6172 + %6189 = OpPhi %v2uint %6041 %6179 %6175 %6172 + OpBranch %6191 + %6191 = OpLabel + %6192 = OpPhi %v2uint %6187 %6186 %270 %6157 + %6193 = OpPhi %v2uint %6188 %6186 %6056 %6157 + %6194 = OpPhi %v2uint %6189 %6186 %6041 %6157 + OpBranch %6196 + %6196 = OpLabel + %6197 = OpPhi %v2uint %6153 %6150 %6194 %6191 + %6198 = OpPhi %v2uint %6152 %6150 %6193 %6191 + %6199 = OpPhi %v2uint %6151 %6150 %6192 %6191 + %6200 = OpExtInst %uint %184 SMax %6046 %6026 + %6201 = OpINotEqual %bool %6029 %6031 + OpSelectionMerge %6248 None + OpBranchConditional %6201 %6204 %6248 + %6204 = OpLabel + %6205 = OpCompositeExtract %uint %6199 0 + %6206 = OpBitwiseXor %uint %6205 %uint_4294967295 + %6207 = OpCompositeExtract %uint %6199 1 + %6208 = OpBitwiseXor %uint %6207 %uint_4294967295 + %6209 = OpShiftRightLogical %uint %6206 %uint_1 + %6210 = OpBitwiseAnd %uint %6206 %uint_1 + %6211 = OpIAdd %uint %6209 %6210 + %6212 = OpShiftRightLogical %uint %6211 %uint_31 + %6213 = OpISub %uint %uint_0 %6205 + %6214 = OpCompositeExtract %uint %6197 0 + %6215 = OpShiftRightLogical %uint %6214 %uint_1 + %6216 = OpShiftRightLogical %uint %6213 %uint_1 + %6217 = OpIAdd %uint %6216 %6215 + %6218 = OpBitwiseAnd %uint %6214 %uint_1 + %6219 = OpBitwiseAnd %uint %6218 %6213 + %6220 = OpIAdd %uint %6217 %6219 + %6221 = OpShiftRightLogical %uint %6220 %uint_31 + %6222 = OpISub %uint %6214 %6205 + %6223 = OpCompositeExtract %uint %6197 1 + %6224 = OpVectorShuffle %v2uint %6198 %528 1 4294967295 + %6225 = OpBitwiseOr %v2uint %6224 %6198 + %6226 = OpCompositeExtract %uint %6225 0 + %6227 = OpINotEqual %bool %6226 %uint_0 + %6228 = OpSGreaterThan %bool %6046 %6026 + %6229 = OpSelect %bool %6227 %6228 %false + %6230 = OpSelect %v2uint %6229 %536 %270 + %6231 = OpCompositeExtract %uint %6230 0 + %6232 = OpShiftRightLogical %uint %6222 %uint_1 + %6233 = OpShiftRightLogical %uint %6231 %uint_1 + %6234 = OpIAdd %uint %6233 %6232 + %6235 = OpBitwiseAnd %uint %6222 %uint_1 + %6236 = OpBitwiseAnd %uint %6235 %6231 + %6237 = OpIAdd %uint %6234 %6236 + %6238 = OpShiftRightLogical %uint %6237 %uint_31 + %6239 = OpIAdd %uint %6231 %6222 + %6240 = OpCompositeExtract %uint %6230 1 + %6241 = OpIAdd %uint %6223 %6208 + %6242 = OpIAdd %uint %6241 %6212 + %6243 = OpIAdd %uint %6242 %6221 + %6244 = OpIAdd %uint %6243 %6240 + %6245 = OpIAdd %uint %6244 %6238 + %6246 = OpCompositeConstruct %v2uint %6239 %6245 + OpBranch %6248 + %6248 = OpLabel + %6249 = OpPhi %v2uint %6246 %6204 %528 %6196 + %6250 = OpPhi %bool %false %6204 %true %6196 + OpSelectionMerge %6269 None + OpBranchConditional %6250 %6253 %6269 + %6253 = OpLabel + %6254 = OpCompositeExtract %uint %6197 0 + %6255 = OpCompositeExtract %uint %6199 0 + %6256 = OpShiftRightLogical %uint %6254 %uint_1 + %6257 = OpShiftRightLogical %uint %6255 %uint_1 + %6258 = OpIAdd %uint %6257 %6256 + %6259 = OpBitwiseAnd %uint %6254 %uint_1 + %6260 = OpBitwiseAnd %uint %6259 %6255 + %6261 = OpIAdd %uint %6258 %6260 + %6262 = OpShiftRightLogical %uint %6261 %uint_31 + %6263 = OpIAdd %uint %6255 %6254 + %6264 = OpIAdd %v2uint %6199 %6197 + %6265 = OpCompositeExtract %uint %6264 1 + %6266 = OpIAdd %uint %6262 %6265 + %6267 = OpCompositeConstruct %v2uint %6263 %6266 + OpBranch %6269 + %6269 = OpLabel + %6270 = OpPhi %v2uint %6267 %6253 %6249 %6248 + %6271 = OpCompositeExtract %uint %6270 1 + %6272 = OpSLessThan %bool %6271 %uint_0 + OpSelectionMerge %6288 None + OpBranchConditional %6272 %6275 %6288 + %6275 = OpLabel + %6276 = OpCompositeExtract %uint %6270 0 + %6277 = OpBitwiseXor %uint %6276 %uint_4294967295 + %6278 = OpBitwiseXor %uint %6271 %uint_4294967295 + %6279 = OpShiftRightLogical %uint %6277 %uint_1 + %6280 = OpBitwiseAnd %uint %6277 %uint_1 + %6281 = OpIAdd %uint %6279 %6280 + %6282 = OpShiftRightLogical %uint %6281 %uint_31 + %6283 = OpISub %uint %uint_0 %6276 + %6284 = OpIAdd %uint %6282 %6278 + %6285 = OpCompositeConstruct %v2uint %6283 %6284 + %6286 = OpBitwiseXor %uint %6031 %uint_2147483648 + OpBranch %6288 + %6288 = OpLabel + %6289 = OpPhi %uint %6286 %6275 %6031 %6269 + %6290 = OpPhi %v2uint %6285 %6275 %6270 %6269 + %6291 = OpCompositeExtract %uint %6290 1 + %6292 = OpExtInst %uint %184 FindUMsb %6291 + %6293 = OpISub %uint %uint_31 %6292 + %6294 = OpIEqual %bool %6291 %uint_0 + %6295 = OpCompositeExtract %uint %6290 0 + %6296 = OpExtInst %uint %184 FindUMsb %6295 + %6297 = OpISub %uint %uint_31 %6296 + %6298 = OpIAdd %uint %6297 %uint_32 + %6299 = OpSelect %uint %6294 %6298 %6293 + %6300 = OpISub %uint %uint_3 %6299 + %6301 = OpIAdd %uint %6300 %6200 + %6302 = OpUGreaterThan %bool %6299 %uint_3 + OpSelectionMerge %6333 None + OpBranchConditional %6302 %6305 %6333 + %6305 = OpLabel + %6306 = OpIAdd %uint %6299 %uint_4294967293 + %6307 = OpUGreaterThanEqual %bool %6306 %uint_32 + OpSelectionMerge %6315 None + OpBranchConditional %6307 %6310 %6315 + %6310 = OpLabel + %6311 = OpBitwiseAnd %uint %6306 %uint_31 + %6312 = OpShiftLeftLogical %uint %6295 %6311 + %6313 = OpCompositeInsert %v2uint %6312 %355 1 + OpBranch %6315 + %6315 = OpLabel + %6316 = OpPhi %uint %uint_0 %6310 %354 %6305 + %6317 = OpPhi %v2uint %6313 %6310 %528 %6305 + %6318 = OpPhi %bool %false %6310 %true %6305 + OpSelectionMerge %6329 None + OpBranchConditional %6318 %6321 %6329 + %6321 = OpLabel + %6322 = OpShiftLeftLogical %uint %6291 %6306 + %6323 = OpBitwiseAnd %uint %6300 %uint_31 + %6324 = OpShiftRightLogical %uint %6295 %6323 + %6325 = OpBitwiseOr %uint %6324 %6322 + %6326 = OpShiftLeftLogical %uint %6295 %6306 + %6327 = OpCompositeConstruct %v2uint %6326 %6325 + OpBranch %6329 + %6329 = OpLabel + %6330 = OpPhi %uint %uint_0 %6321 %6316 %6315 + %6331 = OpPhi %v2uint %6327 %6321 %6317 %6315 + OpBranch %6333 + %6333 = OpLabel + %6334 = OpPhi %v2uint %6290 %6288 %6331 %6329 + %6335 = OpPhi %uint %6300 %6288 %6330 %6329 + %6336 = OpIAdd %uint %6335 %uint_5 + %6337 = OpBitwiseAnd %uint %6336 %uint_31 + %6338 = OpShiftLeftLogical %uint %uint_1 %6337 + %6339 = OpCompositeInsert %v2uint %6338 %355 1 + %6340 = OpIAdd %uint %6338 %uint_4294967295 + %6341 = OpCompositeInsert %v2uint %6340 %650 1 + %6342 = OpBitwiseAnd %v2uint %6341 %6334 + %6343 = OpCompositeExtract %uint %6342 1 + %6344 = OpBitwiseAnd %v2uint %6339 %6334 + %6345 = OpIAdd %uint %6335 %uint_2 + %6346 = OpBitwiseAnd %uint %6345 %uint_31 + %6347 = OpShiftLeftLogical %uint %uint_4 %6346 + %6348 = OpUGreaterThan %bool %6343 %6347 + %6349 = OpLogicalNot %bool %6348 + OpSelectionMerge %6380 None + OpBranchConditional %6349 %6352 %6380 + %6352 = OpLabel + %6353 = OpCompositeExtract %uint %6342 0 + %6354 = OpVectorShuffle %v2uint %6198 %528 1 4294967295 + %6355 = OpBitwiseOr %v2uint %6354 %6198 + %6356 = OpCompositeExtract %uint %6355 0 + %6357 = OpINotEqual %bool %6356 %uint_0 + %6358 = OpSelect %uint %6357 %uint_1 %uint_0 + %6359 = OpBitwiseOr %uint %6353 %6358 + %6360 = OpIEqual %bool %6343 %6347 + %6361 = OpINotEqual %bool %6359 %uint_0 + %6362 = OpSelect %bool %6360 %6361 %false + %6363 = OpLogicalNot %bool %6362 + OpSelectionMerge %6376 None + OpBranchConditional %6363 %6366 %6376 + %6366 = OpLabel + %6367 = OpINotEqual %bool %6343 %6347 + %6368 = OpLogicalOr %bool %6367 %6361 + %6369 = OpVectorShuffle %v2uint %6344 %528 1 4294967295 + %6370 = OpBitwiseOr %v2uint %6369 %6344 + %6371 = OpCompositeExtract %uint %6370 0 + %6372 = OpIEqual %bool %6371 %uint_0 + %6373 = OpSelect %bool %6368 %true %6372 + %6374 = OpLogicalNot %bool %6373 + OpBranch %6376 + %6376 = OpLabel + %6377 = OpPhi %v2uint %6334 %6366 %528 %6352 + %6378 = OpPhi %bool %6374 %6366 %6362 %6352 + OpBranch %6380 + %6380 = OpLabel + %6381 = OpPhi %v2uint %6377 %6376 %528 %6333 + %6382 = OpPhi %bool %6378 %6376 %6348 %6333 + OpSelectionMerge %6390 None + OpBranchConditional %6382 %6385 %6390 + %6385 = OpLabel + %6386 = OpCompositeExtract %uint %6334 1 + %6387 = OpIAdd %uint %6338 %6386 + %6388 = OpCompositeInsert %v2uint %6387 %6334 1 + OpBranch %6390 + %6390 = OpLabel + %6391 = OpPhi %v2uint %6388 %6385 %6381 %6380 + %6392 = OpCompositeExtract %uint %6391 1 + %6393 = OpShiftRightLogical %uint %6392 %6337 + %6394 = OpUGreaterThan %bool %6393 %uint_16777215 + %6395 = OpSelect %uint %6394 %uint_1 %uint_0 + %6396 = OpShiftRightLogical %uint %6393 %6395 + %6397 = OpIAdd %uint %6301 %6395 + %6398 = OpINotEqual %bool %6396 %uint_0 + OpSelectionMerge %6440 None + OpBranchConditional %6398 %6401 %6440 + %6401 = OpLabel + %6402 = OpSLessThanEqual %bool %6397 %uint_127 + OpSelectionMerge %6428 None + OpBranchConditional %6402 %6405 %6428 + %6405 = OpLabel + %6406 = OpSGreaterThanEqual %bool %6397 %uint_4294967170 + OpSelectionMerge %6417 None + OpBranchConditional %6406 %6409 %6417 + %6409 = OpLabel + %6410 = OpShiftLeftLogical %uint %6397 %uint_23 + %6411 = OpIAdd %uint %6410 %uint_1065353216 + %6412 = OpBitwiseAnd %uint %6396 %uint_8388607 + %6413 = OpBitwiseOr %uint %6411 %6412 + %6414 = OpBitwiseOr %uint %6413 %6289 + %6415 = OpBitcast %float %6414 + OpBranch %6417 + %6417 = OpLabel + %6418 = OpPhi %float %6415 %6409 %261 %6405 + %6419 = OpPhi %bool %false %6409 %true %6405 + OpSelectionMerge %6425 None + OpBranchConditional %6419 %6422 %6425 + %6422 = OpLabel + %6423 = OpBitcast %float %6289 + OpBranch %6425 + %6425 = OpLabel + %6426 = OpPhi %float %6423 %6422 %6418 %6417 + OpBranch %6428 + %6428 = OpLabel + %6429 = OpPhi %float %6426 %6425 %261 %6401 + %6430 = OpPhi %bool %false %6425 %true %6401 + OpSelectionMerge %6437 None + OpBranchConditional %6430 %6433 %6437 + %6433 = OpLabel + %6434 = OpBitwiseOr %uint %6289 %uint_2139095040 + %6435 = OpBitcast %float %6434 + OpBranch %6437 + %6437 = OpLabel + %6438 = OpPhi %float %6435 %6433 %6429 %6428 + OpBranch %6440 + %6440 = OpLabel + %6441 = OpPhi %float %6438 %6437 %float_0 %6390 + OpBranch %6443 + %6443 = OpLabel + %6444 = OpPhi %float %6441 %6440 %6003 %6015 + OpBranch %6446 + %6446 = OpLabel + %6447 = OpPhi %float %6444 %6443 %261 %6011 + %6448 = OpPhi %bool %false %6443 %true %6011 + OpSelectionMerge %6456 None + OpBranchConditional %6448 %6451 %6456 + %6451 = OpLabel + %6452 = OpVectorShuffle %v2float %5994 %768 1 4294967295 + %6453 = OpFMul %v2float %5994 %6452 + %6454 = OpCompositeExtract %float %6453 0 + OpBranch %6456 + %6456 = OpLabel + %6457 = OpPhi %float %6454 %6451 %6447 %6446 + OpBranch %6459 + %6459 = OpLabel + %6460 = OpPhi %float %6457 %6456 %6003 %5984 + OpBranch %6462 + %6462 = OpLabel + %6463 = OpPhi %float %6460 %6459 %5956 %5979 + OpBranch %6465 + %6465 = OpLabel + %6466 = OpPhi %float %6463 %6462 %261 %5974 + %6467 = OpPhi %bool %false %6462 %true %5974 + OpBranch %6469 + %6469 = OpLabel + %6470 = OpPhi %float %6466 %6465 %261 %5969 + %6471 = OpPhi %bool %6467 %6465 %5970 %5969 + OpBranch %6473 + %6473 = OpLabel + %6474 = OpPhi %float %6470 %6469 %261 %5964 + %6475 = OpPhi %bool %6471 %6469 %5965 %5964 + OpBranch %6477 + %6477 = OpLabel + %6478 = OpPhi %float %6474 %6473 %261 %5959 + %6479 = OpPhi %bool %6475 %6473 %5960 %5959 + OpBranch %6481 + %6481 = OpLabel + %6482 = OpPhi %float %6478 %6477 %261 %5948 + %6483 = OpPhi %bool %6479 %6477 %5414 %5948 + OpSelectionMerge %6489 None + OpBranchConditional %6483 %6486 %6489 + %6486 = OpLabel + %6487 = OpFSub %float %5955 %5955 + OpBranch %6489 + %6489 = OpLabel + %6490 = OpPhi %float %6487 %6486 %6482 %6481 + %6491 = OpFSub %float %5954 %5955 + %6492 = OpFSub %float %5954 %6491 + %6493 = OpFSub %float %6492 %5955 + %6494 = OpFSub %float %6493 %6490 + %6495 = OpFAdd %float %6491 %6494 + %6496 = OpFMul %float %5411 %float_5_39030253en15 + %6497 = OpFNegate %float %6496 + OpSelectionMerge %7022 None + OpBranchConditional %5415 %6500 %7022 + %6500 = OpLabel + %6501 = OpIsNan %bool %float_5_39030253en15 + %6502 = OpLogicalNot %bool %6501 + OpSelectionMerge %7018 None + OpBranchConditional %6502 %6505 %7018 + %6505 = OpLabel + %6506 = OpIsNan %bool %6497 + %6507 = OpLogicalNot %bool %6506 + OpSelectionMerge %7014 None + OpBranchConditional %6507 %6510 %7014 + %6510 = OpLabel + %6511 = OpIsInf %bool %5411 + %6512 = OpLogicalNot %bool %6511 + OpSelectionMerge %7010 None + OpBranchConditional %6512 %6515 %7010 + %6515 = OpLabel + %6516 = OpIsInf %bool %float_5_39030253en15 + %6517 = OpLogicalNot %bool %6516 + OpSelectionMerge %7006 None + OpBranchConditional %6517 %6520 %7006 + %6520 = OpLabel + %6521 = OpIsInf %bool %6497 + %6522 = OpLogicalNot %bool %6521 + OpSelectionMerge %7003 None + OpBranchConditional %6522 %6525 %7003 + %6525 = OpLabel + %6526 = OpCompositeInsert %v2float %5411 %3023 1 + %6527 = OpBitcast %v2uint %6526 + %6528 = OpBitwiseAnd %v2uint %6527 %267 + %6529 = OpINotEqual %v2bool %6528 %270 + %6530 = OpBitwiseAnd %v2uint %6527 %272 + %6531 = OpIEqual %v2bool %6530 %270 + %6532 = OpLogicalOr %v2bool %6531 %6529 + %6533 = OpBitwiseAnd %v2uint %6527 %277 + %6534 = OpBitcast %v2float %6533 + %6535 = OpSelect %v2float %6532 %6526 %6534 + %6536 = OpBitcast %uint %6497 + %6537 = OpBitwiseAnd %uint %6536 %uint_2139095040 + %6538 = OpINotEqual %bool %6537 %uint_0 + %6539 = OpBitwiseAnd %uint %6536 %uint_8388607 + %6540 = OpIEqual %bool %6539 %uint_0 + %6541 = OpLogicalOr %bool %6540 %6538 + %6542 = OpBitwiseAnd %uint %6536 %uint_2147483648 + %6543 = OpBitcast %float %6542 + %6544 = OpSelect %float %6541 %6497 %6543 + %6545 = OpFOrdEqual %v2bool %6535 %290 + %6546 = OpVectorShuffle %v2bool %6545 %292 1 4294967295 + %6547 = OpLogicalOr %v2bool %6546 %6545 + %6548 = OpCompositeExtract %bool %6547 0 + %6549 = OpLogicalNot %bool %6548 + OpSelectionMerge %7000 None + OpBranchConditional %6549 %6552 %7000 + %6552 = OpLabel + %6553 = OpFUnordNotEqual %bool %6544 %float_0 + OpSelectionMerge %6987 None + OpBranchConditional %6553 %6556 %6987 + %6556 = OpLabel + %6557 = OpBitcast %v2uint %6535 + %6558 = OpCompositeExtract %uint %6557 1 + %6559 = OpShiftRightLogical %uint %6558 %uint_23 + %6560 = OpBitwiseAnd %uint %6559 %uint_255 + %6561 = OpCompositeExtract %uint %6557 0 + %6562 = OpShiftRightLogical %uint %6561 %uint_23 + %6563 = OpBitwiseAnd %uint %6562 %uint_255 + %6564 = OpBitcast %uint %6544 + %6565 = OpShiftRightLogical %uint %6564 %uint_23 + %6566 = OpBitwiseAnd %uint %6565 %uint_255 + %6567 = OpIAdd %uint %6566 %uint_4294967169 + %6568 = OpBitwiseAnd %v2uint %6557 %272 + %6569 = OpBitwiseOr %v2uint %6568 %319 + %6570 = OpBitwiseAnd %uint %6564 %uint_2147483648 + %6571 = OpBitwiseXor %uint %6561 %6558 + %6572 = OpBitwiseAnd %uint %6571 %uint_2147483648 + %6573 = OpCompositeExtract %uint %6569 0 + %6574 = OpCompositeExtract %uint %6569 1 + %6575 = OpUMulExtended %_struct_58 %6574 %6573 + %6576 = OpCompositeExtract %uint %6575 1 + %6577 = OpIMul %uint %6573 %6574 + %6578 = OpShiftLeftLogical %uint %6576 %uint_14 + %6579 = OpShiftRightLogical %uint %6577 %uint_18 + %6580 = OpBitwiseOr %uint %6579 %6578 + %6581 = OpShiftLeftLogical %uint %6577 %uint_14 + %6582 = OpCompositeConstruct %v2uint %6581 %6580 + %6583 = OpBitwiseOr %uint %6580 %6581 + %6584 = OpIEqual %bool %6583 %uint_0 + %6585 = OpIAdd %uint %6560 %uint_4294967042 + %6586 = OpIAdd %uint %6585 %6563 + %6587 = OpSelect %uint %6584 %uint_0 %6586 + %6588 = OpBitwiseOr %uint %6587 %6583 + %6589 = OpINotEqual %bool %6588 %uint_0 + OpSelectionMerge %6984 None + OpBranchConditional %6589 %6592 %6984 + %6592 = OpLabel + %6593 = OpISub %uint %6587 %6567 + %6594 = OpShiftLeftLogical %uint %6564 %uint_5 + %6595 = OpBitwiseAnd %uint %6594 %uint_268435424 + %6596 = OpBitwiseOr %uint %6595 %uint_268435456 + %6597 = OpCompositeInsert %v2uint %6596 %355 1 + %6598 = OpExtInst %uint %184 SAbs %6593 + %6599 = OpINotEqual %bool %6598 %uint_0 + OpSelectionMerge %6626 None + OpBranchConditional %6599 %6602 %6626 + %6602 = OpLabel + %6603 = OpUGreaterThanEqual %bool %6598 %uint_32 + OpSelectionMerge %6611 None + OpBranchConditional %6603 %6606 %6611 + %6606 = OpLabel + %6607 = OpBitwiseAnd %uint %6598 %uint_31 + %6608 = OpShiftLeftLogical %uint %uint_1 %6607 + %6609 = OpCompositeInsert %v2uint %6608 %355 1 + OpBranch %6611 + %6611 = OpLabel + %6612 = OpPhi %v2uint %6609 %6606 %528 %6602 + %6613 = OpPhi %bool %false %6606 %true %6602 + OpSelectionMerge %6623 None + OpBranchConditional %6613 %6616 %6623 + %6616 = OpLabel + %6617 = OpISub %uint %uint_0 %6598 + %6618 = OpBitwiseAnd %uint %6617 %uint_31 + %6619 = OpShiftRightLogical %uint %uint_1 %6618 + %6620 = OpShiftLeftLogical %uint %uint_1 %6598 + %6621 = OpCompositeConstruct %v2uint %6620 %6619 + OpBranch %6623 + %6623 = OpLabel + %6624 = OpPhi %v2uint %6621 %6616 %6612 %6611 + OpBranch %6626 + %6626 = OpLabel + %6627 = OpPhi %v2uint %7106 %6592 %6624 %6623 + %6628 = OpCompositeExtract %uint %6627 0 + %6629 = OpShiftRightLogical %uint %6628 %uint_1 + %6630 = OpIAdd %uint %6629 %uint_2147483647 + %6631 = OpBitwiseAnd %uint %6628 %uint_1 + %6632 = OpIAdd %uint %6630 %6631 + %6633 = OpShiftRightLogical %uint %6632 %uint_31 + %6634 = OpIAdd %uint %6628 %uint_4294967295 + %6635 = OpCompositeExtract %uint %6627 1 + %6636 = OpIAdd %uint %6635 %uint_4294967295 + %6637 = OpIAdd %uint %6636 %6633 + %6638 = OpCompositeConstruct %v2uint %6634 %6637 + %6639 = OpSLessThanEqual %bool %6593 %uint_0 + OpSelectionMerge %6691 None + OpBranchConditional %6639 %6642 %6691 + %6642 = OpLabel + %6643 = OpSGreaterThanEqual %bool %6593 %uint_4294967233 + OpSelectionMerge %6686 None + OpBranchConditional %6643 %6646 %6686 + %6646 = OpLabel + %6647 = OpISub %uint %uint_0 %6593 + %6648 = OpBitwiseAnd %v2uint %6638 %6582 + %6649 = OpINotEqual %bool %6587 %6567 + OpSelectionMerge %6681 None + OpBranchConditional %6649 %6652 %6681 + %6652 = OpLabel + %6653 = OpUGreaterThanEqual %bool %6647 %uint_32 + OpSelectionMerge %6661 None + OpBranchConditional %6653 %6656 %6661 + %6656 = OpLabel + %6657 = OpBitwiseAnd %uint %6647 %uint_31 + %6658 = OpShiftRightLogical %uint %6580 %6657 + %6659 = OpCompositeInsert %v2uint %6658 %420 0 + OpBranch %6661 + %6661 = OpLabel + %6662 = OpPhi %v2uint %6597 %6656 %528 %6652 + %6663 = OpPhi %v2uint %6648 %6656 %528 %6652 + %6664 = OpPhi %v2uint %6659 %6656 %528 %6652 + %6665 = OpPhi %bool %false %6656 %true %6652 + OpSelectionMerge %6676 None + OpBranchConditional %6665 %6668 %6676 + %6668 = OpLabel + %6669 = OpShiftRightLogical %uint %6581 %6647 + %6670 = OpBitwiseAnd %uint %6593 %uint_31 + %6671 = OpShiftLeftLogical %uint %6580 %6670 + %6672 = OpBitwiseOr %uint %6671 %6669 + %6673 = OpShiftRightLogical %uint %6580 %6647 + %6674 = OpCompositeConstruct %v2uint %6672 %6673 + OpBranch %6676 + %6676 = OpLabel + %6677 = OpPhi %v2uint %6597 %6668 %6662 %6661 + %6678 = OpPhi %v2uint %6648 %6668 %6663 %6661 + %6679 = OpPhi %v2uint %6674 %6668 %6664 %6661 + OpBranch %6681 + %6681 = OpLabel + %6682 = OpPhi %v2uint %6677 %6676 %6597 %6646 + %6683 = OpPhi %v2uint %6678 %6676 %6648 %6646 + %6684 = OpPhi %v2uint %6679 %6676 %6582 %6646 + OpBranch %6686 + %6686 = OpLabel + %6687 = OpPhi %v2uint %6682 %6681 %6597 %6642 + %6688 = OpPhi %v2uint %6683 %6681 %6582 %6642 + %6689 = OpPhi %v2uint %6684 %6681 %270 %6642 + OpBranch %6691 + %6691 = OpLabel + %6692 = OpPhi %v2uint %6687 %6686 %528 %6626 + %6693 = OpPhi %v2uint %6688 %6686 %528 %6626 + %6694 = OpPhi %v2uint %6689 %6686 %528 %6626 + %6695 = OpPhi %bool %false %6686 %true %6626 + OpSelectionMerge %6737 None + OpBranchConditional %6695 %6698 %6737 + %6698 = OpLabel + %6699 = OpULessThanEqual %bool %6593 %uint_63 + OpSelectionMerge %6732 None + OpBranchConditional %6699 %6702 %6732 + %6702 = OpLabel + %6703 = OpBitwiseAnd %uint %6637 %6596 + %6704 = OpCompositeInsert %v2uint %6703 %355 1 + %6705 = OpUGreaterThanEqual %bool %6593 %uint_32 + OpSelectionMerge %6713 None + OpBranchConditional %6705 %6708 %6713 + %6708 = OpLabel + %6709 = OpBitwiseAnd %uint %6593 %uint_31 + %6710 = OpShiftRightLogical %uint %6596 %6709 + %6711 = OpCompositeInsert %v2uint %6710 %420 0 + OpBranch %6713 + %6713 = OpLabel + %6714 = OpPhi %v2uint %6711 %6708 %528 %6702 + %6715 = OpPhi %v2uint %6704 %6708 %528 %6702 + %6716 = OpPhi %v2uint %6582 %6708 %528 %6702 + %6717 = OpPhi %bool %false %6708 %true %6702 + OpSelectionMerge %6727 None + OpBranchConditional %6717 %6720 %6727 + %6720 = OpLabel + %6721 = OpISub %uint %uint_0 %6593 + %6722 = OpBitwiseAnd %uint %6721 %uint_31 + %6723 = OpShiftLeftLogical %uint %6596 %6722 + %6724 = OpShiftRightLogical %uint %6596 %6593 + %6725 = OpCompositeConstruct %v2uint %6723 %6724 + OpBranch %6727 + %6727 = OpLabel + %6728 = OpPhi %v2uint %6725 %6720 %6714 %6713 + %6729 = OpPhi %v2uint %6704 %6720 %6715 %6713 + %6730 = OpPhi %v2uint %6582 %6720 %6716 %6713 + OpBranch %6732 + %6732 = OpLabel + %6733 = OpPhi %v2uint %6728 %6727 %270 %6698 + %6734 = OpPhi %v2uint %6729 %6727 %6597 %6698 + %6735 = OpPhi %v2uint %6730 %6727 %6582 %6698 + OpBranch %6737 + %6737 = OpLabel + %6738 = OpPhi %v2uint %6694 %6691 %6735 %6732 + %6739 = OpPhi %v2uint %6693 %6691 %6734 %6732 + %6740 = OpPhi %v2uint %6692 %6691 %6733 %6732 + %6741 = OpExtInst %uint %184 SMax %6587 %6567 + %6742 = OpINotEqual %bool %6570 %6572 + OpSelectionMerge %6789 None + OpBranchConditional %6742 %6745 %6789 + %6745 = OpLabel + %6746 = OpCompositeExtract %uint %6740 0 + %6747 = OpBitwiseXor %uint %6746 %uint_4294967295 + %6748 = OpCompositeExtract %uint %6740 1 + %6749 = OpBitwiseXor %uint %6748 %uint_4294967295 + %6750 = OpShiftRightLogical %uint %6747 %uint_1 + %6751 = OpBitwiseAnd %uint %6747 %uint_1 + %6752 = OpIAdd %uint %6750 %6751 + %6753 = OpShiftRightLogical %uint %6752 %uint_31 + %6754 = OpISub %uint %uint_0 %6746 + %6755 = OpCompositeExtract %uint %6738 0 + %6756 = OpShiftRightLogical %uint %6755 %uint_1 + %6757 = OpShiftRightLogical %uint %6754 %uint_1 + %6758 = OpIAdd %uint %6757 %6756 + %6759 = OpBitwiseAnd %uint %6755 %uint_1 + %6760 = OpBitwiseAnd %uint %6759 %6754 + %6761 = OpIAdd %uint %6758 %6760 + %6762 = OpShiftRightLogical %uint %6761 %uint_31 + %6763 = OpISub %uint %6755 %6746 + %6764 = OpCompositeExtract %uint %6738 1 + %6765 = OpVectorShuffle %v2uint %6739 %528 1 4294967295 + %6766 = OpBitwiseOr %v2uint %6765 %6739 + %6767 = OpCompositeExtract %uint %6766 0 + %6768 = OpINotEqual %bool %6767 %uint_0 + %6769 = OpSGreaterThan %bool %6587 %6567 + %6770 = OpSelect %bool %6768 %6769 %false + %6771 = OpSelect %v2uint %6770 %536 %270 + %6772 = OpCompositeExtract %uint %6771 0 + %6773 = OpShiftRightLogical %uint %6763 %uint_1 + %6774 = OpShiftRightLogical %uint %6772 %uint_1 + %6775 = OpIAdd %uint %6774 %6773 + %6776 = OpBitwiseAnd %uint %6763 %uint_1 + %6777 = OpBitwiseAnd %uint %6776 %6772 + %6778 = OpIAdd %uint %6775 %6777 + %6779 = OpShiftRightLogical %uint %6778 %uint_31 + %6780 = OpIAdd %uint %6772 %6763 + %6781 = OpCompositeExtract %uint %6771 1 + %6782 = OpIAdd %uint %6764 %6749 + %6783 = OpIAdd %uint %6782 %6753 + %6784 = OpIAdd %uint %6783 %6762 + %6785 = OpIAdd %uint %6784 %6781 + %6786 = OpIAdd %uint %6785 %6779 + %6787 = OpCompositeConstruct %v2uint %6780 %6786 + OpBranch %6789 + %6789 = OpLabel + %6790 = OpPhi %v2uint %6787 %6745 %528 %6737 + %6791 = OpPhi %bool %false %6745 %true %6737 + OpSelectionMerge %6810 None + OpBranchConditional %6791 %6794 %6810 + %6794 = OpLabel + %6795 = OpCompositeExtract %uint %6738 0 + %6796 = OpCompositeExtract %uint %6740 0 + %6797 = OpShiftRightLogical %uint %6795 %uint_1 + %6798 = OpShiftRightLogical %uint %6796 %uint_1 + %6799 = OpIAdd %uint %6798 %6797 + %6800 = OpBitwiseAnd %uint %6795 %uint_1 + %6801 = OpBitwiseAnd %uint %6800 %6796 + %6802 = OpIAdd %uint %6799 %6801 + %6803 = OpShiftRightLogical %uint %6802 %uint_31 + %6804 = OpIAdd %uint %6796 %6795 + %6805 = OpIAdd %v2uint %6740 %6738 + %6806 = OpCompositeExtract %uint %6805 1 + %6807 = OpIAdd %uint %6803 %6806 + %6808 = OpCompositeConstruct %v2uint %6804 %6807 + OpBranch %6810 + %6810 = OpLabel + %6811 = OpPhi %v2uint %6808 %6794 %6790 %6789 + %6812 = OpCompositeExtract %uint %6811 1 + %6813 = OpSLessThan %bool %6812 %uint_0 + OpSelectionMerge %6829 None + OpBranchConditional %6813 %6816 %6829 + %6816 = OpLabel + %6817 = OpCompositeExtract %uint %6811 0 + %6818 = OpBitwiseXor %uint %6817 %uint_4294967295 + %6819 = OpBitwiseXor %uint %6812 %uint_4294967295 + %6820 = OpShiftRightLogical %uint %6818 %uint_1 + %6821 = OpBitwiseAnd %uint %6818 %uint_1 + %6822 = OpIAdd %uint %6820 %6821 + %6823 = OpShiftRightLogical %uint %6822 %uint_31 + %6824 = OpISub %uint %uint_0 %6817 + %6825 = OpIAdd %uint %6823 %6819 + %6826 = OpCompositeConstruct %v2uint %6824 %6825 + %6827 = OpBitwiseXor %uint %6572 %uint_2147483648 + OpBranch %6829 + %6829 = OpLabel + %6830 = OpPhi %uint %6827 %6816 %6572 %6810 + %6831 = OpPhi %v2uint %6826 %6816 %6811 %6810 + %6832 = OpCompositeExtract %uint %6831 1 + %6833 = OpExtInst %uint %184 FindUMsb %6832 + %6834 = OpISub %uint %uint_31 %6833 + %6835 = OpIEqual %bool %6832 %uint_0 + %6836 = OpCompositeExtract %uint %6831 0 + %6837 = OpExtInst %uint %184 FindUMsb %6836 + %6838 = OpISub %uint %uint_31 %6837 + %6839 = OpIAdd %uint %6838 %uint_32 + %6840 = OpSelect %uint %6835 %6839 %6834 + %6841 = OpISub %uint %uint_3 %6840 + %6842 = OpIAdd %uint %6841 %6741 + %6843 = OpUGreaterThan %bool %6840 %uint_3 + OpSelectionMerge %6874 None + OpBranchConditional %6843 %6846 %6874 + %6846 = OpLabel + %6847 = OpIAdd %uint %6840 %uint_4294967293 + %6848 = OpUGreaterThanEqual %bool %6847 %uint_32 + OpSelectionMerge %6856 None + OpBranchConditional %6848 %6851 %6856 + %6851 = OpLabel + %6852 = OpBitwiseAnd %uint %6847 %uint_31 + %6853 = OpShiftLeftLogical %uint %6836 %6852 + %6854 = OpCompositeInsert %v2uint %6853 %355 1 + OpBranch %6856 + %6856 = OpLabel + %6857 = OpPhi %uint %uint_0 %6851 %354 %6846 + %6858 = OpPhi %v2uint %6854 %6851 %528 %6846 + %6859 = OpPhi %bool %false %6851 %true %6846 + OpSelectionMerge %6870 None + OpBranchConditional %6859 %6862 %6870 + %6862 = OpLabel + %6863 = OpShiftLeftLogical %uint %6832 %6847 + %6864 = OpBitwiseAnd %uint %6841 %uint_31 + %6865 = OpShiftRightLogical %uint %6836 %6864 + %6866 = OpBitwiseOr %uint %6865 %6863 + %6867 = OpShiftLeftLogical %uint %6836 %6847 + %6868 = OpCompositeConstruct %v2uint %6867 %6866 + OpBranch %6870 + %6870 = OpLabel + %6871 = OpPhi %uint %uint_0 %6862 %6857 %6856 + %6872 = OpPhi %v2uint %6868 %6862 %6858 %6856 + OpBranch %6874 + %6874 = OpLabel + %6875 = OpPhi %v2uint %6831 %6829 %6872 %6870 + %6876 = OpPhi %uint %6841 %6829 %6871 %6870 + %6877 = OpIAdd %uint %6876 %uint_5 + %6878 = OpBitwiseAnd %uint %6877 %uint_31 + %6879 = OpShiftLeftLogical %uint %uint_1 %6878 + %6880 = OpCompositeInsert %v2uint %6879 %355 1 + %6881 = OpIAdd %uint %6879 %uint_4294967295 + %6882 = OpCompositeInsert %v2uint %6881 %650 1 + %6883 = OpBitwiseAnd %v2uint %6882 %6875 + %6884 = OpCompositeExtract %uint %6883 1 + %6885 = OpBitwiseAnd %v2uint %6880 %6875 + %6886 = OpIAdd %uint %6876 %uint_2 + %6887 = OpBitwiseAnd %uint %6886 %uint_31 + %6888 = OpShiftLeftLogical %uint %uint_4 %6887 + %6889 = OpUGreaterThan %bool %6884 %6888 + %6890 = OpLogicalNot %bool %6889 + OpSelectionMerge %6921 None + OpBranchConditional %6890 %6893 %6921 + %6893 = OpLabel + %6894 = OpCompositeExtract %uint %6883 0 + %6895 = OpVectorShuffle %v2uint %6739 %528 1 4294967295 + %6896 = OpBitwiseOr %v2uint %6895 %6739 + %6897 = OpCompositeExtract %uint %6896 0 + %6898 = OpINotEqual %bool %6897 %uint_0 + %6899 = OpSelect %uint %6898 %uint_1 %uint_0 + %6900 = OpBitwiseOr %uint %6894 %6899 + %6901 = OpIEqual %bool %6884 %6888 + %6902 = OpINotEqual %bool %6900 %uint_0 + %6903 = OpSelect %bool %6901 %6902 %false + %6904 = OpLogicalNot %bool %6903 + OpSelectionMerge %6917 None + OpBranchConditional %6904 %6907 %6917 + %6907 = OpLabel + %6908 = OpINotEqual %bool %6884 %6888 + %6909 = OpLogicalOr %bool %6908 %6902 + %6910 = OpVectorShuffle %v2uint %6885 %528 1 4294967295 + %6911 = OpBitwiseOr %v2uint %6910 %6885 + %6912 = OpCompositeExtract %uint %6911 0 + %6913 = OpIEqual %bool %6912 %uint_0 + %6914 = OpSelect %bool %6909 %true %6913 + %6915 = OpLogicalNot %bool %6914 + OpBranch %6917 + %6917 = OpLabel + %6918 = OpPhi %v2uint %6875 %6907 %528 %6893 + %6919 = OpPhi %bool %6915 %6907 %6903 %6893 + OpBranch %6921 + %6921 = OpLabel + %6922 = OpPhi %v2uint %6918 %6917 %528 %6874 + %6923 = OpPhi %bool %6919 %6917 %6889 %6874 + OpSelectionMerge %6931 None + OpBranchConditional %6923 %6926 %6931 + %6926 = OpLabel + %6927 = OpCompositeExtract %uint %6875 1 + %6928 = OpIAdd %uint %6879 %6927 + %6929 = OpCompositeInsert %v2uint %6928 %6875 1 + OpBranch %6931 + %6931 = OpLabel + %6932 = OpPhi %v2uint %6929 %6926 %6922 %6921 + %6933 = OpCompositeExtract %uint %6932 1 + %6934 = OpShiftRightLogical %uint %6933 %6878 + %6935 = OpUGreaterThan %bool %6934 %uint_16777215 + %6936 = OpSelect %uint %6935 %uint_1 %uint_0 + %6937 = OpShiftRightLogical %uint %6934 %6936 + %6938 = OpIAdd %uint %6842 %6936 + %6939 = OpINotEqual %bool %6937 %uint_0 + OpSelectionMerge %6981 None + OpBranchConditional %6939 %6942 %6981 + %6942 = OpLabel + %6943 = OpSLessThanEqual %bool %6938 %uint_127 + OpSelectionMerge %6969 None + OpBranchConditional %6943 %6946 %6969 + %6946 = OpLabel + %6947 = OpSGreaterThanEqual %bool %6938 %uint_4294967170 + OpSelectionMerge %6958 None + OpBranchConditional %6947 %6950 %6958 + %6950 = OpLabel + %6951 = OpShiftLeftLogical %uint %6938 %uint_23 + %6952 = OpIAdd %uint %6951 %uint_1065353216 + %6953 = OpBitwiseAnd %uint %6937 %uint_8388607 + %6954 = OpBitwiseOr %uint %6952 %6953 + %6955 = OpBitwiseOr %uint %6954 %6830 + %6956 = OpBitcast %float %6955 + OpBranch %6958 + %6958 = OpLabel + %6959 = OpPhi %float %6956 %6950 %261 %6946 + %6960 = OpPhi %bool %false %6950 %true %6946 + OpSelectionMerge %6966 None + OpBranchConditional %6960 %6963 %6966 + %6963 = OpLabel + %6964 = OpBitcast %float %6830 + OpBranch %6966 + %6966 = OpLabel + %6967 = OpPhi %float %6964 %6963 %6959 %6958 + OpBranch %6969 + %6969 = OpLabel + %6970 = OpPhi %float %6967 %6966 %261 %6942 + %6971 = OpPhi %bool %false %6966 %true %6942 + OpSelectionMerge %6978 None + OpBranchConditional %6971 %6974 %6978 + %6974 = OpLabel + %6975 = OpBitwiseOr %uint %6830 %uint_2139095040 + %6976 = OpBitcast %float %6975 + OpBranch %6978 + %6978 = OpLabel + %6979 = OpPhi %float %6976 %6974 %6970 %6969 + OpBranch %6981 + %6981 = OpLabel + %6982 = OpPhi %float %6979 %6978 %float_0 %6931 + OpBranch %6984 + %6984 = OpLabel + %6985 = OpPhi %float %6982 %6981 %6544 %6556 + OpBranch %6987 + %6987 = OpLabel + %6988 = OpPhi %float %6985 %6984 %261 %6552 + %6989 = OpPhi %bool %false %6984 %true %6552 + OpSelectionMerge %6997 None + OpBranchConditional %6989 %6992 %6997 + %6992 = OpLabel + %6993 = OpVectorShuffle %v2float %6535 %768 1 4294967295 + %6994 = OpFMul %v2float %6535 %6993 + %6995 = OpCompositeExtract %float %6994 0 + OpBranch %6997 + %6997 = OpLabel + %6998 = OpPhi %float %6995 %6992 %6988 %6987 + OpBranch %7000 + %7000 = OpLabel + %7001 = OpPhi %float %6998 %6997 %6544 %6525 + OpBranch %7003 + %7003 = OpLabel + %7004 = OpPhi %float %7001 %7000 %6497 %6520 + OpBranch %7006 + %7006 = OpLabel + %7007 = OpPhi %float %7004 %7003 %261 %6515 + %7008 = OpPhi %bool %false %7003 %true %6515 + OpBranch %7010 + %7010 = OpLabel + %7011 = OpPhi %float %7007 %7006 %261 %6510 + %7012 = OpPhi %bool %7008 %7006 %6511 %6510 + OpBranch %7014 + %7014 = OpLabel + %7015 = OpPhi %float %7011 %7010 %261 %6505 + %7016 = OpPhi %bool %7012 %7010 %6506 %6505 + OpBranch %7018 + %7018 = OpLabel + %7019 = OpPhi %float %7015 %7014 %261 %6500 + %7020 = OpPhi %bool %7016 %7014 %6501 %6500 + OpBranch %7022 + %7022 = OpLabel + %7023 = OpPhi %float %7019 %7018 %261 %6489 + %7024 = OpPhi %bool %7020 %7018 %5414 %6489 + OpSelectionMerge %7030 None + OpBranchConditional %7024 %7027 %7030 + %7027 = OpLabel + %7028 = OpFSub %float %6496 %6496 + OpBranch %7030 + %7030 = OpLabel + %7031 = OpPhi %float %7028 %7027 %7023 %7022 + %7032 = OpFSub %float %6495 %6496 + %7033 = OpFSub %float %6495 %7032 + %7034 = OpFSub %float %7033 %6496 + %7035 = OpFAdd %float %7032 %7034 + %7036 = OpFNegate %float %7031 + %7037 = OpConvertFToS %uint %5411 + OpBranch %7039 + %7039 = OpLabel + %7040 = OpPhi %uint %7037 %7030 %5402 %5401 + %7041 = OpPhi %float %7035 %7030 %5403 %5401 + %7042 = OpPhi %float %7036 %7030 %5404 %5401 + OpBranch %7044 + %7044 = OpLabel + %7045 = OpBitcast %uint %35 + %7046 = OpFMul %float %7041 %7041 + %7047 = OpFMul %float %7041 %7046 + %7048 = OpFMul %float %7046 %float_1_58969102en10 + %7049 = OpFAdd %float %7048 %float_n2_50507597en08 + %7050 = OpFMul %float %7046 %7049 + %7051 = OpFAdd %float %7050 %float_2_72500006en06 + %7052 = OpFMul %float %7046 %7051 + %7053 = OpFAdd %float %7052 %float_n0_00019840087 + %7054 = OpFMul %float %7046 %7053 + %7055 = OpFAdd %float %7054 %float_0_00833333191 + %7056 = OpFMul %float %7042 %float_0_5 + %7057 = OpFMul %float %7047 %7055 + %7058 = OpFSub %float %7056 %7057 + %7059 = OpFMul %float %7046 %7058 + %7060 = OpFSub %float %7059 %7042 + %7061 = OpFMul %float %7047 %float_0_166666672 + %7062 = OpFAdd %float %7061 %7060 + %7063 = OpFSub %float %7041 %7062 + %7064 = OpFMul %float %7046 %float_1_13596476en11 + %7065 = OpFSub %float %float_2_08757234en09 %7064 + %7066 = OpFMul %float %7046 %7065 + %7067 = OpFAdd %float %7066 %float_n2_7301013en07 + %7068 = OpFMul %float %7046 %7067 + %7069 = OpFAdd %float %7068 %float_2_48005999en05 + %7070 = OpFMul %float %7046 %7069 + %7071 = OpFAdd %float %7070 %float_n0_00138888881 + %7072 = OpFMul %float %7046 %7071 + %7073 = OpFAdd %float %7072 %float_0_0416666679 + %7074 = OpFMul %float %7046 %7073 + %7075 = OpBitcast %uint %7041 + %7076 = OpBitwiseAnd %uint %7075 %uint_2147483647 + %7077 = OpBitcast %float %7076 + %7078 = OpBitcast %uint %7077 + %7079 = OpIAdd %uint %7078 %uint_4278190080 + %7080 = OpBitcast %float %7079 + %7081 = OpIAdd %uint %7078 %uint_3244713574 + %7082 = OpULessThan %bool %7081 %uint_11429479 + %7083 = OpSelect %float %7082 %7080 %float_0 + %7084 = OpUGreaterThan %bool %7078 %uint_1061683200 + %7085 = OpSelect %float %7084 %float_0_28125 %7083 + %7086 = OpFMul %float %7046 %float_0_5 + %7087 = OpFSub %float %7086 %7085 + %7088 = OpFSub %float %float_1 %7085 + %7089 = OpFMul %float %7046 %7074 + %7090 = OpFMul %float %7042 %7041 + %7091 = OpFSub %float %7089 %7090 + %7092 = OpFSub %float %7091 %7087 + %7093 = OpFAdd %float %7088 %7092 + %7094 = OpBitwiseAnd %uint %7040 %uint_1 + %7095 = OpIEqual %bool %7094 %uint_0 + %7096 = OpSelect %float %7095 %7063 %7093 + %7097 = OpBitcast %uint %7096 + %7098 = OpShiftLeftLogical %uint %7040 %uint_30 + %7099 = OpBitwiseXor %uint %7098 %7045 + %7100 = OpBitwiseAnd %uint %7099 %uint_2147483648 + %7101 = OpBitwiseXor %uint %7100 %7097 + %7102 = OpBitcast %float %7101 + %7103 = OpSelect %float %3619 %float_0x1_8p_128 %7102 + %7104 = OpFOrdEqual %bool %35 %float_0 + %7105 = OpSelect %float %7104 %35 %7103 + OpReturnValue %7105 + OpFunctionEnd + %7115 = OpExtInst %void %7107 PushConstantRegionOffset %uint_0 %uint_12 + %7110 = OpExtInst %void %7107 Kernel %21 %7108 %uint_1 %uint_0 %7109 + %7112 = OpExtInst %void %7107 ArgumentInfo %7111 + %7113 = OpExtInst %void %7107 ArgumentStorageBuffer %7110 %uint_0 %uint_0 %uint_0 %7112 + %7116 = OpExtInst %void %7107 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/struct_member_race.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/struct_member_race.spv.dis new file mode 100644 index 0000000000..f9240e0829 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/struct_member_race.spv.dis @@ -0,0 +1,73 @@ +; @Input: %18 = {{{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + %35 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "example" %gl_GlobalInvocationID %13 %18 %5 + OpSource OpenCL_C 200 + %36 = OpString "example" + %37 = OpString " kernel" + %39 = OpString "G" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_14 0 Offset 0 + OpMemberDecorate %_struct_14 1 Offset 4 + OpDecorate %_runtimearr__struct_14 ArrayStride 8 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_14 = OpTypeStruct %uint %uint +%_runtimearr__struct_14 = OpTypeRuntimeArray %_struct_14 + %_struct_16 = OpTypeStruct %_runtimearr__struct_14 +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_3 = OpConstant %uint 3 + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %26 + %34 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_3 %uint_1 + OpStore %34 %30 + OpReturn + OpFunctionEnd + %43 = OpExtInst %void %35 PushConstantRegionOffset %uint_0 %uint_12 + %38 = OpExtInst %void %35 Kernel %21 %36 %uint_1 %uint_0 %37 + %40 = OpExtInst %void %35 ArgumentInfo %39 + %41 = OpExtInst %void %35 ArgumentStorageBuffer %38 %uint_0 %uint_0 %uint_0 %40 + %45 = OpExtInst %void %35 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/vector_element_race.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/vector_element_race.spv.dis new file mode 100644 index 0000000000..40e2776785 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/misc/fail/vector_element_race.spv.dis @@ -0,0 +1,75 @@ +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %38 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "example" %gl_GlobalInvocationID %13 %19 %5 + OpSource OpenCL_C 200 + %39 = OpString "example" + %40 = OpString " kernel" + %43 = OpString "G" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %_struct_17 = OpTypeStruct %_runtimearr_v4float +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float + %uint_3 = OpConstant %uint 3 + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + %26 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %27 = OpLoad %uint %26 + %29 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %30 = OpLoad %uint %29 + %31 = OpIAdd %uint %30 %27 + %32 = OpConvertUToF %float %31 + %35 = OpAccessChain %_ptr_StorageBuffer_v4float %19 %uint_0 %uint_3 + %36 = OpLoad %v4float %35 + %37 = OpCompositeInsert %v4float %32 %36 1 + OpStore %35 %37 + OpReturn + OpFunctionEnd + %47 = OpExtInst %void %38 PushConstantRegionOffset %uint_0 %uint_12 + %42 = OpExtInst %void %38 Kernel %22 %39 %uint_1 %uint_0 %40 + %44 = OpExtInst %void %38 ArgumentInfo %43 + %45 = OpExtInst %void %38 ArgumentStorageBuffer %42 %uint_0 %uint_0 %uint_0 %44 + %49 = OpExtInst %void %38 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc12.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc12.spv.dis new file mode 100644 index 0000000000..b794ebb6c3 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc12.spv.dis @@ -0,0 +1,73 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 54 +; Schema: 0 + OpCapability Shader + %47 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %16 "foo" %gl_WorkGroupID %13 %5 + OpSource OpenCL_C 200 + %48 = OpString "foo" + %49 = OpString " kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %16 = OpFunction %void None %15 + %17 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %21 = OpLoad %uint %20 + %23 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %24 = OpLoad %uint %23 + %25 = OpISub %uint %uint_0 %21 + %27 = OpINotEqual %bool %24 %25 + OpSelectionMerge %46 None + OpBranchConditional %27 %30 %46 + %30 = OpLabel + %31 = OpPhi %uint %35 %30 %uint_0 %17 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %35 = OpIAdd %uint %31 %uint_1 + %36 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %37 = OpLoad %uint %36 + %38 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpIAdd %uint %39 %37 + %41 = OpUGreaterThanEqual %bool %35 %40 + OpLoopMerge %44 %30 None + OpBranchConditional %41 %44 %30 + %44 = OpLabel + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd + %52 = OpExtInst %void %47 PushConstantRegionGroupOffset %uint_0 %uint_12 + %50 = OpExtInst %void %47 Kernel %16 %48 %uint_0 %uint_0 %49 + %53 = OpExtInst %void %47 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc13.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc13.spv.dis new file mode 100644 index 0000000000..46cfa81a68 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc13.spv.dis @@ -0,0 +1,69 @@ +; @Input: %17 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + %33 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %20 "foo" %gl_GlobalInvocationID %13 %17 %5 + OpSource OpenCL_C 200 + %34 = OpString "foo" + %35 = OpString " kernel" + %37 = OpString "B" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %20 = OpFunction %void None %19 + %21 = OpLabel + %24 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %25 = OpLoad %uint %24 + %27 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %28 = OpLoad %uint %27 + %29 = OpIAdd %uint %25 %28 + %31 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %29 + OpStore %31 %uint_1 + OpReturn + OpFunctionEnd + %41 = OpExtInst %void %33 PushConstantRegionOffset %uint_0 %uint_12 + %36 = OpExtInst %void %33 Kernel %20 %34 %uint_1 %uint_0 %35 + %38 = OpExtInst %void %33 ArgumentInfo %37 + %39 = OpExtInst %void %33 ArgumentStorageBuffer %36 %uint_0 %uint_0 %uint_0 %38 + %43 = OpExtInst %void %33 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc15.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc15.spv.dis new file mode 100644 index 0000000000..9f2dc81678 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc15.spv.dis @@ -0,0 +1,88 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 66 +; Schema: 0 + OpCapability Shader + %52 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_LocalInvocationID %10 %14 %18 + OpSource OpenCL_C 200 + %53 = OpString "foo" + %54 = OpString " kernel" + %57 = OpString "A" + %61 = OpString "x" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_12 0 Offset 0 + OpDecorate %_struct_12 Block + OpDecorate %15 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint + %_struct_12 = OpTypeStruct %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 + %15 = OpSpecConstant %uint 1 +%_arr_uint_15 = OpTypeArray %uint %15 +%_ptr_Workgroup__arr_uint_15 = OpTypePointer Workgroup %_arr_uint_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant__struct_11 = OpTypePointer PushConstant %_struct_11 + %_struct_29 = OpTypeStruct %uint + %bool = OpTypeBool + %uint_3 = OpConstant %uint 3 +%_ptr_Input_uint = OpTypePointer Input %uint + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_2 = OpConstant %uint 2 + %uint_4 = OpConstant %uint 4 + %uint_1 = OpConstant %uint 1 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %18 = OpVariable %_ptr_Workgroup__arr_uint_15 Workgroup + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Workgroup_uint %18 %uint_0 + %27 = OpAccessChain %_ptr_PushConstant__struct_11 %14 %uint_0 + %28 = OpLoad %_struct_11 %27 + %30 = OpCopyLogical %_struct_29 %28 + %31 = OpCompositeExtract %uint %30 0 + %34 = OpINotEqual %bool %31 %uint_3 + %36 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %37 = OpLoad %uint %36 + OpSelectionMerge %42 None + OpBranchConditional %34 %40 %42 + %40 = OpLabel + OpStore %25 %37 + OpBranch %42 + %42 = OpLabel + %43 = OpPhi %bool %false %40 %true %22 + OpSelectionMerge %49 None + OpBranchConditional %43 %46 %49 + %46 = OpLabel + %47 = OpAccessChain %_ptr_Workgroup_uint %18 %37 + OpStore %47 %uint_3 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd + %56 = OpExtInst %void %52 Kernel %21 %53 %uint_2 %uint_0 %54 + %58 = OpExtInst %void %52 ArgumentInfo %57 + %60 = OpExtInst %void %52 ArgumentWorkgroup %56 %uint_0 %uint_3 %uint_4 %58 + %62 = OpExtInst %void %52 ArgumentInfo %61 + %64 = OpExtInst %void %52 ArgumentPodPushConstant %56 %uint_1 %uint_0 %uint_4 %62 + %65 = OpExtInst %void %52 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc16.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc16.spv.dis new file mode 100644 index 0000000000..83eec15674 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc16.spv.dis @@ -0,0 +1,2246 @@ +; @Input: %963 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 1916 +; Schema: 0 + OpCapability Shader + %1902 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %971 "foo" %gl_GlobalInvocationID %13 %405 %771 %958 %963 %968 %5 + OpSource OpenCL_C 200 + %1903 = OpString "foo" + %1904 = OpString " __kernel" + %1907 = OpString "p" + %1910 = OpString "n" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %_struct_961 0 Offset 0 + OpDecorate %_struct_961 Block + OpDecorate %_runtimearr_v4uint ArrayStride 16 + OpMemberDecorate %_struct_966 0 Offset 0 + OpDecorate %_struct_966 Block + OpDecorate %963 DescriptorSet 0 + OpDecorate %963 Binding 0 + OpDecorate %968 DescriptorSet 0 + OpDecorate %968 Binding 1 + OpDecorate %1001 NoContraction + OpDecorate %1007 NoContraction + OpDecorate %1009 NoContraction + OpDecorate %1011 NoContraction + OpDecorate %1012 NoContraction + OpDecorate %1014 NoContraction + OpDecorate %1015 NoContraction + OpDecorate %1017 NoContraction + OpDecorate %1018 NoContraction + OpDecorate %1020 NoContraction + OpDecorate %1021 NoContraction + OpDecorate %1023 NoContraction + OpDecorate %1024 NoContraction + OpDecorate %1025 NoContraction + OpDecorate %1026 NoContraction + OpDecorate %1027 NoContraction + OpDecorate %1028 NoContraction + OpDecorate %1037 NoContraction + OpDecorate %1060 NoContraction + OpDecorate %1066 NoContraction + OpDecorate %1069 NoContraction + OpDecorate %1070 NoContraction + OpDecorate %1071 NoContraction + OpDecorate %1072 NoContraction + OpDecorate %1073 NoContraction + OpDecorate %1075 NoContraction + OpDecorate %1076 NoContraction + OpDecorate %1077 NoContraction + OpDecorate %1078 NoContraction + OpDecorate %1079 NoContraction + OpDecorate %1080 NoContraction + OpDecorate %1084 NoContraction + OpDecorate %1085 NoContraction + OpDecorate %1086 NoContraction + OpDecorate %1088 NoContraction + OpDecorate %1089 NoContraction + OpDecorate %1091 NoContraction + OpDecorate %1092 NoContraction + OpDecorate %1093 NoContraction + OpDecorate %1103 NoContraction + OpDecorate %1104 NoContraction + OpDecorate %1105 NoContraction + OpDecorate %1106 NoContraction + OpDecorate %1107 NoContraction + OpDecorate %1108 NoContraction + OpDecorate %1109 NoContraction + OpDecorate %1115 NoContraction + OpDecorate %1116 NoContraction + OpDecorate %1117 NoContraction + OpDecorate %1118 NoContraction + OpDecorate %1119 NoContraction + OpDecorate %1120 NoContraction + OpDecorate %1121 NoContraction + OpDecorate %1122 NoContraction + OpDecorate %1123 NoContraction + OpDecorate %1125 NoContraction + OpDecorate %1134 NoContraction + OpDecorate %1135 NoContraction + OpDecorate %1137 NoContraction + OpDecorate %1138 NoContraction + OpDecorate %1139 NoContraction + OpDecorate %1141 NoContraction + OpDecorate %1142 NoContraction + OpDecorate %1143 NoContraction + OpDecorate %1144 NoContraction + OpDecorate %1145 NoContraction + OpDecorate %1146 NoContraction + OpDecorate %1147 NoContraction + OpDecorate %1152 NoContraction + OpDecorate %1153 NoContraction + OpDecorate %1154 NoContraction + OpDecorate %1155 NoContraction + OpDecorate %1156 NoContraction + OpDecorate %1163 NoContraction + OpDecorate %1183 NoContraction + OpDecorate %1257 NoContraction + OpDecorate %1262 NoContraction + OpDecorate %1263 NoContraction + OpDecorate %1264 NoContraction + OpDecorate %1265 NoContraction + OpDecorate %1266 NoContraction + OpDecorate %1267 NoContraction + OpDecorate %1268 NoContraction + OpDecorate %1269 NoContraction + OpDecorate %1270 NoContraction + OpDecorate %1271 NoContraction + OpDecorate %1272 NoContraction + OpDecorate %1273 NoContraction + OpDecorate %1274 NoContraction + OpDecorate %1275 NoContraction + OpDecorate %1276 NoContraction + OpDecorate %1277 NoContraction + OpDecorate %1282 NoContraction + OpDecorate %1299 NoContraction + OpDecorate %1303 NoContraction + OpDecorate %1306 NoContraction + OpDecorate %1307 NoContraction + OpDecorate %1308 NoContraction + OpDecorate %1309 NoContraction + OpDecorate %1310 NoContraction + OpDecorate %1311 NoContraction + OpDecorate %1312 NoContraction + OpDecorate %1313 NoContraction + OpDecorate %1314 NoContraction + OpDecorate %1315 NoContraction + OpDecorate %1316 NoContraction + OpDecorate %1319 NoContraction + OpDecorate %1320 NoContraction + OpDecorate %1321 NoContraction + OpDecorate %1323 NoContraction + OpDecorate %1324 NoContraction + OpDecorate %1326 NoContraction + OpDecorate %1327 NoContraction + OpDecorate %1328 NoContraction + OpDecorate %1337 NoContraction + OpDecorate %1338 NoContraction + OpDecorate %1339 NoContraction + OpDecorate %1340 NoContraction + OpDecorate %1341 NoContraction + OpDecorate %1342 NoContraction + OpDecorate %1343 NoContraction + OpDecorate %1349 NoContraction + OpDecorate %1350 NoContraction + OpDecorate %1351 NoContraction + OpDecorate %1352 NoContraction + OpDecorate %1353 NoContraction + OpDecorate %1354 NoContraction + OpDecorate %1355 NoContraction + OpDecorate %1356 NoContraction + OpDecorate %1357 NoContraction + OpDecorate %1358 NoContraction + OpDecorate %1364 NoContraction + OpDecorate %1365 NoContraction + OpDecorate %1366 NoContraction + OpDecorate %1367 NoContraction + OpDecorate %1368 NoContraction + OpDecorate %1369 NoContraction + OpDecorate %1370 NoContraction + OpDecorate %1371 NoContraction + OpDecorate %1372 NoContraction + OpDecorate %1373 NoContraction + OpDecorate %1374 NoContraction + OpDecorate %1375 NoContraction + OpDecorate %1380 NoContraction + OpDecorate %1381 NoContraction + OpDecorate %1382 NoContraction + OpDecorate %1383 NoContraction + OpDecorate %1384 NoContraction + OpDecorate %1389 NoContraction + OpDecorate %1404 NoContraction + OpDecorate %1472 NoContraction + OpDecorate %1477 NoContraction + OpDecorate %1478 NoContraction + OpDecorate %1479 NoContraction + OpDecorate %1480 NoContraction + OpDecorate %1481 NoContraction + OpDecorate %1482 NoContraction + OpDecorate %1483 NoContraction + OpDecorate %1484 NoContraction + OpDecorate %1485 NoContraction + OpDecorate %1486 NoContraction + OpDecorate %1487 NoContraction + OpDecorate %1488 NoContraction + OpDecorate %1489 NoContraction + OpDecorate %1490 NoContraction + OpDecorate %1491 NoContraction + OpDecorate %1492 NoContraction + OpDecorate %1497 NoContraction + OpDecorate %1514 NoContraction + OpDecorate %1518 NoContraction + OpDecorate %1521 NoContraction + OpDecorate %1522 NoContraction + OpDecorate %1523 NoContraction + OpDecorate %1524 NoContraction + OpDecorate %1525 NoContraction + OpDecorate %1526 NoContraction + OpDecorate %1527 NoContraction + OpDecorate %1528 NoContraction + OpDecorate %1529 NoContraction + OpDecorate %1530 NoContraction + OpDecorate %1531 NoContraction + OpDecorate %1534 NoContraction + OpDecorate %1535 NoContraction + OpDecorate %1536 NoContraction + OpDecorate %1538 NoContraction + OpDecorate %1539 NoContraction + OpDecorate %1541 NoContraction + OpDecorate %1542 NoContraction + OpDecorate %1543 NoContraction + OpDecorate %1552 NoContraction + OpDecorate %1553 NoContraction + OpDecorate %1554 NoContraction + OpDecorate %1555 NoContraction + OpDecorate %1556 NoContraction + OpDecorate %1557 NoContraction + OpDecorate %1558 NoContraction + OpDecorate %1564 NoContraction + OpDecorate %1565 NoContraction + OpDecorate %1566 NoContraction + OpDecorate %1567 NoContraction + OpDecorate %1568 NoContraction + OpDecorate %1569 NoContraction + OpDecorate %1570 NoContraction + OpDecorate %1571 NoContraction + OpDecorate %1572 NoContraction + OpDecorate %1573 NoContraction + OpDecorate %1579 NoContraction + OpDecorate %1580 NoContraction + OpDecorate %1581 NoContraction + OpDecorate %1582 NoContraction + OpDecorate %1583 NoContraction + OpDecorate %1584 NoContraction + OpDecorate %1585 NoContraction + OpDecorate %1586 NoContraction + OpDecorate %1587 NoContraction + OpDecorate %1588 NoContraction + OpDecorate %1589 NoContraction + OpDecorate %1590 NoContraction + OpDecorate %1595 NoContraction + OpDecorate %1596 NoContraction + OpDecorate %1597 NoContraction + OpDecorate %1598 NoContraction + OpDecorate %1599 NoContraction + OpDecorate %1604 NoContraction + OpDecorate %1619 NoContraction + OpDecorate %1686 NoContraction + OpDecorate %1691 NoContraction + OpDecorate %1692 NoContraction + OpDecorate %1693 NoContraction + OpDecorate %1694 NoContraction + OpDecorate %1695 NoContraction + OpDecorate %1696 NoContraction + OpDecorate %1697 NoContraction + OpDecorate %1698 NoContraction + OpDecorate %1699 NoContraction + OpDecorate %1700 NoContraction + OpDecorate %1701 NoContraction + OpDecorate %1702 NoContraction + OpDecorate %1703 NoContraction + OpDecorate %1704 NoContraction + OpDecorate %1705 NoContraction + OpDecorate %1706 NoContraction + OpDecorate %1711 NoContraction + OpDecorate %1728 NoContraction + OpDecorate %1732 NoContraction + OpDecorate %1735 NoContraction + OpDecorate %1736 NoContraction + OpDecorate %1737 NoContraction + OpDecorate %1738 NoContraction + OpDecorate %1739 NoContraction + OpDecorate %1740 NoContraction + OpDecorate %1741 NoContraction + OpDecorate %1742 NoContraction + OpDecorate %1743 NoContraction + OpDecorate %1744 NoContraction + OpDecorate %1745 NoContraction + OpDecorate %1748 NoContraction + OpDecorate %1749 NoContraction + OpDecorate %1750 NoContraction + OpDecorate %1752 NoContraction + OpDecorate %1753 NoContraction + OpDecorate %1755 NoContraction + OpDecorate %1756 NoContraction + OpDecorate %1757 NoContraction + OpDecorate %1766 NoContraction + OpDecorate %1767 NoContraction + OpDecorate %1768 NoContraction + OpDecorate %1769 NoContraction + OpDecorate %1770 NoContraction + OpDecorate %1771 NoContraction + OpDecorate %1772 NoContraction + OpDecorate %1778 NoContraction + OpDecorate %1779 NoContraction + OpDecorate %1780 NoContraction + OpDecorate %1781 NoContraction + OpDecorate %1782 NoContraction + OpDecorate %1783 NoContraction + OpDecorate %1784 NoContraction + OpDecorate %1785 NoContraction + OpDecorate %1786 NoContraction + OpDecorate %1787 NoContraction + OpDecorate %1793 NoContraction + OpDecorate %1794 NoContraction + OpDecorate %1795 NoContraction + OpDecorate %1796 NoContraction + OpDecorate %1797 NoContraction + OpDecorate %1798 NoContraction + OpDecorate %1799 NoContraction + OpDecorate %1800 NoContraction + OpDecorate %1801 NoContraction + OpDecorate %1802 NoContraction + OpDecorate %1803 NoContraction + OpDecorate %1804 NoContraction + OpDecorate %1809 NoContraction + OpDecorate %1810 NoContraction + OpDecorate %1811 NoContraction + OpDecorate %1812 NoContraction + OpDecorate %1813 NoContraction + OpDecorate %1818 NoContraction + OpDecorate %1833 NoContraction + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %uint_129 = OpConstant %uint 129 +%_arr_v2float_uint_129 = OpTypeArray %v2float %uint_129 + %18 = OpConstantNull %v2float +%float_0_00778198242 = OpConstant %float 0.00778198242 +%float_1_58020171en07 = OpConstant %float 1.58020171e-07 + %21 = OpConstantComposite %v2float %float_0_00778198242 %float_1_58020171en07 +%float_0_0155029297 = OpConstant %float 0.0155029297 +%float_1_25684846en06 = OpConstant %float 1.25684846e-06 + %24 = OpConstantComposite %v2float %float_0_0155029297 %float_1_25684846en06 +%float_0_0231628418 = OpConstant %float 0.0231628418 +%float_4_21748427en06 = OpConstant %float 4.21748427e-06 + %27 = OpConstantComposite %v2float %float_0_0231628418 %float_4_21748427en06 +%float_0_0307693481 = OpConstant %float 0.0307693481 +%float_2_31052218en06 = OpConstant %float 2.31052218e-06 + %30 = OpConstantComposite %v2float %float_0_0307693481 %float_2_31052218en06 +%float_0_0383148193 = OpConstant %float 0.0383148193 +%float_4_04496586en06 = OpConstant %float 4.04496586e-06 + %33 = OpConstantComposite %v2float %float_0_0383148193 %float_4_04496586en06 +%float_0_0458068848 = OpConstant %float 0.0458068848 +%float_2_6512655en06 = OpConstant %float 2.6512655e-06 + %36 = OpConstantComposite %v2float %float_0_0458068848 %float_2_6512655en06 +%float_0_053237915 = OpConstant %float 0.053237915 +%float_6_59947955en06 = OpConstant %float 6.59947955e-06 + %39 = OpConstantComposite %v2float %float_0_053237915 %float_6_59947955en06 +%float_0_0606231689 = OpConstant %float 0.0606231689 +%float_1_45287106en06 = OpConstant %float 1.45287106e-06 + %42 = OpConstantComposite %v2float %float_0_0606231689 %float_1_45287106en06 +%float_0_0679321289 = OpConstant %float 0.0679321289 +%float_1_85330009en05 = OpConstant %float 1.85330009e-05 + %45 = OpConstantComposite %v2float %float_0_0679321289 %float_1_85330009en05 +%float_0_0751953125 = OpConstant %float 0.0751953125 +%float_2_81087359en05 = OpConstant %float 2.81087359e-05 + %48 = OpConstantComposite %v2float %float_0_0751953125 %float_2_81087359en05 +%float_0_0824279785 = OpConstant %float 0.0824279785 +%float_1_56906954en05 = OpConstant %float 1.56906954e-05 + %51 = OpConstantComposite %v2float %float_0_0824279785 %float_1_56906954en05 +%float_0_0895996094 = OpConstant %float 0.0895996094 +%float_1_25493143en05 = OpConstant %float 1.25493143e-05 + %54 = OpConstantComposite %v2float %float_0_0895996094 %float_1_25493143en05 +%float_0_0967102051 = OpConstant %float 0.0967102051 +%float_1_9421379en05 = OpConstant %float 1.9421379e-05 + %57 = OpConstantComposite %v2float %float_0_0967102051 %float_1_9421379en05 +%float_0_103790283 = OpConstant %float 0.103790283 +%float_6_51047822en06 = OpConstant %float 6.51047822e-06 + %60 = OpConstantComposite %v2float %float_0_103790283 %float_6_51047822en06 +%float_0_110809326 = OpConstant %float 0.110809326 +%float_5_04016816en06 = OpConstant %float 5.04016816e-06 + %63 = OpConstantComposite %v2float %float_0_110809326 %float_5_04016816en06 +%float_0_117767334 = OpConstant %float 0.117767334 +%float_1_57016711en05 = OpConstant %float 1.57016711e-05 + %66 = OpConstantComposite %v2float %float_0_117767334 %float_1_57016711en05 +%float_0_124694824 = OpConstant %float 0.124694824 +%float_8_65428137en06 = OpConstant %float 8.65428137e-06 + %69 = OpConstantComposite %v2float %float_0_124694824 %float_8_65428137en06 +%float_0_131530762 = OpConstant %float 0.131530762 +%float_4_5596069en05 = OpConstant %float 4.5596069e-05 + %72 = OpConstantComposite %v2float %float_0_131530762 %float_4_5596069en05 +%float_0_138366699 = OpConstant %float 0.138366699 +%float_3_56236378en05 = OpConstant %float 3.56236378e-05 + %75 = OpConstantComposite %v2float %float_0_138366699 %float_3_56236378en05 +%float_0_145141602 = OpConstant %float 0.145141602 +%float_4_04082784en05 = OpConstant %float 4.04082784e-05 + %78 = OpConstantComposite %v2float %float_0_145141602 %float_4_04082784en05 +%float_0_151855469 = OpConstant %float 0.151855469 +%float_6_05732748en05 = OpConstant %float 6.05732748e-05 + %81 = OpConstantComposite %v2float %float_0_151855469 %float_6_05732748en05 +%float_0_158569336 = OpConstant %float 0.158569336 +%float_3_56942364en05 = OpConstant %float 3.56942364e-05 + %84 = OpConstantComposite %v2float %float_0_158569336 %float_3_56942364en05 +%float_0_165222168 = OpConstant %float 0.165222168 +%float_2_74049253en05 = OpConstant %float 2.74049253e-05 + %87 = OpConstantComposite %v2float %float_0_165222168 %float_2_74049253en05 +%float_0_171813965 = OpConstant %float 0.171813965 +%float_3_629208en05 = OpConstant %float 3.629208e-05 + %90 = OpConstantComposite %v2float %float_0_171813965 %float_3_629208en05 +%float_0_178405762 = OpConstant %float 0.178405762 +%float_1_89575405en06 = OpConstant %float 1.89575405e-06 + %93 = OpConstantComposite %v2float %float_0_178405762 %float_1_89575405en06 +%float_0_184875488 = OpConstant %float 0.184875488 +%float_4_68502112en05 = OpConstant %float 4.68502112e-05 + %96 = OpConstantComposite %v2float %float_0_184875488 %float_4_68502112en05 +%float_0_191345215 = OpConstant %float 0.191345215 +%float_4_96381545en05 = OpConstant %float 4.96381545e-05 + %99 = OpConstantComposite %v2float %float_0_191345215 %float_4_96381545en05 +%float_0_197814941 = OpConstant %float 0.197814941 +%float_1_08019231en05 = OpConstant %float 1.08019231e-05 + %102 = OpConstantComposite %v2float %float_0_197814941 %float_1_08019231en05 +%float_0_204162598 = OpConstant %float 0.204162598 +%float_5_29437712en05 = OpConstant %float 5.29437712e-05 + %105 = OpConstantComposite %v2float %float_0_204162598 %float_5_29437712en05 +%float_0_210510254 = OpConstant %float 0.210510254 +%float_5_45151997en05 = OpConstant %float 5.45151997e-05 + %108 = OpConstantComposite %v2float %float_0_210510254 %float_5_45151997en05 +%float_0_21685791 = OpConstant %float 0.21685791 +%float_1_60281434en05 = OpConstant %float 1.60281434e-05 + %111 = OpConstantComposite %v2float %float_0_21685791 %float_1_60281434en05 +%float_0_223083496 = OpConstant %float 0.223083496 +%float_6_00552194en05 = OpConstant %float 6.00552194e-05 + %114 = OpConstantComposite %v2float %float_0_223083496 %float_6_00552194en05 +%float_0_229370117 = OpConstant %float 0.229370117 +%float_3_98387692en06 = OpConstant %float 3.98387692e-06 + %117 = OpConstantComposite %v2float %float_0_229370117 %float_3_98387692en06 +%float_0_235534668 = OpConstant %float 0.235534668 +%float_3_14033423en05 = OpConstant %float 3.14033423e-05 + %120 = OpConstantComposite %v2float %float_0_235534668 %float_3_14033423en05 +%float_0_241699219 = OpConstant %float 0.241699219 +%float_2_07181365en05 = OpConstant %float 2.07181365e-05 + %123 = OpConstantComposite %v2float %float_0_241699219 %float_2_07181365en05 +%float_0_247802734 = OpConstant %float 0.247802734 +%float_3_34295291en05 = OpConstant %float 3.34295291e-05 + %126 = OpConstantComposite %v2float %float_0_247802734 %float_3_34295291en05 +%float_0_25390625 = OpConstant %float 0.25390625 +%float_8_95998073en06 = OpConstant %float 8.95998073e-06 + %129 = OpConstantComposite %v2float %float_0_25390625 %float_8_95998073en06 +%float_0_259887695 = OpConstant %float 0.259887695 +%float_6_98291187en05 = OpConstant %float 6.98291187e-05 + %132 = OpConstantComposite %v2float %float_0_259887695 %float_6_98291187en05 +%float_0_265869141 = OpConstant %float 0.265869141 +%float_9_44078711en05 = OpConstant %float 9.44078711e-05 + %135 = OpConstantComposite %v2float %float_0_265869141 %float_9_44078711en05 +%float_0_271850586 = OpConstant %float 0.271850586 +%float_8_31295401en05 = OpConstant %float 8.31295401e-05 + %138 = OpConstantComposite %v2float %float_0_271850586 %float_8_31295401en05 +%float_0_277832031 = OpConstant %float 0.277832031 +%float_3_64197513en05 = OpConstant %float 3.64197513e-05 + %141 = OpConstantComposite %v2float %float_0_277832031 %float_3_64197513en05 +%float_0_283691406 = OpConstant %float 0.283691406 +%float_7_67668753en05 = OpConstant %float 7.67668753e-05 + %144 = OpConstantComposite %v2float %float_0_283691406 %float_7_67668753en05 +%float_0_289550781 = OpConstant %float 0.289550781 +%float_8_25113311en05 = OpConstant %float 8.25113311e-05 + %147 = OpConstantComposite %v2float %float_0_289550781 %float_8_25113311en05 +%float_0_295410156 = OpConstant %float 0.295410156 +%float_5_40566434en05 = OpConstant %float 5.40566434e-05 + %150 = OpConstantComposite %v2float %float_0_295410156 %float_5_40566434en05 +%float_0_301147461 = OpConstant %float 0.301147461 +%float_0_000113869639 = OpConstant %float 0.000113869639 + %153 = OpConstantComposite %v2float %float_0_301147461 %float_0_000113869639 +%float_0_307006836 = OpConstant %float 0.307006836 +%float_1_81993564en05 = OpConstant %float 1.81993564e-05 + %156 = OpConstantComposite %v2float %float_0_307006836 %float_1_81993564en05 +%float_0_312744141 = OpConstant %float 0.312744141 +%float_1_15693783en05 = OpConstant %float 1.15693783e-05 + %159 = OpConstantComposite %v2float %float_0_312744141 %float_1_15693783en05 +%float_0_318359375 = OpConstant %float 0.318359375 +%float_9_43561172en05 = OpConstant %float 9.43561172e-05 + %162 = OpConstantComposite %v2float %float_0_318359375 %float_9_43561172en05 +%float_0_32409668 = OpConstant %float 0.32409668 +%float_2_2788965en05 = OpConstant %float 2.2788965e-05 + %165 = OpConstantComposite %v2float %float_0_32409668 %float_2_2788965en05 +%float_0_329711914 = OpConstant %float 0.329711914 +%float_4_13723064en05 = OpConstant %float 4.13723064e-05 + %168 = OpConstantComposite %v2float %float_0_329711914 %float_4_13723064en05 +%float_0_335327148 = OpConstant %float 0.335327148 +%float_2_83934824en05 = OpConstant %float 2.83934824e-05 + %171 = OpConstantComposite %v2float %float_0_335327148 %float_2_83934824en05 +%float_0_340820312 = OpConstant %float 0.340820312 +%float_0_00010627447 = OpConstant %float 0.00010627447 + %174 = OpConstantComposite %v2float %float_0_340820312 %float_0_00010627447 +%float_0_346435547 = OpConstant %float 0.346435547 +%float_3_12204684en05 = OpConstant %float 3.12204684e-05 + %177 = OpConstantComposite %v2float %float_0_346435547 %float_3_12204684en05 +%float_0_351928711 = OpConstant %float 0.351928711 +%float_4_77122194en05 = OpConstant %float 4.77122194e-05 + %180 = OpConstantComposite %v2float %float_0_351928711 %float_4_77122194en05 +%float_0_357421875 = OpConstant %float 0.357421875 +%float_3_40139195en05 = OpConstant %float 3.40139195e-05 + %183 = OpConstantComposite %v2float %float_0_357421875 %float_3_40139195en05 +%float_0_362792969 = OpConstant %float 0.362792969 +%float_0_000112524933 = OpConstant %float 0.000112524933 + %186 = OpConstantComposite %v2float %float_0_362792969 %float_0_000112524933 +%float_0_368286133 = OpConstant %float 0.368286133 +%float_3_94283452en05 = OpConstant %float 3.94283452e-05 + %189 = OpConstantComposite %v2float %float_0_368286133 %float_3_94283452en05 +%float_0_373657227 = OpConstant %float 0.373657227 +%float_5_91832286en05 = OpConstant %float 5.91832286e-05 + %192 = OpConstantComposite %v2float %float_0_373657227 %float_5_91832286en05 +%float_0_37902832 = OpConstant %float 0.37902832 +%float_5_00326205en05 = OpConstant %float 5.00326205e-05 + %195 = OpConstantComposite %v2float %float_0_37902832 %float_5_00326205en05 +%float_0_384399414 = OpConstant %float 0.384399414 +%float_1_22848478en05 = OpConstant %float 1.22848478e-05 + %198 = OpConstantComposite %v2float %float_0_384399414 %float_1_22848478en05 +%float_0_389648438 = OpConstant %float 0.389648438 +%float_6_83136386en05 = OpConstant %float 6.83136386e-05 + %201 = OpConstantComposite %v2float %float_0_389648438 %float_6_83136386en05 +%float_0_394897461 = OpConstant %float 0.394897461 +%float_9_63472994en05 = OpConstant %float 9.63472994e-05 + %204 = OpConstantComposite %v2float %float_0_394897461 %float_9_63472994en05 +%float_0_400146484 = OpConstant %float 0.400146484 +%float_9_66797452en05 = OpConstant %float 9.66797452e-05 + %207 = OpConstantComposite %v2float %float_0_400146484 %float_9_66797452en05 +%float_0_405395508 = OpConstant %float 0.405395508 +%float_6_96002899en05 = OpConstant %float 6.96002899e-05 + %210 = OpConstantComposite %v2float %float_0_405395508 %float_6_96002899en05 +%float_0_410644531 = OpConstant %float 0.410644531 +%float_1_53937344en05 = OpConstant %float 1.53937344e-05 + %213 = OpConstantComposite %v2float %float_0_410644531 %float_1_53937344en05 +%float_0_415771484 = OpConstant %float 0.415771484 +%float_5_64107686en05 = OpConstant %float 5.64107686e-05 + %216 = OpConstantComposite %v2float %float_0_415771484 %float_5_64107686en05 +%float_0_420898438 = OpConstant %float 0.420898438 +%float_7_08571388en05 = OpConstant %float 7.08571388e-05 + %219 = OpConstantComposite %v2float %float_0_420898438 %float_7_08571388en05 +%float_0_426025391 = OpConstant %float 0.426025391 +%float_5_90046839en05 = OpConstant %float 5.90046839e-05 + %222 = OpConstantComposite %v2float %float_0_426025391 %float_5_90046839en05 +%float_0_431152344 = OpConstant %float 0.431152344 +%float_2_11210681en05 = OpConstant %float 2.11210681e-05 + %225 = OpConstantComposite %v2float %float_0_431152344 %float_2_11210681en05 +%float_0_436157227 = OpConstant %float 0.436157227 +%float_7_95402084en05 = OpConstant %float 7.95402084e-05 + %228 = OpConstantComposite %v2float %float_0_436157227 %float_7_95402084en05 +%float_0_441162109 = OpConstant %float 0.441162109 +%float_0_000112451424 = OpConstant %float 0.000112451424 + %231 = OpConstantComposite %v2float %float_0_441162109 %float_0_000112451424 +%float_0_446166992 = OpConstant %float 0.446166992 +%float_0_000120110439 = OpConstant %float 0.000120110439 + %234 = OpConstantComposite %v2float %float_0_446166992 %float_0_000120110439 +%float_0_451171875 = OpConstant %float 0.451171875 +%float_0_000102769132 = OpConstant %float 0.000102769132 + %237 = OpConstantComposite %v2float %float_0_451171875 %float_0_000102769132 +%float_0_456176758 = OpConstant %float 0.456176758 +%float_6_06756657en05 = OpConstant %float 6.06756657e-05 + %240 = OpConstantComposite %v2float %float_0_456176758 %float_6_06756657en05 +%float_0_46105957 = OpConstant %float 0.46105957 +%float_0_000116144809 = OpConstant %float 0.000116144809 + %243 = OpConstantComposite %v2float %float_0_46105957 %float_0_000116144809 +%float_0_466064453 = OpConstant %float 0.466064453 +%float_2_52767986en05 = OpConstant %float 2.52767986e-05 + %246 = OpConstantComposite %v2float %float_0_466064453 %float_2_52767986en05 +%float_0_470947266 = OpConstant %float 0.470947266 +%float_3_24495923en05 = OpConstant %float 3.24495923e-05 + %249 = OpConstantComposite %v2float %float_0_470947266 %float_3_24495923en05 +%float_0_475830078 = OpConstant %float 0.475830078 +%float_1_58267449en05 = OpConstant %float 1.58267449e-05 + %252 = OpConstantComposite %v2float %float_0_475830078 %float_1_58267449en05 +%float_0_48059082 = OpConstant %float 0.48059082 +%float_9_77090313en05 = OpConstant %float 9.77090313e-05 + %255 = OpConstantComposite %v2float %float_0_48059082 %float_9_77090313en05 +%float_0_485473633 = OpConstant %float 0.485473633 +%float_3_41829691en05 = OpConstant %float 3.41829691e-05 + %258 = OpConstantComposite %v2float %float_0_485473633 %float_3_41829691en05 +%float_0_490234375 = OpConstant %float 0.490234375 +%float_6_96130446en05 = OpConstant %float 6.96130446e-05 + %261 = OpConstantComposite %v2float %float_0_490234375 %float_6_96130446en05 +%float_0_494995117 = OpConstant %float 0.494995117 +%float_8_21496069en05 = OpConstant %float 8.21496069e-05 + %264 = OpConstantComposite %v2float %float_0_494995117 %float_8_21496069en05 +%float_0_499755859 = OpConstant %float 0.499755859 +%float_7_20101743en05 = OpConstant %float 7.20101743e-05 + %267 = OpConstantComposite %v2float %float_0_499755859 %float_7_20101743en05 +%float_0_504394531 = OpConstant %float 0.504394531 +%float_0_000161479489 = OpConstant %float 0.000161479489 + %270 = OpConstantComposite %v2float %float_0_504394531 %float_0_000161479489 +%float_0_509033203 = OpConstant %float 0.509033203 +%float_0_000228698656 = OpConstant %float 0.000228698656 + %273 = OpConstantComposite %v2float %float_0_509033203 %float_0_000228698656 +%float_0_513916016 = OpConstant %float 0.513916016 +%float_2_97354763en05 = OpConstant %float 2.97354763e-05 + %276 = OpConstantComposite %v2float %float_0_513916016 %float_2_97354763en05 +%float_0_518554688 = OpConstant %float 0.518554688 +%float_5_30767065en05 = OpConstant %float 5.30767065e-05 + %279 = OpConstantComposite %v2float %float_0_518554688 %float_5_30767065en05 +%float_0_523193359 = OpConstant %float 0.523193359 +%float_5_47843883en05 = OpConstant %float 5.47843883e-05 + %282 = OpConstantComposite %v2float %float_0_523193359 %float_5_47843883en05 +%float_0_527832031 = OpConstant %float 0.527832031 +%float_3_50583687en05 = OpConstant %float 3.50583687e-05 + %285 = OpConstantComposite %v2float %float_0_527832031 %float_3_50583687en05 +%float_0_532226562 = OpConstant %float 0.532226562 +%float_0_00023823636 = OpConstant %float 0.00023823636 + %288 = OpConstantComposite %v2float %float_0_532226562 %float_0_00023823636 +%float_0_536865234 = OpConstant %float 0.536865234 +%float_0_000176231508 = OpConstant %float 0.000176231508 + %291 = OpConstantComposite %v2float %float_0_536865234 %float_0_000176231508 +%float_0_541503906 = OpConstant %float 0.541503906 +%float_9_33761767en05 = OpConstant %float 9.33761767e-05 + %294 = OpConstantComposite %v2float %float_0_541503906 %float_9_33761767en05 +%float_0_545898438 = OpConstant %float 0.545898438 +%float_0_000234000094 = OpConstant %float 0.000234000094 + %297 = OpConstantComposite %v2float %float_0_545898438 %float_0_000234000094 +%float_0_550537109 = OpConstant %float 0.550537109 +%float_0_000110008572 = OpConstant %float 0.000110008572 + %300 = OpConstantComposite %v2float %float_0_550537109 %float_0_000110008572 +%float_0_554931641 = OpConstant %float 0.554931641 +%float_0_000209866907 = OpConstant %float 0.000209866907 + %303 = OpConstantComposite %v2float %float_0_554931641 %float_0_000209866907 +%float_0_559570312 = OpConstant %float 0.559570312 +%float_4_54754336en05 = OpConstant %float 4.54754336e-05 + %306 = OpConstantComposite %v2float %float_0_559570312 %float_4_54754336en05 +%float_0_563964844 = OpConstant %float 0.563964844 +%float_0_00010529453 = OpConstant %float 0.00010529453 + %309 = OpConstantComposite %v2float %float_0_563964844 %float_0_00010529453 +%float_0_568359375 = OpConstant %float 0.568359375 +%float_0_000145360347 = OpConstant %float 0.000145360347 + %312 = OpConstantComposite %v2float %float_0_568359375 %float_0_000145360347 +%float_0_572753906 = OpConstant %float 0.572753906 +%float_0_000165847305 = OpConstant %float 0.000165847305 + %315 = OpConstantComposite %v2float %float_0_572753906 %float_0_000165847305 +%float_0_577148438 = OpConstant %float 0.577148438 +%float_0_000166927523 = OpConstant %float 0.000166927523 + %318 = OpConstantComposite %v2float %float_0_577148438 %float_0_000166927523 +%float_0_581542969 = OpConstant %float 0.581542969 +%float_0_00014877088 = OpConstant %float 0.00014877088 + %321 = OpConstantComposite %v2float %float_0_581542969 %float_0_00014877088 +%float_0_5859375 = OpConstant %float 0.5859375 +%float_0_000111545 = OpConstant %float 0.000111545 + %324 = OpConstantComposite %v2float %float_0_5859375 %float_0_000111545 +%float_0_590332031 = OpConstant %float 0.590332031 +%float_5_54153521en05 = OpConstant %float 5.54153521e-05 + %327 = OpConstantComposite %v2float %float_0_590332031 %float_5_54153521en05 +%float_0_594482422 = OpConstant %float 0.594482422 +%float_0_000224685864 = OpConstant %float 0.000224685864 + %330 = OpConstantComposite %v2float %float_0_594482422 %float_0_000224685864 +%float_0_598876953 = OpConstant %float 0.598876953 +%float_0_00013123652 = OpConstant %float 0.00013123652 + %333 = OpConstantComposite %v2float %float_0_598876953 %float_0_00013123652 +%float_0_603271484 = OpConstant %float 0.603271484 +%float_1_93670621en05 = OpConstant %float 1.93670621e-05 + %336 = OpConstantComposite %v2float %float_0_603271484 %float_1_93670621en05 +%float_0_607421875 = OpConstant %float 0.607421875 +%float_0_000133375215 = OpConstant %float 0.000133375215 + %339 = OpConstantComposite %v2float %float_0_607421875 %float_0_000133375215 +%float_0_611572266 = OpConstant %float 0.611572266 +%float_0_00022927548 = OpConstant %float 0.00022927548 + %342 = OpConstantComposite %v2float %float_0_611572266 %float_0_00022927548 +%float_0_615966797 = OpConstant %float 0.615966797 +%float_6_30803333en05 = OpConstant %float 6.30803333e-05 + %345 = OpConstantComposite %v2float %float_0_615966797 %float_6_30803333en05 +%float_0_620117188 = OpConstant %float 0.620117188 +%float_0_000123222242 = OpConstant %float 0.000123222242 + %348 = OpConstantComposite %v2float %float_0_620117188 %float_0_000123222242 +%float_0_624267578 = OpConstant %float 0.624267578 +%float_0_000165709876 = OpConstant %float 0.000165709876 + %351 = OpConstantComposite %v2float %float_0_624267578 %float_0_000165709876 +%float_0_628417969 = OpConstant %float 0.628417969 +%float_0_000190690669 = OpConstant %float 0.000190690669 + %354 = OpConstantComposite %v2float %float_0_628417969 %float_0_000190690669 +%float_0_632568359 = OpConstant %float 0.632568359 +%float_0_000198310183 = OpConstant %float 0.000198310183 + %357 = OpConstantComposite %v2float %float_0_632568359 %float_0_000198310183 +%float_0_63671875 = OpConstant %float 0.63671875 +%float_0_000188712234 = OpConstant %float 0.000188712234 + %360 = OpConstantComposite %v2float %float_0_63671875 %float_0_000188712234 +%float_0_640869141 = OpConstant %float 0.640869141 +%float_0_000162038792 = OpConstant %float 0.000162038792 + %363 = OpConstantComposite %v2float %float_0_640869141 %float_0_000162038792 +%float_0_645019531 = OpConstant %float 0.645019531 +%float_0_000118430122 = OpConstant %float 0.000118430122 + %366 = OpConstantComposite %v2float %float_0_645019531 %float_0_000118430122 +%float_0_649169922 = OpConstant %float 0.649169922 +%float_5_8024747en05 = OpConstant %float 5.8024747e-05 + %369 = OpConstantComposite %v2float %float_0_649169922 %float_5_8024747en05 +%float_0_653076172 = OpConstant %float 0.653076172 +%float_0_000225100128 = OpConstant %float 0.000225100128 + %372 = OpConstantComposite %v2float %float_0_653076172 %float_0_000225100128 +%float_0_657226562 = OpConstant %float 0.657226562 +%float_0_000131510198 = OpConstant %float 0.000131510198 + %375 = OpConstantComposite %v2float %float_0_657226562 %float_0_000131510198 +%float_0_661376953 = OpConstant %float 0.661376953 +%float_2_15291202en05 = OpConstant %float 2.15291202e-05 + %378 = OpConstantComposite %v2float %float_0_661376953 %float_2_15291202en05 +%float_0_665283203 = OpConstant %float 0.665283203 +%float_0_000139429409 = OpConstant %float 0.000139429409 + %381 = OpConstantComposite %v2float %float_0_665283203 %float_0_000139429409 +%float_0_669189453 = OpConstant %float 0.669189453 +%float_0_000241200803 = OpConstant %float 0.000241200803 + %384 = OpConstantComposite %v2float %float_0_669189453 %float_0_000241200803 +%float_0_673339844 = OpConstant %float 0.673339844 +%float_8_28314587en05 = OpConstant %float 8.28314587e-05 + %387 = OpConstantComposite %v2float %float_0_673339844 %float_8_28314587en05 +%float_0_677246094 = OpConstant %float 0.677246094 +%float_0_00015272983 = OpConstant %float 0.00015272983 + %390 = OpConstantComposite %v2float %float_0_677246094 %float_0_00015272983 +%float_0_681152344 = OpConstant %float 0.681152344 +%float_0_000206881057 = OpConstant %float 0.000206881057 + %393 = OpConstantComposite %v2float %float_0_681152344 %float_0_000206881057 +%float_0_685302734 = OpConstant %float 0.685302734 +%float_1_26872385en06 = OpConstant %float 1.26872385e-06 + %396 = OpConstantComposite %v2float %float_0_685302734 %float_1_26872385en06 +%float_0_689208984 = OpConstant %float 0.689208984 +%float_2_42968636en05 = OpConstant %float 2.42968636e-05 + %399 = OpConstantComposite %v2float %float_0_689208984 %float_2_42968636en05 +%float_0_693115234 = OpConstant %float 0.693115234 +%float_3_19461833en05 = OpConstant %float 3.19461833e-05 + %402 = OpConstantComposite %v2float %float_0_693115234 %float_3_19461833en05 + %403 = OpConstantComposite %_arr_v2float_uint_129 %18 %21 %24 %27 %30 %33 %36 %39 %42 %45 %48 %51 %54 %57 %60 %63 %66 %69 %72 %75 %78 %81 %84 %87 %90 %93 %96 %99 %102 %105 %108 %111 %114 %117 %120 %123 %126 %129 %132 %135 %138 %141 %144 %147 %150 %153 %156 %159 %162 %165 %168 %171 %174 %177 %180 %183 %186 %189 %192 %195 %198 %201 %204 %207 %210 %213 %216 %219 %222 %225 %228 %231 %234 %237 %240 %243 %246 %249 %252 %255 %258 %261 %264 %267 %270 %273 %276 %279 %282 %285 %288 %291 %294 %297 %300 %303 %306 %309 %312 %315 %318 %321 %324 %327 %330 %333 %336 %339 %342 %345 %348 %351 %354 %357 %360 %363 %366 %369 %372 %375 %378 %381 %384 %387 %390 %393 %396 %399 %402 +%_ptr_Private__arr_v2float_uint_129 = OpTypePointer Private %_arr_v2float_uint_129 + %float_2 = OpConstant %float 2 + %float_0 = OpConstant %float 0 + %408 = OpConstantComposite %v2float %float_2 %float_0 +%float_1_984375 = OpConstant %float 1.984375 +%float_0_000121124031 = OpConstant %float 0.000121124031 + %411 = OpConstantComposite %v2float %float_1_984375 %float_0_000121124031 +%float_1_96875 = OpConstant %float 1.96875 +%float_0_000480769231 = OpConstant %float 0.000480769231 + %414 = OpConstantComposite %v2float %float_1_96875 %float_0_000480769231 +%float_1_953125 = OpConstant %float 1.953125 +%float_0_00107347325 = OpConstant %float 0.00107347325 + %417 = OpConstantComposite %v2float %float_1_953125 %float_0_00107347325 +%float_1_9375 = OpConstant %float 1.9375 +%float_0_00189393945 = OpConstant %float 0.00189393945 + %420 = OpConstantComposite %v2float %float_1_9375 %float_0_00189393945 +%float_1_921875 = OpConstant %float 1.921875 +%float_0_00293703005 = OpConstant %float 0.00293703005 + %423 = OpConstantComposite %v2float %float_1_921875 %float_0_00293703005 +%float_1_90625 = OpConstant %float 1.90625 +%float_0_00419776142 = OpConstant %float 0.00419776142 + %426 = OpConstantComposite %v2float %float_1_90625 %float_0_00419776142 +%float_1_890625 = OpConstant %float 1.890625 +%float_0_00567129627 = OpConstant %float 0.00567129627 + %429 = OpConstantComposite %v2float %float_1_890625 %float_0_00567129627 +%float_1_875 = OpConstant %float 1.875 +%float_0_0073529412 = OpConstant %float 0.0073529412 + %432 = OpConstantComposite %v2float %float_1_875 %float_0_0073529412 +%float_1_8671875 = OpConstant %float 1.8671875 +%float_0_00142563868 = OpConstant %float 0.00142563868 + %435 = OpConstantComposite %v2float %float_1_8671875 %float_0_00142563868 +%float_1_8515625 = OpConstant %float 1.8515625 +%float_0_00350996386 = OpConstant %float 0.00350996386 + %438 = OpConstantComposite %v2float %float_1_8515625 %float_0_00350996386 +%float_1_8359375 = OpConstant %float 1.8359375 +%float_0_00578911882 = OpConstant %float 0.00578911882 + %441 = OpConstantComposite %v2float %float_1_8359375 %float_0_00578911882 +%float_1_828125 = OpConstant %float 1.828125 +%float_0_000446428574 = OpConstant %float 0.000446428574 + %444 = OpConstantComposite %v2float %float_1_828125 %float_0_000446428574 +%float_1_8125 = OpConstant %float 1.8125 +%float_0_0031028369 = OpConstant %float 0.0031028369 + %447 = OpConstantComposite %v2float %float_1_8125 %float_0_0031028369 +%float_1_796875 = OpConstant %float 1.796875 +%float_0_00594190136 = OpConstant %float 0.00594190136 + %450 = OpConstantComposite %v2float %float_1_796875 %float_0_00594190136 +%float_1_7890625 = OpConstant %float 1.7890625 +%float_0_00114729023 = OpConstant %float 0.00114729023 + %453 = OpConstantComposite %v2float %float_1_7890625 %float_0_00114729023 +%float_1_7734375 = OpConstant %float 1.7734375 +%float_0_00434027798 = OpConstant %float 0.00434027798 + %456 = OpConstantComposite %v2float %float_1_7734375 %float_0_00434027798 +%float_1_7578125 = OpConstant %float 1.7578125 +%float_0_00770474132 = OpConstant %float 0.00770474132 + %459 = OpConstantComposite %v2float %float_1_7578125 %float_0_00770474132 + %float_1_75 = OpConstant %float 1.75 +%float_0_00342465751 = OpConstant %float 0.00342465751 + %462 = OpConstantComposite %v2float %float_1_75 %float_0_00342465751 +%float_1_734375 = OpConstant %float 1.734375 +%float_0_00712159881 = OpConstant %float 0.00712159881 + %465 = OpConstantComposite %v2float %float_1_734375 %float_0_00712159881 +%float_1_7265625 = OpConstant %float 1.7265625 +%float_0_0031672297 = OpConstant %float 0.0031672297 + %468 = OpConstantComposite %v2float %float_1_7265625 %float_0_0031672297 +%float_1_7109375 = OpConstant %float 1.7109375 +%float_0_00718330545 = OpConstant %float 0.00718330545 + %471 = OpConstantComposite %v2float %float_1_7109375 %float_0_00718330545 +%float_1_703125 = OpConstant %float 1.703125 +%float_0_00354166678 = OpConstant %float 0.00354166678 + %474 = OpConstantComposite %v2float %float_1_703125 %float_0_00354166678 +%float_1_6953125 = OpConstant %float 1.6953125 +%float_5_17384105en05 = OpConstant %float 5.17384105e-05 + %477 = OpConstantComposite %v2float %float_1_6953125 %float_5_17384105en05 +%float_1_6796875 = OpConstant %float 1.6796875 +%float_0_00452302629 = OpConstant %float 0.00452302629 + %480 = OpConstantComposite %v2float %float_1_6796875 %float_0_00452302629 +%float_1_671875 = OpConstant %float 1.671875 +%float_0_00132761442 = OpConstant %float 0.00132761442 + %483 = OpConstantComposite %v2float %float_1_671875 %float_0_00132761442 +%float_1_65625 = OpConstant %float 1.65625 +%float_0_00608766219 = OpConstant %float 0.00608766219 + %486 = OpConstantComposite %v2float %float_1_65625 %float_0_00608766219 +%float_1_6484375 = OpConstant %float 1.6484375 +%float_0_00317540322 = OpConstant %float 0.00317540322 + %489 = OpConstantComposite %v2float %float_1_6484375 %float_0_00317540322 +%float_1_640625 = OpConstant %float 1.640625 +%float_0_000400641031 = OpConstant %float 0.000400641031 + %492 = OpConstantComposite %v2float %float_1_640625 %float_0_000400641031 +%float_1_625 = OpConstant %float 1.625 +%float_0_00557324849 = OpConstant %float 0.00557324849 + %495 = OpConstantComposite %v2float %float_1_625 %float_0_00557324849 +%float_1_6171875 = OpConstant %float 1.6171875 +%float_0_00306566455 = OpConstant %float 0.00306566455 + %498 = OpConstantComposite %v2float %float_1_6171875 %float_0_00306566455 +%float_1_609375 = OpConstant %float 1.609375 +%float_0_000687893073 = OpConstant %float 0.000687893073 + %501 = OpConstantComposite %v2float %float_1_609375 %float_0_000687893073 +%float_1_59375 = OpConstant %float 1.59375 +%float_0_00625000009 = OpConstant %float 0.00625000009 + %504 = OpConstantComposite %v2float %float_1_59375 %float_0_00625000009 +%float_1_5859375 = OpConstant %float 1.5859375 +%float_0_00412461162 = OpConstant %float 0.00412461162 + %507 = OpConstantComposite %v2float %float_1_5859375 %float_0_00412461162 +%float_1_578125 = OpConstant %float 1.578125 +%float_0_00212191348 = OpConstant %float 0.00212191348 + %510 = OpConstantComposite %v2float %float_1_578125 %float_0_00212191348 +%float_1_5703125 = OpConstant %float 1.5703125 +%float_0_000239647241 = OpConstant %float 0.000239647241 + %513 = OpConstantComposite %v2float %float_1_5703125 %float_0_000239647241 +%float_1_5546875 = OpConstant %float 1.5546875 +%float_0_00628810981 = OpConstant %float 0.00628810981 + %516 = OpConstantComposite %v2float %float_1_5546875 %float_0_00628810981 +%float_1_546875 = OpConstant %float 1.546875 +%float_0_00464015175 = OpConstant %float 0.00464015175 + %519 = OpConstantComposite %v2float %float_1_546875 %float_0_00464015175 +%float_1_5390625 = OpConstant %float 1.5390625 +%float_0_00310617476 = OpConstant %float 0.00310617476 + %522 = OpConstantComposite %v2float %float_1_5390625 %float_0_00310617476 +%float_1_53125 = OpConstant %float 1.53125 +%float_0_00168413168 = OpConstant %float 0.00168413168 + %525 = OpConstantComposite %v2float %float_1_53125 %float_0_00168413168 +%float_1_5234375 = OpConstant %float 1.5234375 +%float_0_000372023816 = OpConstant %float 0.000372023816 + %528 = OpConstantComposite %v2float %float_1_5234375 %float_0_000372023816 +%float_1_5078125 = OpConstant %float 1.5078125 +%float_0_0069803996 = OpConstant %float 0.0069803996 + %531 = OpConstantComposite %v2float %float_1_5078125 %float_0_0069803996 + %float_1_5 = OpConstant %float 1.5 +%float_0_00588235306 = OpConstant %float 0.00588235306 + %534 = OpConstantComposite %v2float %float_1_5 %float_0_00588235306 +%float_1_4921875 = OpConstant %float 1.4921875 +%float_0_00488852337 = OpConstant %float 0.00488852337 + %537 = OpConstantComposite %v2float %float_1_4921875 %float_0_00488852337 +%float_1_484375 = OpConstant %float 1.484375 +%float_0_00399709307 = OpConstant %float 0.00399709307 + %540 = OpConstantComposite %v2float %float_1_484375 %float_0_00399709307 +%float_1_4765625 = OpConstant %float 1.4765625 +%float_0_00320628611 = OpConstant %float 0.00320628611 + %543 = OpConstantComposite %v2float %float_1_4765625 %float_0_00320628611 +%float_1_46875 = OpConstant %float 1.46875 +%float_0_00251436792 = OpConstant %float 0.00251436792 + %546 = OpConstantComposite %v2float %float_1_46875 %float_0_00251436792 +%float_1_4609375 = OpConstant %float 1.4609375 +%float_0_00191964291 = OpConstant %float 0.00191964291 + %549 = OpConstantComposite %v2float %float_1_4609375 %float_0_00191964291 +%float_1_453125 = OpConstant %float 1.453125 +%float_0_00142045459 = OpConstant %float 0.00142045459 + %552 = OpConstantComposite %v2float %float_1_453125 %float_0_00142045459 +%float_1_4453125 = OpConstant %float 1.4453125 +%float_0_00101518363 = OpConstant %float 0.00101518363 + %555 = OpConstantComposite %v2float %float_1_4453125 %float_0_00101518363 +%float_1_4375 = OpConstant %float 1.4375 +%float_0_000702247198 = OpConstant %float 0.000702247198 + %558 = OpConstantComposite %v2float %float_1_4375 %float_0_000702247198 +%float_1_4296875 = OpConstant %float 1.4296875 +%float_0_000480097777 = OpConstant %float 0.000480097777 + %561 = OpConstantComposite %v2float %float_1_4296875 %float_0_000480097777 +%float_1_421875 = OpConstant %float 1.421875 +%float_0_000347222231 = OpConstant %float 0.000347222231 + %564 = OpConstantComposite %v2float %float_1_421875 %float_0_000347222231 +%float_1_4140625 = OpConstant %float 1.4140625 +%float_0_000302140892 = OpConstant %float 0.000302140892 + %567 = OpConstantComposite %v2float %float_1_4140625 %float_0_000302140892 +%float_1_40625 = OpConstant %float 1.40625 +%float_0_000343406602 = OpConstant %float 0.000343406602 + %570 = OpConstantComposite %v2float %float_1_40625 %float_0_000343406602 +%float_1_3984375 = OpConstant %float 1.3984375 +%float_0_000469603838 = OpConstant %float 0.000469603838 + %573 = OpConstantComposite %v2float %float_1_3984375 %float_0_000469603838 +%float_1_390625 = OpConstant %float 1.390625 +%float_0_000679347839 = OpConstant %float 0.000679347839 + %576 = OpConstantComposite %v2float %float_1_390625 %float_0_000679347839 +%float_1_3828125 = OpConstant %float 1.3828125 +%float_0_000971283764 = OpConstant %float 0.000971283764 + %579 = OpConstantComposite %v2float %float_1_3828125 %float_0_000971283764 +%float_1_375 = OpConstant %float 1.375 +%float_0_00134408602 = OpConstant %float 0.00134408602 + %582 = OpConstantComposite %v2float %float_1_375 %float_0_00134408602 +%float_1_3671875 = OpConstant %float 1.3671875 +%float_0_00179645722 = OpConstant %float 0.00179645722 + %585 = OpConstantComposite %v2float %float_1_3671875 %float_0_00179645722 +%float_1_359375 = OpConstant %float 1.359375 +%float_0_00232712761 = OpConstant %float 0.00232712761 + %588 = OpConstantComposite %v2float %float_1_359375 %float_0_00232712761 +%float_1_3515625 = OpConstant %float 1.3515625 +%float_0_00293485448 = OpConstant %float 0.00293485448 + %591 = OpConstantComposite %v2float %float_1_3515625 %float_0_00293485448 +%float_1_34375 = OpConstant %float 1.34375 +%float_0_00361842103 = OpConstant %float 0.00361842103 + %594 = OpConstantComposite %v2float %float_1_34375 %float_0_00361842103 +%float_1_3359375 = OpConstant %float 1.3359375 +%float_0_00437663635 = OpConstant %float 0.00437663635 + %597 = OpConstantComposite %v2float %float_1_3359375 %float_0_00437663635 +%float_1_328125 = OpConstant %float 1.328125 +%float_0_00520833349 = OpConstant %float 0.00520833349 + %600 = OpConstantComposite %v2float %float_1_328125 %float_0_00520833349 +%float_1_3203125 = OpConstant %float 1.3203125 +%float_0_00611237064 = OpConstant %float 0.00611237064 + %603 = OpConstantComposite %v2float %float_1_3203125 %float_0_00611237064 +%float_1_3125 = OpConstant %float 1.3125 +%float_0_00708762882 = OpConstant %float 0.00708762882 + %606 = OpConstantComposite %v2float %float_1_3125 %float_0_00708762882 +%float_0_000320512831 = OpConstant %float 0.000320512831 + %608 = OpConstantComposite %v2float %float_1_3125 %float_0_000320512831 +%float_1_3046875 = OpConstant %float 1.3046875 +%float_0_00143494899 = OpConstant %float 0.00143494899 + %611 = OpConstantComposite %v2float %float_1_3046875 %float_0_00143494899 +%float_1_296875 = OpConstant %float 1.296875 +%float_0_0026173857 = OpConstant %float 0.0026173857 + %614 = OpConstantComposite %v2float %float_1_296875 %float_0_0026173857 +%float_1_2890625 = OpConstant %float 1.2890625 +%float_0_00386679289 = OpConstant %float 0.00386679289 + %617 = OpConstantComposite %v2float %float_1_2890625 %float_0_00386679289 +%float_1_28125 = OpConstant %float 1.28125 +%float_0_005182161 = OpConstant %float 0.005182161 + %620 = OpConstantComposite %v2float %float_1_28125 %float_0_005182161 +%float_1_2734375 = OpConstant %float 1.2734375 +%float_0_0065624998 = OpConstant %float 0.0065624998 + %623 = OpConstantComposite %v2float %float_1_2734375 %float_0_0065624998 +%float_0_000194340799 = OpConstant %float 0.000194340799 + %625 = OpConstantComposite %v2float %float_1_2734375 %float_0_000194340799 +%float_1_265625 = OpConstant %float 1.265625 +%float_0_00170173263 = OpConstant %float 0.00170173263 + %628 = OpConstantComposite %v2float %float_1_265625 %float_0_00170173263 +%float_1_2578125 = OpConstant %float 1.2578125 +%float_0_00327124377 = OpConstant %float 0.00327124377 + %631 = OpConstantComposite %v2float %float_1_2578125 %float_0_00327124377 + %float_1_25 = OpConstant %float 1.25 +%float_0_00490196096 = OpConstant %float 0.00490196096 + %634 = OpConstantComposite %v2float %float_1_25 %float_0_00490196096 +%float_1_2421875 = OpConstant %float 1.2421875 +%float_0_00659298804 = OpConstant %float 0.00659298804 + %637 = OpConstantComposite %v2float %float_1_2421875 %float_0_00659298804 +%float_0_000530946592 = OpConstant %float 0.000530946592 + %639 = OpConstantComposite %v2float %float_1_2421875 %float_0_000530946592 +%float_1_234375 = OpConstant %float 1.234375 +%float_0_00233997591 = OpConstant %float 0.00233997591 + %642 = OpConstantComposite %v2float %float_1_234375 %float_0_00233997591 +%float_1_2265625 = OpConstant %float 1.2265625 +%float_0_00420673098 = OpConstant %float 0.00420673098 + %645 = OpConstantComposite %v2float %float_1_2265625 %float_0_00420673098 +%float_1_21875 = OpConstant %float 1.21875 +%float_0_00613038288 = OpConstant %float 0.00613038288 + %648 = OpConstantComposite %v2float %float_1_21875 %float_0_00613038288 +%float_0_000297619059 = OpConstant %float 0.000297619059 + %650 = OpConstantComposite %v2float %float_1_21875 %float_0_000297619059 +%float_1_2109375 = OpConstant %float 1.2109375 +%float_0_00233264221 = OpConstant %float 0.00233264221 + %653 = OpConstantComposite %v2float %float_1_2109375 %float_0_00233264221 +%float_1_203125 = OpConstant %float 1.203125 +%float_0_00442216964 = OpConstant %float 0.00442216964 + %656 = OpConstantComposite %v2float %float_1_203125 %float_0_00442216964 +%float_1_1953125 = OpConstant %float 1.1953125 +%float_0_00656543439 = OpConstant %float 0.00656543439 + %659 = OpConstantComposite %v2float %float_1_1953125 %float_0_00656543439 +%float_0_000949182257 = OpConstant %float 0.000949182257 + %661 = OpConstantComposite %v2float %float_1_1953125 %float_0_000949182257 +%float_1_1875 = OpConstant %float 1.1875 +%float_0_00319767441 = OpConstant %float 0.00319767441 + %664 = OpConstantComposite %v2float %float_1_1875 %float_0_00319767441 +%float_1_1796875 = OpConstant %float 1.1796875 +%float_0_00549768517 = OpConstant %float 0.00549768517 + %667 = OpConstantComposite %v2float %float_1_1796875 %float_0_00549768517 +%float_3_60023041en05 = OpConstant %float 3.60023041e-05 + %669 = OpConstantComposite %v2float %float_1_1796875 %float_3_60023041en05 +%float_1_171875 = OpConstant %float 1.171875 +%float_0_00243692659 = OpConstant %float 0.00243692659 + %672 = OpConstantComposite %v2float %float_1_171875 %float_0_00243692659 +%float_1_1640625 = OpConstant %float 1.1640625 +%float_0_00488727167 = OpConstant %float 0.00488727167 + %675 = OpConstantComposite %v2float %float_1_1640625 %float_0_00488727167 +%float_1_15625 = OpConstant %float 1.15625 +%float_0_00738636358 = OpConstant %float 0.00738636358 + %678 = OpConstantComposite %v2float %float_1_15625 %float_0_00738636358 +%float_0_00212104083 = OpConstant %float 0.00212104083 + %680 = OpConstantComposite %v2float %float_1_15625 %float_0_00212104083 +%float_1_1484375 = OpConstant %float 1.1484375 +%float_0_00471565314 = OpConstant %float 0.00471565314 + %683 = OpConstantComposite %v2float %float_1_1484375 %float_0_00471565314 +%float_1_140625 = OpConstant %float 1.140625 +%float_0_00735706277 = OpConstant %float 0.00735706277 + %686 = OpConstantComposite %v2float %float_1_140625 %float_0_00735706277 +%float_0_00223214296 = OpConstant %float 0.00223214296 + %688 = OpConstantComposite %v2float %float_1_140625 %float_0_00223214296 +%float_1_1328125 = OpConstant %float 1.1328125 +%float_0_00496527785 = OpConstant %float 0.00496527785 + %691 = OpConstantComposite %v2float %float_1_1328125 %float_0_00496527785 +%float_1_125 = OpConstant %float 1.125 +%float_0_0077433628 = OpConstant %float 0.0077433628 + %694 = OpConstantComposite %v2float %float_1_125 %float_0_0077433628 +%float_0_00275330385 = OpConstant %float 0.00275330385 + %696 = OpConstantComposite %v2float %float_1_125 %float_0_00275330385 +%float_1_1171875 = OpConstant %float 1.1171875 +%float_0_00561951753 = OpConstant %float 0.00561951753 + %699 = OpConstantComposite %v2float %float_1_1171875 %float_0_00561951753 +%float_0_000716430135 = OpConstant %float 0.000716430135 + %701 = OpConstantComposite %v2float %float_1_1171875 %float_0_000716430135 +%float_1_109375 = OpConstant %float 1.109375 +%float_0_00366847822 = OpConstant %float 0.00366847822 + %704 = OpConstantComposite %v2float %float_1_109375 %float_0_00366847822 +%float_1_1015625 = OpConstant %float 1.1015625 +%float_0_00666260812 = OpConstant %float 0.00666260812 + %707 = OpConstantComposite %v2float %float_1_1015625 %float_0_00666260812 +%float_0_00188577583 = OpConstant %float 0.00188577583 + %709 = OpConstantComposite %v2float %float_1_1015625 %float_0_00188577583 +%float_1_09375 = OpConstant %float 1.09375 +%float_0_00496244617 = OpConstant %float 0.00496244617 + %712 = OpConstantComposite %v2float %float_1_09375 %float_0_00496244617 +%float_0_00026709403 = OpConstant %float 0.00026709403 + %714 = OpConstantComposite %v2float %float_1_09375 %float_0_00026709403 +%float_1_0859375 = OpConstant %float 1.0859375 +%float_0_00342420209 = OpConstant %float 0.00342420209 + %717 = OpConstantComposite %v2float %float_1_0859375 %float_0_00342420209 +%float_1_078125 = OpConstant %float 1.078125 +%float_0_00662076287 = OpConstant %float 0.00662076287 + %720 = OpConstantComposite %v2float %float_1_078125 %float_0_00662076287 +%float_0_00204377645 = OpConstant %float 0.00204377645 + %722 = OpConstantComposite %v2float %float_1_078125 %float_0_00204377645 +%float_1_0703125 = OpConstant %float 1.0703125 +%float_0_00531775225 = OpConstant %float 0.00531775225 + %725 = OpConstantComposite %v2float %float_1_0703125 %float_0_00531775225 +%float_0_000817207096 = OpConstant %float 0.000817207096 + %727 = OpConstantComposite %v2float %float_1_0703125 %float_0_000817207096 +%float_1_0625 = OpConstant %float 1.0625 +%float_0_00416666688 = OpConstant %float 0.00416666688 + %730 = OpConstantComposite %v2float %float_1_0625 %float_0_00416666688 +%float_1_0546875 = OpConstant %float 1.0546875 +%float_0_00755316392 = OpConstant %float 0.00755316392 + %733 = OpConstantComposite %v2float %float_1_0546875 %float_0_00755316392 +%float_0_00316373957 = OpConstant %float 0.00316373957 + %735 = OpConstantComposite %v2float %float_1_0546875 %float_0_00316373957 +%float_1_046875 = OpConstant %float 1.046875 +%float_0_00662294216 = OpConstant %float 0.00662294216 + %738 = OpConstantComposite %v2float %float_1_046875 %float_0_00662294216 +%float_0_00230532791 = OpConstant %float 0.00230532791 + %740 = OpConstantComposite %v2float %float_1_046875 %float_0_00230532791 +%float_1_0390625 = OpConstant %float 1.0390625 +%float_0_0058354591 = OpConstant %float 0.0058354591 + %743 = OpConstantComposite %v2float %float_1_0390625 %float_0_0058354591 +%float_0_0015879065 = OpConstant %float 0.0015879065 + %745 = OpConstantComposite %v2float %float_1_0390625 %float_0_0015879065 +%float_1_03125 = OpConstant %float 1.03125 +%float_0_00518724695 = OpConstant %float 0.00518724695 + %748 = OpConstantComposite %v2float %float_1_03125 %float_0_00518724695 +%float_0_00100806449 = OpConstant %float 0.00100806449 + %750 = OpConstantComposite %v2float %float_1_03125 %float_0_00100806449 +%float_1_0234375 = OpConstant %float 1.0234375 +%float_0_00467494968 = OpConstant %float 0.00467494968 + %753 = OpConstantComposite %v2float %float_1_0234375 %float_0_00467494968 +%float_0_000562499976 = OpConstant %float 0.000562499976 + %755 = OpConstantComposite %v2float %float_1_0234375 %float_0_000562499976 +%float_1_015625 = OpConstant %float 1.015625 +%float_0_00429531885 = OpConstant %float 0.00429531885 + %758 = OpConstantComposite %v2float %float_1_015625 %float_0_00429531885 +%float_0_000248015887 = OpConstant %float 0.000248015887 + %760 = OpConstantComposite %v2float %float_1_015625 %float_0_000248015887 +%float_1_0078125 = OpConstant %float 1.0078125 +%float_0_00404520752 = OpConstant %float 0.00404520752 + %763 = OpConstantComposite %v2float %float_1_0078125 %float_0_00404520752 +%float_6_15157478en05 = OpConstant %float 6.15157478e-05 + %765 = OpConstantComposite %v2float %float_1_0078125 %float_6_15157478en05 + %float_1 = OpConstant %float 1 +%float_0_00392156886 = OpConstant %float 0.00392156886 + %768 = OpConstantComposite %v2float %float_1 %float_0_00392156886 + %769 = OpConstantComposite %v2float %float_1 %float_0 + %770 = OpConstantComposite %_arr_v2float_uint_129 %408 %411 %414 %417 %420 %423 %426 %429 %432 %435 %438 %441 %444 %447 %450 %453 %456 %459 %462 %465 %468 %471 %474 %477 %480 %483 %486 %489 %492 %495 %498 %501 %504 %507 %510 %513 %516 %519 %522 %525 %528 %531 %534 %537 %540 %543 %546 %549 %552 %555 %558 %561 %564 %567 %570 %573 %576 %579 %582 %585 %588 %591 %594 %597 %600 %603 %606 %608 %611 %614 %617 %620 %623 %625 %628 %631 %634 %637 %639 %642 %645 %648 %650 %653 %656 %659 %661 %664 %667 %669 %672 %675 %678 %680 %683 %686 %688 %691 %694 %696 %699 %701 %704 %707 %709 %712 %714 %717 %720 %722 %725 %727 %730 %733 %735 %738 %740 %743 %745 %748 %750 %753 %755 %758 %760 %763 %765 %768 %769 + %uint_65 = OpConstant %uint 65 +%_arr_v2float_uint_65 = OpTypeArray %v2float %uint_65 +%float_1_01074219 = OpConstant %float 1.01074219 +%float_0_000147098544 = OpConstant %float 0.000147098544 + %776 = OpConstantComposite %v2float %float_1_01074219 %float_0_000147098544 +%float_1_02148438 = OpConstant %float 1.02148438 +%float_0_000412773632 = OpConstant %float 0.000412773632 + %779 = OpConstantComposite %v2float %float_1_02148438 %float_0_000412773632 +%float_1_03222656 = OpConstant %float 1.03222656 +%float_0_000798316498 = OpConstant %float 0.000798316498 + %782 = OpConstantComposite %v2float %float_1_03222656 %float_0_000798316498 +%float_1_04394531 = OpConstant %float 1.04394531 +%float_0_000328469905 = OpConstant %float 0.000328469905 + %785 = OpConstantComposite %v2float %float_1_04394531 %float_0_000328469905 +%float_0_000957678305 = OpConstant %float 0.000957678305 + %787 = OpConstantComposite %v2float %float_1_0546875 %float_0_000957678305 +%float_1_06640625 = OpConstant %float 1.06640625 +%float_0_000734150643 = OpConstant %float 0.000734150643 + %790 = OpConstantComposite %v2float %float_1_06640625 %float_0_000734150643 +%float_0_00063579774 = OpConstant %float 0.00063579774 + %792 = OpConstantComposite %v2float %float_1_078125 %float_0_00063579774 +%float_1_08984375 = OpConstant %float 1.08984375 +%float_0_000663982646 = OpConstant %float 0.000663982646 + %795 = OpConstantComposite %v2float %float_1_08984375 %float_0_000663982646 +%float_0_000820083253 = OpConstant %float 0.000820083253 + %797 = OpConstantComposite %v2float %float_1_1015625 %float_0_000820083253 +%float_1_11425781 = OpConstant %float 1.11425781 +%float_0_000128930085 = OpConstant %float 0.000128930085 + %800 = OpConstantComposite %v2float %float_1_11425781 %float_0_000128930085 +%float_1_12597656 = OpConstant %float 1.12597656 +%float_0_000545056071 = OpConstant %float 0.000545056071 + %803 = OpConstantComposite %v2float %float_1_12597656 %float_0_000545056071 +%float_1_13867188 = OpConstant %float 1.13867188 +%float_0_000116759751 = OpConstant %float 0.000116759751 + %806 = OpConstantComposite %v2float %float_1_13867188 %float_0_000116759751 +%float_1_15039062 = OpConstant %float 1.15039062 +%float_0_000798604917 = OpConstant %float 0.000798604917 + %809 = OpConstantComposite %v2float %float_1_15039062 %float_0_000798604917 +%float_1_16308594 = OpConstant %float 1.16308594 +%float_0_000638921221 = OpConstant %float 0.000638921221 + %812 = OpConstantComposite %v2float %float_1_16308594 %float_0_000638921221 +%float_1_17578125 = OpConstant %float 1.17578125 +%float_0_00061574165 = OpConstant %float 0.00061574165 + %815 = OpConstantComposite %v2float %float_1_17578125 %float_0_00061574165 +%float_1_18847656 = OpConstant %float 1.18847656 +%float_0_000730552478 = OpConstant %float 0.000730552478 + %818 = OpConstantComposite %v2float %float_1_18847656 %float_0_000730552478 +%float_1_20214844 = OpConstant %float 1.20214844 +%float_8_29395231en06 = OpConstant %float 8.29395231e-06 + %821 = OpConstantComposite %v2float %float_1_20214844 %float_8_29395231en06 +%float_1_21484375 = OpConstant %float 1.21484375 +%float_0_000403609971 = OpConstant %float 0.000403609971 + %824 = OpConstantComposite %v2float %float_1_21484375 %float_0_000403609971 +%float_1_22753906 = OpConstant %float 1.22753906 +%float_0_000941473583 = OpConstant %float 0.000941473583 + %827 = OpConstantComposite %v2float %float_1_22753906 %float_0_000941473583 +%float_1_24121094 = OpConstant %float 1.24121094 +%float_0_000646874541 = OpConstant %float 0.000646874541 + %830 = OpConstantComposite %v2float %float_1_24121094 %float_0_000646874541 +%float_1_25488281 = OpConstant %float 1.25488281 +%float_0_000497944478 = OpConstant %float 0.000497944478 + %833 = OpConstantComposite %v2float %float_1_25488281 %float_0_000497944478 +%float_1_26855469 = OpConstant %float 1.26855469 +%float_0_000496269669 = OpConstant %float 0.000496269669 + %836 = OpConstantComposite %v2float %float_1_26855469 %float_0_000496269669 +%float_1_28222656 = OpConstant %float 1.28222656 +%float_0_000643453561 = OpConstant %float 0.000643453561 + %839 = OpConstantComposite %v2float %float_1_28222656 %float_0_000643453561 +%float_1_29589844 = OpConstant %float 1.29589844 +%float_0_00094111712 = OpConstant %float 0.00094111712 + %842 = OpConstantComposite %v2float %float_1_29589844 %float_0_00094111712 +%float_1_31054688 = OpConstant %float 1.31054688 +%float_0_000414336508 = OpConstant %float 0.000414336508 + %845 = OpConstantComposite %v2float %float_1_31054688 %float_0_000414336508 +%float_1_32519531 = OpConstant %float 1.32519531 +%float_4_13306589en05 = OpConstant %float 4.13306589e-05 + %848 = OpConstantComposite %v2float %float_1_32519531 %float_4_13306589en05 +%float_1_33886719 = OpConstant %float 1.33886719 +%float_0_000800336536 = OpConstant %float 0.000800336536 + %851 = OpConstantComposite %v2float %float_1_33886719 %float_0_000800336536 +%float_1_35351562 = OpConstant %float 1.35351562 +%float_0_000739921932 = OpConstant %float 0.000739921932 + %854 = OpConstantComposite %v2float %float_1_35351562 %float_0_000739921932 +%float_1_36816406 = OpConstant %float 1.36816406 +%float_0_000838360458 = OpConstant %float 0.000838360458 + %857 = OpConstantComposite %v2float %float_1_36816406 %float_0_000838360458 +%float_1_38378906 = OpConstant %float 1.38378906 +%float_0_000120819459 = OpConstant %float 0.000120819459 + %860 = OpConstantComposite %v2float %float_1_38378906 %float_0_000120819459 +%float_0_000542172522 = OpConstant %float 0.000542172522 + %862 = OpConstantComposite %v2float %float_1_3984375 %float_0_000542172522 +%float_0_00015106237 = OpConstant %float 0.00015106237 + %864 = OpConstantComposite %v2float %float_1_4140625 %float_0_00015106237 +%float_1_42871094 = OpConstant %float 1.42871094 +%float_0_000902400876 = OpConstant %float 0.000902400876 + %867 = OpConstantComposite %v2float %float_1_42871094 %float_0_000902400876 +%float_1_44433594 = OpConstant %float 1.44433594 +%float_0_000844869472 = OpConstant %float 0.000844869472 + %870 = OpConstantComposite %v2float %float_1_44433594 %float_0_000844869472 +%float_1_45996094 = OpConstant %float 1.45996094 +%float_0_000956856646 = OpConstant %float 0.000956856646 + %873 = OpConstantComposite %v2float %float_1_45996094 %float_0_000956856646 +%float_0_000263645925 = OpConstant %float 0.000263645925 + %875 = OpConstantComposite %v2float %float_1_4765625 %float_0_000263645925 +%float_0_000720228243 = OpConstant %float 0.000720228243 + %877 = OpConstantComposite %v2float %float_1_4921875 %float_0_000720228243 +%float_1_50878906 = OpConstant %float 1.50878906 +%float_0_000375365082 = OpConstant %float 0.000375365082 + %880 = OpConstantComposite %v2float %float_1_50878906 %float_0_000375365082 +%float_1_52539062 = OpConstant %float 1.52539062 +%float_0_000207525736 = OpConstant %float 0.000207525736 + %883 = OpConstantComposite %v2float %float_1_52539062 %float_0_000207525736 +%float_1_54199219 = OpConstant %float 1.54199219 +%float_0_000218637899 = OpConstant %float 0.000218637899 + %886 = OpConstantComposite %v2float %float_1_54199219 %float_0_000218637899 +%float_1_55859375 = OpConstant %float 1.55859375 +%float_0_000410650217 = OpConstant %float 0.000410650217 + %889 = OpConstantComposite %v2float %float_1_55859375 %float_0_000410650217 +%float_1_57519531 = OpConstant %float 1.57519531 +%float_0_000785532582 = OpConstant %float 0.000785532582 + %892 = OpConstantComposite %v2float %float_1_57519531 %float_0_000785532582 +%float_1_59277344 = OpConstant %float 1.59277344 +%float_0_000368713838 = OpConstant %float 0.000368713838 + %895 = OpConstantComposite %v2float %float_1_59277344 %float_0_000368713838 +%float_1_61035156 = OpConstant %float 1.61035156 +%float_0_000138769436 = OpConstant %float 0.000138769436 + %898 = OpConstantComposite %v2float %float_1_61035156 %float_0_000138769436 +%float_1_62792969 = OpConstant %float 1.62792969 +%float_9_77343516en05 = OpConstant %float 9.77343516e-05 + %901 = OpConstantComposite %v2float %float_1_62792969 %float_9_77343516en05 +%float_1_64550781 = OpConstant %float 1.64550781 +%float_0_000247665652 = OpConstant %float 0.000247665652 + %904 = OpConstantComposite %v2float %float_1_64550781 %float_0_000247665652 +%float_1_66308594 = OpConstant %float 1.66308594 +%float_0_000590642798 = OpConstant %float 0.000590642798 + %907 = OpConstantComposite %v2float %float_1_66308594 %float_0_000590642798 +%float_1_68164062 = OpConstant %float 1.68164062 +%float_0_000152205495 = OpConstant %float 0.000152205495 + %910 = OpConstantComposite %v2float %float_1_68164062 %float_0_000152205495 +%float_1_69921875 = OpConstant %float 1.69921875 +%float_0_000887603674 = OpConstant %float 0.000887603674 + %913 = OpConstantComposite %v2float %float_1_69921875 %float_0_000887603674 +%float_1_71777344 = OpConstant %float 1.71777344 +%float_0_000845860573 = OpConstant %float 0.000845860573 + %916 = OpConstantComposite %v2float %float_1_71777344 %float_0_000845860573 +%float_1_73730469 = OpConstant %float 1.73730469 +%float_2_91477736en05 = OpConstant %float 2.91477736e-05 + %919 = OpConstantComposite %v2float %float_1_73730469 %float_2_91477736en05 +%float_1_75585938 = OpConstant %float 1.75585938 +%float_0_000392785354 = OpConstant %float 0.000392785354 + %922 = OpConstantComposite %v2float %float_1_75585938 %float_0_000392785354 +%float_1_77441406 = OpConstant %float 1.77441406 +%float_0_000962429971 = OpConstant %float 0.000962429971 + %925 = OpConstantComposite %v2float %float_1_77441406 %float_0_000962429971 +%float_1_79394531 = OpConstant %float 1.79394531 +%float_0_000763762451 = OpConstant %float 0.000763762451 + %928 = OpConstantComposite %v2float %float_1_79394531 %float_0_000763762451 +%float_1_81347656 = OpConstant %float 1.81347656 +%float_0_000775612949 = OpConstant %float 0.000775612949 + %931 = OpConstantComposite %v2float %float_1_81347656 %float_0_000775612949 +%float_1_83398438 = OpConstant %float 1.83398438 +%float_2_37114091en05 = OpConstant %float 2.37114091e-05 + %934 = OpConstantComposite %v2float %float_1_83398438 %float_2_37114091en05 +%float_1_85351562 = OpConstant %float 1.85351562 +%float_0_000463500066 = OpConstant %float 0.000463500066 + %937 = OpConstantComposite %v2float %float_1_85351562 %float_0_000463500066 +%float_1_87402344 = OpConstant %float 1.87402344 +%float_0_000144196601 = OpConstant %float 0.000144196601 + %940 = OpConstantComposite %v2float %float_1_87402344 %float_0_000144196601 +%float_1_89453125 = OpConstant %float 1.89453125 +%float_4_47315833en05 = OpConstant %float 4.47315833e-05 + %943 = OpConstantComposite %v2float %float_1_89453125 %float_4_47315833en05 +%float_1_91503906 = OpConstant %float 1.91503906 +%float_0_000167498889 = OpConstant %float 0.000167498889 + %946 = OpConstantComposite %v2float %float_1_91503906 %float_0_000167498889 +%float_1_93554688 = OpConstant %float 1.93554688 +%float_0_000514918473 = OpConstant %float 0.000514918473 + %949 = OpConstantComposite %v2float %float_1_93554688 %float_0_000514918473 +%float_1_95703125 = OpConstant %float 1.95703125 +%float_0_000112874171 = OpConstant %float 0.000112874171 + %952 = OpConstantComposite %v2float %float_1_95703125 %float_0_000112874171 +%float_1_97753906 = OpConstant %float 1.97753906 +%float_0_000916963851 = OpConstant %float 0.000916963851 + %955 = OpConstantComposite %v2float %float_1_97753906 %float_0_000916963851 + %956 = OpConstantComposite %_arr_v2float_uint_65 %769 %776 %779 %782 %785 %787 %790 %792 %795 %797 %800 %803 %806 %809 %812 %815 %818 %821 %824 %827 %830 %833 %836 %839 %842 %845 %848 %851 %854 %857 %860 %862 %864 %867 %870 %873 %875 %877 %880 %883 %886 %889 %892 %895 %898 %901 %904 %907 %910 %913 %916 %919 %922 %925 %928 %931 %934 %937 %940 %943 %946 %949 %952 %955 %408 +%_ptr_Private__arr_v2float_uint_65 = OpTypePointer Private %_arr_v2float_uint_65 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float +%_struct_961 = OpTypeStruct %_runtimearr_v4float +%_ptr_StorageBuffer__struct_961 = OpTypePointer StorageBuffer %_struct_961 + %v4uint = OpTypeVector %uint 4 +%_runtimearr_v4uint = OpTypeRuntimeArray %v4uint +%_struct_966 = OpTypeStruct %_runtimearr_v4uint +%_ptr_StorageBuffer__struct_966 = OpTypePointer StorageBuffer %_struct_966 + %void = OpTypeVoid + %970 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float +%_ptr_StorageBuffer_v4uint = OpTypePointer StorageBuffer %v4uint +%uint_2147483647 = OpConstant %uint 2147483647 + %bool = OpTypeBool +%uint_4294967295 = OpConstant %uint 4294967295 + %uint_1 = OpConstant %uint 1 +%float_0_0625 = OpConstant %float 0.0625 +%float_0_142857149 = OpConstant %float 0.142857149 +%float_0_166666672 = OpConstant %float 0.166666672 +%float_0_200000003 = OpConstant %float 0.200000003 + %float_0_25 = OpConstant %float 0.25 +%float_0_333333343 = OpConstant %float 0.333333343 + %float_n0_5 = OpConstant %float -0.5 + %uint_23 = OpConstant %uint 23 +%uint_4294967169 = OpConstant %uint 4294967169 +%uint_1065353216 = OpConstant %uint 1065353216 + %float_n1 = OpConstant %float -1 +%uint_4294967043 = OpConstant %uint 4294967043 +%uint_8388608 = OpConstant %uint 8388608 +%uint_8323072 = OpConstant %uint 8323072 + %uint_65536 = OpConstant %uint 65536 +%uint_1056964608 = OpConstant %uint 1056964608 +%uint_8388607 = OpConstant %uint 8388607 + %uint_16 = OpConstant %uint 16 +%_ptr_Private_float = OpTypePointer Private %float + %float_0_5 = OpConstant %float 0.5 +%_ptr_Private_v2float = OpTypePointer Private %v2float +%uint_4294963200 = OpConstant %uint 4294963200 +%float_92_3324814 = OpConstant %float 92.3324814 + %uint_63 = OpConstant %uint 63 + %uint_6 = OpConstant %uint 6 +%float_0_0108032227 = OpConstant %float 0.0108032227 +%float_2_72020388en05 = OpConstant %float 2.72020388e-05 +%float_0_0416666679 = OpConstant %float 0.0416666679 + %uint_21 = OpConstant %uint 21 + %uint_31 = OpConstant %uint 31 +%uint_4294959296 = OpConstant %uint 4294959296 +%float_88_7228394 = OpConstant %float 88.7228394 +%float_n2_43795739en07 = OpConstant %float -2.43795739e-07 +%float_0x1p_128 = OpConstant %float 0x1p+128 +%float_n103_278931 = OpConstant %float -103.278931 +%uint_2147483648 = OpConstant %uint 2147483648 +%uint_2139095040 = OpConstant %uint 2139095040 +%uint_4286578688 = OpConstant %uint 4286578688 + %v8uint = OpTypeVector %uint 8 + %1214 = OpUndef %v8uint + %v8bool = OpTypeVector %bool 8 + %1227 = OpConstantNull %v8uint + %v2uint = OpTypeVector %uint 2 + %uint_2 = OpConstant %uint 2 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %405 = OpVariable %_ptr_Private__arr_v2float_uint_129 Private %403 + %771 = OpVariable %_ptr_Private__arr_v2float_uint_129 Private %770 + %958 = OpVariable %_ptr_Private__arr_v2float_uint_65 Private %956 + %963 = OpVariable %_ptr_StorageBuffer__struct_961 StorageBuffer + %968 = OpVariable %_ptr_StorageBuffer__struct_966 StorageBuffer + %971 = OpFunction %void None %970 + %972 = OpLabel + %975 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %976 = OpLoad %uint %975 + %978 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %979 = OpLoad %uint %978 + %980 = OpIAdd %uint %976 %979 + %982 = OpAccessChain %_ptr_StorageBuffer_v4float %963 %uint_0 %980 + %983 = OpLoad %v4float %982 + %984 = OpBitcast %v4uint %983 + %985 = OpIAdd %uint %976 %979 + %987 = OpAccessChain %_ptr_StorageBuffer_v4uint %968 %uint_0 %985 + %988 = OpLoad %v4uint %987 + %989 = OpCompositeExtract %uint %988 0 + %990 = OpConvertSToF %float %989 + %991 = OpCompositeExtract %uint %984 0 + %993 = OpBitwiseAnd %uint %991 %uint_2147483647 + %994 = OpBitcast %uint %990 + %997 = OpSGreaterThan %bool %989 %uint_4294967295 + %999 = OpSelect %uint %997 %uint_1 %uint_0 + %1000 = OpBitcast %float %993 + %1001 = OpFSub %float %float_1 %1000 + %1002 = OpBitcast %uint %1001 + %1003 = OpBitwiseAnd %uint %1002 %uint_2147483647 + %1004 = OpBitcast %float %1003 + %1006 = OpFOrdLessThan %bool %1004 %float_0_0625 + %1007 = OpFMul %float %1001 %1001 + %1009 = OpFMul %float %1001 %float_0_142857149 + %1011 = OpFAdd %float %1009 %float_0_166666672 + %1012 = OpFMul %float %1001 %1011 + %1014 = OpFAdd %float %1012 %float_0_200000003 + %1015 = OpFMul %float %1001 %1014 + %1017 = OpFAdd %float %1015 %float_0_25 + %1018 = OpFMul %float %1001 %1017 + %1020 = OpFAdd %float %1018 %float_0_333333343 + %1021 = OpFMul %float %1001 %1007 + %1023 = OpFMul %float %1007 %float_n0_5 + %1024 = OpFNegate %float %1020 + %1025 = OpFMul %float %1021 %1024 + %1026 = OpFAdd %float %1023 %1025 + %1027 = OpFNegate %float %1001 + %1028 = OpFSub %float %1026 %1001 + %1030 = OpShiftRightLogical %uint %993 %uint_23 + %1032 = OpIAdd %uint %1030 %uint_4294967169 + %1034 = OpBitwiseOr %uint %993 %uint_1065353216 + %1035 = OpBitcast %float %1034 + %1037 = OpFAdd %float %1035 %float_n1 + %1038 = OpBitcast %uint %1037 + %1039 = OpShiftRightArithmetic %uint %1038 %uint_23 + %1041 = OpIAdd %uint %1039 %uint_4294967043 + %1043 = OpULessThan %bool %993 %uint_8388608 + %1044 = OpSelect %uint %1043 %1038 %993 + %1045 = OpSelect %uint %1043 %1041 %1032 + %1046 = OpConvertSToF %float %1045 + %1048 = OpBitwiseAnd %uint %1044 %uint_8323072 + %1049 = OpShiftLeftLogical %uint %1044 %uint_1 + %1051 = OpBitwiseAnd %uint %1049 %uint_65536 + %1052 = OpIAdd %uint %1051 %1048 + %1054 = OpBitwiseOr %uint %1052 %uint_1056964608 + %1055 = OpBitcast %float %1054 + %1057 = OpBitwiseAnd %uint %1044 %uint_8388607 + %1058 = OpBitwiseOr %uint %1057 %uint_1056964608 + %1059 = OpBitcast %float %1058 + %1060 = OpFSub %float %1055 %1059 + %1062 = OpShiftRightLogical %uint %1052 %uint_16 + %1064 = OpAccessChain %_ptr_Private_float %771 %1062 %uint_0 + %1065 = OpLoad %float %1064 + %1066 = OpFMul %float %1065 %1060 + %1067 = OpAccessChain %_ptr_Private_float %771 %1062 %uint_1 + %1068 = OpLoad %float %1067 + %1069 = OpFMul %float %1068 %1060 + %1070 = OpFAdd %float %1066 %1069 + %1071 = OpFMul %float %1070 %float_0_25 + %1072 = OpFAdd %float %1071 %float_0_333333343 + %1073 = OpFMul %float %1070 %1072 + %1075 = OpFAdd %float %1073 %float_0_5 + %1076 = OpFMul %float %1070 %1070 + %1077 = OpFMul %float %1076 %1075 + %1078 = OpFSub %float %1066 %1070 + %1079 = OpFAdd %float %1069 %1078 + %1080 = OpFAdd %float %1079 %1077 + %1082 = OpAccessChain %_ptr_Private_v2float %405 %1062 + %1083 = OpLoad %v2float %1082 + %1084 = OpFNegate %float %1070 + %1085 = OpFMul %float %1046 %float_3_19461833en05 + %1086 = OpFSub %float %1085 %1080 + %1087 = OpCompositeExtract %float %1083 1 + %1088 = OpFAdd %float %1087 %1086 + %1089 = OpFSub %float %1088 %1070 + %1090 = OpCompositeExtract %float %1083 0 + %1091 = OpFMul %float %1046 %float_0_693115234 + %1092 = OpFAdd %float %1090 %1091 + %1093 = OpFAdd %float %1092 %1089 + %1094 = OpSelect %float %1006 %1023 %1084 + %1095 = OpSelect %float %1006 %1025 %1088 + %1096 = OpSelect %float %1006 %1026 %1089 + %1097 = OpSelect %float %1006 %1027 %1092 + %1098 = OpSelect %float %1006 %1028 %1093 + %1099 = OpBitcast %uint %1098 + %1101 = OpBitwiseAnd %uint %1099 %uint_4294963200 + %1102 = OpBitcast %float %1101 + %1103 = OpFSub %float %1096 %1094 + %1104 = OpFSub %float %1095 %1103 + %1105 = OpFSub %float %1097 %1098 + %1106 = OpFAdd %float %1096 %1105 + %1107 = OpFAdd %float %1104 %1106 + %1108 = OpFSub %float %1098 %1102 + %1109 = OpFAdd %float %1107 %1108 + %1110 = OpBitwiseAnd %uint %994 %uint_4294963200 + %1111 = OpBitcast %float %1110 + %1112 = OpConvertFToS %uint %1111 + %1113 = OpISub %uint %989 %1112 + %1114 = OpConvertSToF %float %1113 + %1115 = OpFMul %float %1109 %1114 + %1116 = OpFMul %float %1114 %1102 + %1117 = OpFAdd %float %1116 %1115 + %1118 = OpFMul %float %1109 %1111 + %1119 = OpFAdd %float %1118 %1117 + %1120 = OpFMul %float %1111 %1102 + %1121 = OpFAdd %float %1120 %1119 + %1122 = OpFSub %float %1120 %1121 + %1123 = OpFAdd %float %1119 %1122 + %1125 = OpFMul %float %1121 %float_92_3324814 + %1126 = OpConvertFToS %uint %1125 + %1127 = OpConvertSToF %float %1126 + %1129 = OpBitwiseAnd %uint %1126 %uint_63 + %1131 = OpShiftRightArithmetic %uint %1126 %uint_6 + %1132 = OpShiftLeftLogical %uint %1131 %uint_23 + %1134 = OpFMul %float %1127 %float_0_0108032227 + %1135 = OpFSub %float %1121 %1134 + %1137 = OpFMul %float %1127 %float_2_72020388en05 + %1138 = OpFSub %float %1135 %1137 + %1139 = OpFAdd %float %1123 %1138 + %1141 = OpFMul %float %1139 %float_0_0416666679 + %1142 = OpFAdd %float %1141 %float_0_166666672 + %1143 = OpFMul %float %1139 %1142 + %1144 = OpFAdd %float %1143 %float_0_5 + %1145 = OpFMul %float %1139 %1139 + %1146 = OpFMul %float %1145 %1144 + %1147 = OpFAdd %float %1139 %1146 + %1148 = OpAccessChain %_ptr_Private_float %958 %1129 %uint_0 + %1149 = OpLoad %float %1148 + %1150 = OpAccessChain %_ptr_Private_float %958 %1129 %uint_1 + %1151 = OpLoad %float %1150 + %1152 = OpFMul %float %1151 %1147 + %1153 = OpFAdd %float %1151 %1152 + %1154 = OpFMul %float %1149 %1147 + %1155 = OpFAdd %float %1154 %1153 + %1156 = OpFAdd %float %1149 %1155 + %1158 = OpIAdd %uint %1131 %uint_21 + %1160 = OpBitwiseAnd %uint %1158 %uint_31 + %1161 = OpShiftLeftLogical %uint %uint_1 %1160 + %1162 = OpBitcast %float %1161 + %1163 = OpFMul %float %1156 %1162 + %1164 = OpBitcast %uint %1156 + %1165 = OpIAdd %uint %1132 %1164 + %1166 = OpBitcast %float %1165 + %1168 = OpSLessThan %bool %1126 %uint_4294959296 + %1169 = OpSelect %float %1168 %1163 %1166 + %1171 = OpFOrdGreaterThan %bool %1121 %float_88_7228394 + %1172 = OpFOrdEqual %bool %1121 %float_88_7228394 + %1174 = OpFOrdGreaterThan %bool %1123 %float_n2_43795739en07 + %1175 = OpLogicalAnd %bool %1172 %1174 + %1176 = OpLogicalOr %bool %1171 %1175 + %1178 = OpSelect %float %1176 %float_0x1p_128 %1169 + %1180 = OpFOrdLessThan %bool %1121 %float_n103_278931 + %1181 = OpSelect %float %1180 %float_0 %1178 + %1182 = OpBitwiseAnd %uint %989 %uint_1 + %1183 = OpFNegate %float %1181 + %1184 = OpShiftRightLogical %uint %991 %uint_31 + %1185 = OpBitwiseAnd %uint %1184 %989 + %1186 = OpIEqual %bool %1185 %uint_0 + %1187 = OpSelect %float %1186 %1181 %1183 + %1188 = OpBitcast %uint %1187 + %1190 = OpBitwiseAnd %uint %991 %uint_2147483648 + %1192 = OpBitwiseOr %uint %1190 %uint_2139095040 + %1193 = OpIEqual %bool %993 %uint_0 + %1194 = OpSelect %uint %1193 %uint_1 %uint_0 + %1195 = OpLogicalNot %bool %997 + %1196 = OpSelect %uint %1195 %uint_1 %uint_0 + %1197 = OpBitwiseAnd %uint %1194 %1196 + %1198 = OpBitwiseAnd %uint %1197 %1182 + %1199 = OpIEqual %bool %1198 %uint_0 + %1200 = OpSelect %uint %1199 %1188 %1192 + %1201 = OpBitwiseXor %uint %1182 %uint_1 + %1202 = OpBitwiseAnd %uint %1197 %1201 + %1203 = OpIEqual %bool %1202 %uint_0 + %1204 = OpSelect %uint %1203 %1200 %uint_2139095040 + %1205 = OpBitwiseAnd %uint %1194 %999 + %1207 = OpIEqual %bool %991 %uint_4286578688 + %1208 = OpSelect %uint %1207 %uint_1 %uint_0 + %1209 = OpBitwiseAnd %uint %1196 %1208 + %1210 = OpBitwiseAnd %uint %999 %1208 + %1211 = OpIEqual %bool %991 %uint_2139095040 + %1212 = OpSelect %uint %1211 %uint_1 %uint_0 + %1215 = OpCompositeInsert %v8uint %1212 %1214 0 + %1216 = OpCompositeInsert %v8uint %1210 %1215 1 + %1217 = OpCompositeInsert %v8uint %1209 %1216 2 + %1218 = OpCompositeInsert %v8uint %1205 %1217 3 + %1219 = OpVectorShuffle %v8uint %1218 %1214 0 0 1 1 2 2 3 3 + %1220 = OpCompositeInsert %v8uint %999 %1214 0 + %1221 = OpCompositeInsert %v8uint %1196 %1220 1 + %1222 = OpCompositeInsert %v8uint %1201 %1221 2 + %1223 = OpCompositeInsert %v8uint %1182 %1222 3 + %1224 = OpVectorShuffle %v8uint %1223 %1214 0 1 2 3 2 3 3 2 + %1225 = OpBitwiseAnd %v8uint %1219 %1224 + %1228 = OpIEqual %v8bool %1225 %1227 + %1229 = OpCompositeExtract %bool %1228 7 + %1230 = OpSelect %uint %1229 %1204 %uint_0 + %1231 = OpCompositeExtract %bool %1228 6 + %1232 = OpSelect %uint %1231 %1230 %1190 + %1233 = OpCompositeExtract %bool %1228 5 + %1234 = OpSelect %uint %1233 %1232 %uint_2147483648 + %1235 = OpCompositeExtract %bool %1228 4 + %1236 = OpSelect %uint %1235 %1234 %uint_0 + %1237 = OpCompositeExtract %bool %1228 3 + %1238 = OpSelect %uint %1237 %1236 %uint_4286578688 + %1239 = OpCompositeExtract %bool %1228 2 + %1240 = OpSelect %uint %1239 %1238 %uint_2139095040 + %1241 = OpCompositeExtract %bool %1228 1 + %1242 = OpSelect %uint %1241 %1240 %uint_0 + %1243 = OpCompositeExtract %bool %1228 0 + %1244 = OpSelect %uint %1243 %1242 %uint_2139095040 + %1245 = OpUGreaterThan %bool %993 %uint_2139095040 + %1246 = OpSelect %uint %1245 %991 %1244 + %1247 = OpIEqual %bool %989 %uint_0 + %1248 = OpSelect %uint %1247 %uint_1065353216 %1246 + %1249 = OpCompositeExtract %uint %988 1 + %1250 = OpConvertSToF %float %1249 + %1251 = OpCompositeExtract %uint %984 1 + %1252 = OpBitwiseAnd %uint %1251 %uint_2147483647 + %1253 = OpBitcast %uint %1250 + %1254 = OpSGreaterThan %bool %1249 %uint_4294967295 + %1255 = OpSelect %uint %1254 %uint_1 %uint_0 + %1256 = OpBitcast %float %1252 + %1257 = OpFSub %float %float_1 %1256 + %1258 = OpBitcast %uint %1257 + %1259 = OpBitwiseAnd %uint %1258 %uint_2147483647 + %1260 = OpBitcast %float %1259 + %1261 = OpFOrdLessThan %bool %1260 %float_0_0625 + %1262 = OpFMul %float %1257 %1257 + %1263 = OpFMul %float %1257 %float_0_142857149 + %1264 = OpFAdd %float %1263 %float_0_166666672 + %1265 = OpFMul %float %1257 %1264 + %1266 = OpFAdd %float %1265 %float_0_200000003 + %1267 = OpFMul %float %1257 %1266 + %1268 = OpFAdd %float %1267 %float_0_25 + %1269 = OpFMul %float %1257 %1268 + %1270 = OpFAdd %float %1269 %float_0_333333343 + %1271 = OpFMul %float %1257 %1262 + %1272 = OpFMul %float %1262 %float_n0_5 + %1273 = OpFNegate %float %1270 + %1274 = OpFMul %float %1271 %1273 + %1275 = OpFAdd %float %1272 %1274 + %1276 = OpFNegate %float %1257 + %1277 = OpFSub %float %1275 %1257 + %1278 = OpShiftRightLogical %uint %1252 %uint_23 + %1279 = OpIAdd %uint %1278 %uint_4294967169 + %1280 = OpBitwiseOr %uint %1252 %uint_1065353216 + %1281 = OpBitcast %float %1280 + %1282 = OpFAdd %float %1281 %float_n1 + %1283 = OpBitcast %uint %1282 + %1284 = OpShiftRightArithmetic %uint %1283 %uint_23 + %1285 = OpIAdd %uint %1284 %uint_4294967043 + %1286 = OpULessThan %bool %1252 %uint_8388608 + %1287 = OpSelect %uint %1286 %1283 %1252 + %1288 = OpSelect %uint %1286 %1285 %1279 + %1289 = OpConvertSToF %float %1288 + %1290 = OpBitwiseAnd %uint %1287 %uint_8323072 + %1291 = OpShiftLeftLogical %uint %1287 %uint_1 + %1292 = OpBitwiseAnd %uint %1291 %uint_65536 + %1293 = OpIAdd %uint %1292 %1290 + %1294 = OpBitwiseOr %uint %1293 %uint_1056964608 + %1295 = OpBitcast %float %1294 + %1296 = OpBitwiseAnd %uint %1287 %uint_8388607 + %1297 = OpBitwiseOr %uint %1296 %uint_1056964608 + %1298 = OpBitcast %float %1297 + %1299 = OpFSub %float %1295 %1298 + %1300 = OpShiftRightLogical %uint %1293 %uint_16 + %1301 = OpAccessChain %_ptr_Private_float %771 %1300 %uint_0 + %1302 = OpLoad %float %1301 + %1303 = OpFMul %float %1299 %1302 + %1304 = OpAccessChain %_ptr_Private_float %771 %1300 %uint_1 + %1305 = OpLoad %float %1304 + %1306 = OpFMul %float %1299 %1305 + %1307 = OpFAdd %float %1303 %1306 + %1308 = OpFMul %float %1307 %float_0_25 + %1309 = OpFAdd %float %1308 %float_0_333333343 + %1310 = OpFMul %float %1307 %1309 + %1311 = OpFAdd %float %1310 %float_0_5 + %1312 = OpFMul %float %1307 %1307 + %1313 = OpFMul %float %1312 %1311 + %1314 = OpFSub %float %1303 %1307 + %1315 = OpFAdd %float %1306 %1314 + %1316 = OpFAdd %float %1315 %1313 + %1317 = OpAccessChain %_ptr_Private_v2float %405 %1300 + %1318 = OpLoad %v2float %1317 + %1319 = OpFNegate %float %1307 + %1320 = OpFMul %float %1289 %float_3_19461833en05 + %1321 = OpFSub %float %1320 %1316 + %1322 = OpCompositeExtract %float %1318 1 + %1323 = OpFAdd %float %1322 %1321 + %1324 = OpFSub %float %1323 %1307 + %1325 = OpCompositeExtract %float %1318 0 + %1326 = OpFMul %float %1289 %float_0_693115234 + %1327 = OpFAdd %float %1326 %1325 + %1328 = OpFAdd %float %1327 %1324 + %1329 = OpSelect %float %1261 %1272 %1319 + %1330 = OpSelect %float %1261 %1274 %1323 + %1331 = OpSelect %float %1261 %1275 %1324 + %1332 = OpSelect %float %1261 %1276 %1327 + %1333 = OpSelect %float %1261 %1277 %1328 + %1334 = OpBitcast %uint %1333 + %1335 = OpBitwiseAnd %uint %1334 %uint_4294963200 + %1336 = OpBitcast %float %1335 + %1337 = OpFSub %float %1331 %1329 + %1338 = OpFSub %float %1330 %1337 + %1339 = OpFSub %float %1332 %1333 + %1340 = OpFAdd %float %1331 %1339 + %1341 = OpFAdd %float %1338 %1340 + %1342 = OpFSub %float %1333 %1336 + %1343 = OpFAdd %float %1341 %1342 + %1344 = OpBitwiseAnd %uint %1253 %uint_4294963200 + %1345 = OpBitcast %float %1344 + %1346 = OpConvertFToS %uint %1345 + %1347 = OpISub %uint %1249 %1346 + %1348 = OpConvertSToF %float %1347 + %1349 = OpFMul %float %1343 %1348 + %1350 = OpFMul %float %1348 %1336 + %1351 = OpFAdd %float %1350 %1349 + %1352 = OpFMul %float %1343 %1345 + %1353 = OpFAdd %float %1352 %1351 + %1354 = OpFMul %float %1345 %1336 + %1355 = OpFAdd %float %1354 %1353 + %1356 = OpFSub %float %1354 %1355 + %1357 = OpFAdd %float %1353 %1356 + %1358 = OpFMul %float %1355 %float_92_3324814 + %1359 = OpConvertFToS %uint %1358 + %1360 = OpConvertSToF %float %1359 + %1361 = OpBitwiseAnd %uint %1359 %uint_63 + %1362 = OpShiftRightArithmetic %uint %1359 %uint_6 + %1363 = OpShiftLeftLogical %uint %1362 %uint_23 + %1364 = OpFMul %float %1360 %float_0_0108032227 + %1365 = OpFSub %float %1355 %1364 + %1366 = OpFMul %float %1360 %float_2_72020388en05 + %1367 = OpFSub %float %1365 %1366 + %1368 = OpFAdd %float %1357 %1367 + %1369 = OpFMul %float %1368 %float_0_0416666679 + %1370 = OpFAdd %float %1369 %float_0_166666672 + %1371 = OpFMul %float %1368 %1370 + %1372 = OpFAdd %float %1371 %float_0_5 + %1373 = OpFMul %float %1368 %1368 + %1374 = OpFMul %float %1373 %1372 + %1375 = OpFAdd %float %1368 %1374 + %1376 = OpAccessChain %_ptr_Private_float %958 %1361 %uint_0 + %1377 = OpLoad %float %1376 + %1378 = OpAccessChain %_ptr_Private_float %958 %1361 %uint_1 + %1379 = OpLoad %float %1378 + %1380 = OpFMul %float %1379 %1375 + %1381 = OpFAdd %float %1379 %1380 + %1382 = OpFMul %float %1377 %1375 + %1383 = OpFAdd %float %1382 %1381 + %1384 = OpFAdd %float %1377 %1383 + %1385 = OpIAdd %uint %1362 %uint_21 + %1386 = OpBitwiseAnd %uint %1385 %uint_31 + %1387 = OpShiftLeftLogical %uint %uint_1 %1386 + %1388 = OpBitcast %float %1387 + %1389 = OpFMul %float %1384 %1388 + %1390 = OpBitcast %uint %1384 + %1391 = OpIAdd %uint %1363 %1390 + %1392 = OpBitcast %float %1391 + %1393 = OpSLessThan %bool %1359 %uint_4294959296 + %1394 = OpSelect %float %1393 %1389 %1392 + %1395 = OpFOrdGreaterThan %bool %1355 %float_88_7228394 + %1396 = OpFOrdEqual %bool %1355 %float_88_7228394 + %1397 = OpFOrdGreaterThan %bool %1357 %float_n2_43795739en07 + %1398 = OpLogicalAnd %bool %1396 %1397 + %1399 = OpLogicalOr %bool %1395 %1398 + %1400 = OpSelect %float %1399 %float_0x1p_128 %1394 + %1401 = OpFOrdLessThan %bool %1355 %float_n103_278931 + %1402 = OpSelect %float %1401 %float_0 %1400 + %1403 = OpBitwiseAnd %uint %1249 %uint_1 + %1404 = OpFNegate %float %1402 + %1405 = OpShiftRightLogical %uint %1251 %uint_31 + %1406 = OpBitwiseAnd %uint %1405 %1249 + %1407 = OpIEqual %bool %1406 %uint_0 + %1408 = OpSelect %float %1407 %1402 %1404 + %1409 = OpBitcast %uint %1408 + %1410 = OpBitwiseAnd %uint %1251 %uint_2147483648 + %1411 = OpBitwiseOr %uint %1410 %uint_2139095040 + %1412 = OpIEqual %bool %1252 %uint_0 + %1413 = OpSelect %uint %1412 %uint_1 %uint_0 + %1414 = OpLogicalNot %bool %1254 + %1415 = OpSelect %uint %1414 %uint_1 %uint_0 + %1416 = OpBitwiseAnd %uint %1413 %1415 + %1417 = OpBitwiseAnd %uint %1416 %1403 + %1418 = OpIEqual %bool %1417 %uint_0 + %1419 = OpSelect %uint %1418 %1409 %1411 + %1420 = OpBitwiseXor %uint %1403 %uint_1 + %1421 = OpBitwiseAnd %uint %1416 %1420 + %1422 = OpIEqual %bool %1421 %uint_0 + %1423 = OpSelect %uint %1422 %1419 %uint_2139095040 + %1424 = OpBitwiseAnd %uint %1413 %1255 + %1425 = OpIEqual %bool %1251 %uint_4286578688 + %1426 = OpSelect %uint %1425 %uint_1 %uint_0 + %1427 = OpBitwiseAnd %uint %1415 %1426 + %1428 = OpBitwiseAnd %uint %1255 %1426 + %1429 = OpIEqual %bool %1251 %uint_2139095040 + %1430 = OpSelect %uint %1429 %uint_1 %uint_0 + %1431 = OpCompositeInsert %v8uint %1430 %1214 0 + %1432 = OpCompositeInsert %v8uint %1428 %1431 1 + %1433 = OpCompositeInsert %v8uint %1427 %1432 2 + %1434 = OpCompositeInsert %v8uint %1424 %1433 3 + %1435 = OpVectorShuffle %v8uint %1434 %1214 0 0 1 1 2 2 3 3 + %1436 = OpCompositeInsert %v8uint %1255 %1214 0 + %1437 = OpCompositeInsert %v8uint %1415 %1436 1 + %1438 = OpCompositeInsert %v8uint %1420 %1437 2 + %1439 = OpCompositeInsert %v8uint %1403 %1438 3 + %1440 = OpVectorShuffle %v8uint %1439 %1214 0 1 2 3 2 3 3 2 + %1441 = OpBitwiseAnd %v8uint %1435 %1440 + %1442 = OpIEqual %v8bool %1441 %1227 + %1443 = OpCompositeExtract %bool %1442 7 + %1444 = OpSelect %uint %1443 %1423 %uint_0 + %1445 = OpCompositeExtract %bool %1442 6 + %1446 = OpSelect %uint %1445 %1444 %1410 + %1447 = OpCompositeExtract %bool %1442 5 + %1448 = OpSelect %uint %1447 %1446 %uint_2147483648 + %1449 = OpCompositeExtract %bool %1442 4 + %1450 = OpSelect %uint %1449 %1448 %uint_0 + %1451 = OpCompositeExtract %bool %1442 3 + %1452 = OpSelect %uint %1451 %1450 %uint_4286578688 + %1453 = OpCompositeExtract %bool %1442 2 + %1454 = OpSelect %uint %1453 %1452 %uint_2139095040 + %1455 = OpCompositeExtract %bool %1442 1 + %1456 = OpSelect %uint %1455 %1454 %uint_0 + %1457 = OpCompositeExtract %bool %1442 0 + %1458 = OpSelect %uint %1457 %1456 %uint_2139095040 + %1459 = OpUGreaterThan %bool %1252 %uint_2139095040 + %1460 = OpSelect %uint %1459 %1251 %1458 + %1461 = OpIEqual %bool %1249 %uint_0 + %1462 = OpSelect %uint %1461 %uint_1065353216 %1460 + %1463 = OpCompositeConstruct %v2uint %1248 %1462 + %1464 = OpCompositeExtract %uint %988 2 + %1465 = OpConvertSToF %float %1464 + %1466 = OpCompositeExtract %uint %984 2 + %1467 = OpBitwiseAnd %uint %1466 %uint_2147483647 + %1468 = OpBitcast %uint %1465 + %1469 = OpSGreaterThan %bool %1464 %uint_4294967295 + %1470 = OpSelect %uint %1469 %uint_1 %uint_0 + %1471 = OpBitcast %float %1467 + %1472 = OpFSub %float %float_1 %1471 + %1473 = OpBitcast %uint %1472 + %1474 = OpBitwiseAnd %uint %1473 %uint_2147483647 + %1475 = OpBitcast %float %1474 + %1476 = OpFOrdLessThan %bool %1475 %float_0_0625 + %1477 = OpFMul %float %1472 %1472 + %1478 = OpFMul %float %1472 %float_0_142857149 + %1479 = OpFAdd %float %1478 %float_0_166666672 + %1480 = OpFMul %float %1472 %1479 + %1481 = OpFAdd %float %1480 %float_0_200000003 + %1482 = OpFMul %float %1472 %1481 + %1483 = OpFAdd %float %1482 %float_0_25 + %1484 = OpFMul %float %1472 %1483 + %1485 = OpFAdd %float %1484 %float_0_333333343 + %1486 = OpFMul %float %1472 %1477 + %1487 = OpFMul %float %1477 %float_n0_5 + %1488 = OpFNegate %float %1485 + %1489 = OpFMul %float %1486 %1488 + %1490 = OpFAdd %float %1487 %1489 + %1491 = OpFNegate %float %1472 + %1492 = OpFSub %float %1490 %1472 + %1493 = OpShiftRightLogical %uint %1467 %uint_23 + %1494 = OpIAdd %uint %1493 %uint_4294967169 + %1495 = OpBitwiseOr %uint %1467 %uint_1065353216 + %1496 = OpBitcast %float %1495 + %1497 = OpFAdd %float %1496 %float_n1 + %1498 = OpBitcast %uint %1497 + %1499 = OpShiftRightArithmetic %uint %1498 %uint_23 + %1500 = OpIAdd %uint %1499 %uint_4294967043 + %1501 = OpULessThan %bool %1467 %uint_8388608 + %1502 = OpSelect %uint %1501 %1498 %1467 + %1503 = OpSelect %uint %1501 %1500 %1494 + %1504 = OpConvertSToF %float %1503 + %1505 = OpBitwiseAnd %uint %1502 %uint_8323072 + %1506 = OpShiftLeftLogical %uint %1502 %uint_1 + %1507 = OpBitwiseAnd %uint %1506 %uint_65536 + %1508 = OpIAdd %uint %1507 %1505 + %1509 = OpBitwiseOr %uint %1508 %uint_1056964608 + %1510 = OpBitcast %float %1509 + %1511 = OpBitwiseAnd %uint %1502 %uint_8388607 + %1512 = OpBitwiseOr %uint %1511 %uint_1056964608 + %1513 = OpBitcast %float %1512 + %1514 = OpFSub %float %1510 %1513 + %1515 = OpShiftRightLogical %uint %1508 %uint_16 + %1516 = OpAccessChain %_ptr_Private_float %771 %1515 %uint_0 + %1517 = OpLoad %float %1516 + %1518 = OpFMul %float %1514 %1517 + %1519 = OpAccessChain %_ptr_Private_float %771 %1515 %uint_1 + %1520 = OpLoad %float %1519 + %1521 = OpFMul %float %1514 %1520 + %1522 = OpFAdd %float %1518 %1521 + %1523 = OpFMul %float %1522 %float_0_25 + %1524 = OpFAdd %float %1523 %float_0_333333343 + %1525 = OpFMul %float %1522 %1524 + %1526 = OpFAdd %float %1525 %float_0_5 + %1527 = OpFMul %float %1522 %1522 + %1528 = OpFMul %float %1527 %1526 + %1529 = OpFSub %float %1518 %1522 + %1530 = OpFAdd %float %1521 %1529 + %1531 = OpFAdd %float %1530 %1528 + %1532 = OpAccessChain %_ptr_Private_v2float %405 %1515 + %1533 = OpLoad %v2float %1532 + %1534 = OpFNegate %float %1522 + %1535 = OpFMul %float %1504 %float_3_19461833en05 + %1536 = OpFSub %float %1535 %1531 + %1537 = OpCompositeExtract %float %1533 1 + %1538 = OpFAdd %float %1537 %1536 + %1539 = OpFSub %float %1538 %1522 + %1540 = OpCompositeExtract %float %1533 0 + %1541 = OpFMul %float %1504 %float_0_693115234 + %1542 = OpFAdd %float %1541 %1540 + %1543 = OpFAdd %float %1542 %1539 + %1544 = OpSelect %float %1476 %1487 %1534 + %1545 = OpSelect %float %1476 %1489 %1538 + %1546 = OpSelect %float %1476 %1490 %1539 + %1547 = OpSelect %float %1476 %1491 %1542 + %1548 = OpSelect %float %1476 %1492 %1543 + %1549 = OpBitcast %uint %1548 + %1550 = OpBitwiseAnd %uint %1549 %uint_4294963200 + %1551 = OpBitcast %float %1550 + %1552 = OpFSub %float %1546 %1544 + %1553 = OpFSub %float %1545 %1552 + %1554 = OpFSub %float %1547 %1548 + %1555 = OpFAdd %float %1546 %1554 + %1556 = OpFAdd %float %1553 %1555 + %1557 = OpFSub %float %1548 %1551 + %1558 = OpFAdd %float %1556 %1557 + %1559 = OpBitwiseAnd %uint %1468 %uint_4294963200 + %1560 = OpBitcast %float %1559 + %1561 = OpConvertFToS %uint %1560 + %1562 = OpISub %uint %1464 %1561 + %1563 = OpConvertSToF %float %1562 + %1564 = OpFMul %float %1558 %1563 + %1565 = OpFMul %float %1563 %1551 + %1566 = OpFAdd %float %1565 %1564 + %1567 = OpFMul %float %1558 %1560 + %1568 = OpFAdd %float %1567 %1566 + %1569 = OpFMul %float %1560 %1551 + %1570 = OpFAdd %float %1569 %1568 + %1571 = OpFSub %float %1569 %1570 + %1572 = OpFAdd %float %1568 %1571 + %1573 = OpFMul %float %1570 %float_92_3324814 + %1574 = OpConvertFToS %uint %1573 + %1575 = OpConvertSToF %float %1574 + %1576 = OpBitwiseAnd %uint %1574 %uint_63 + %1577 = OpShiftRightArithmetic %uint %1574 %uint_6 + %1578 = OpShiftLeftLogical %uint %1577 %uint_23 + %1579 = OpFMul %float %1575 %float_0_0108032227 + %1580 = OpFSub %float %1570 %1579 + %1581 = OpFMul %float %1575 %float_2_72020388en05 + %1582 = OpFSub %float %1580 %1581 + %1583 = OpFAdd %float %1572 %1582 + %1584 = OpFMul %float %1583 %float_0_0416666679 + %1585 = OpFAdd %float %1584 %float_0_166666672 + %1586 = OpFMul %float %1583 %1585 + %1587 = OpFAdd %float %1586 %float_0_5 + %1588 = OpFMul %float %1583 %1583 + %1589 = OpFMul %float %1588 %1587 + %1590 = OpFAdd %float %1583 %1589 + %1591 = OpAccessChain %_ptr_Private_float %958 %1576 %uint_0 + %1592 = OpLoad %float %1591 + %1593 = OpAccessChain %_ptr_Private_float %958 %1576 %uint_1 + %1594 = OpLoad %float %1593 + %1595 = OpFMul %float %1594 %1590 + %1596 = OpFAdd %float %1594 %1595 + %1597 = OpFMul %float %1592 %1590 + %1598 = OpFAdd %float %1597 %1596 + %1599 = OpFAdd %float %1592 %1598 + %1600 = OpIAdd %uint %1577 %uint_21 + %1601 = OpBitwiseAnd %uint %1600 %uint_31 + %1602 = OpShiftLeftLogical %uint %uint_1 %1601 + %1603 = OpBitcast %float %1602 + %1604 = OpFMul %float %1599 %1603 + %1605 = OpBitcast %uint %1599 + %1606 = OpIAdd %uint %1578 %1605 + %1607 = OpBitcast %float %1606 + %1608 = OpSLessThan %bool %1574 %uint_4294959296 + %1609 = OpSelect %float %1608 %1604 %1607 + %1610 = OpFOrdGreaterThan %bool %1570 %float_88_7228394 + %1611 = OpFOrdEqual %bool %1570 %float_88_7228394 + %1612 = OpFOrdGreaterThan %bool %1572 %float_n2_43795739en07 + %1613 = OpLogicalAnd %bool %1611 %1612 + %1614 = OpLogicalOr %bool %1610 %1613 + %1615 = OpSelect %float %1614 %float_0x1p_128 %1609 + %1616 = OpFOrdLessThan %bool %1570 %float_n103_278931 + %1617 = OpSelect %float %1616 %float_0 %1615 + %1618 = OpBitwiseAnd %uint %1464 %uint_1 + %1619 = OpFNegate %float %1617 + %1620 = OpShiftRightLogical %uint %1466 %uint_31 + %1621 = OpBitwiseAnd %uint %1620 %1464 + %1622 = OpIEqual %bool %1621 %uint_0 + %1623 = OpSelect %float %1622 %1617 %1619 + %1624 = OpBitcast %uint %1623 + %1625 = OpBitwiseAnd %uint %1466 %uint_2147483648 + %1626 = OpBitwiseOr %uint %1625 %uint_2139095040 + %1627 = OpIEqual %bool %1467 %uint_0 + %1628 = OpSelect %uint %1627 %uint_1 %uint_0 + %1629 = OpLogicalNot %bool %1469 + %1630 = OpSelect %uint %1629 %uint_1 %uint_0 + %1631 = OpBitwiseAnd %uint %1628 %1630 + %1632 = OpBitwiseAnd %uint %1631 %1618 + %1633 = OpIEqual %bool %1632 %uint_0 + %1634 = OpSelect %uint %1633 %1624 %1626 + %1635 = OpBitwiseXor %uint %1618 %uint_1 + %1636 = OpBitwiseAnd %uint %1631 %1635 + %1637 = OpIEqual %bool %1636 %uint_0 + %1638 = OpSelect %uint %1637 %1634 %uint_2139095040 + %1639 = OpBitwiseAnd %uint %1628 %1470 + %1640 = OpIEqual %bool %1466 %uint_4286578688 + %1641 = OpSelect %uint %1640 %uint_1 %uint_0 + %1642 = OpBitwiseAnd %uint %1630 %1641 + %1643 = OpBitwiseAnd %uint %1470 %1641 + %1644 = OpIEqual %bool %1466 %uint_2139095040 + %1645 = OpSelect %uint %1644 %uint_1 %uint_0 + %1646 = OpCompositeInsert %v8uint %1645 %1214 0 + %1647 = OpCompositeInsert %v8uint %1643 %1646 1 + %1648 = OpCompositeInsert %v8uint %1642 %1647 2 + %1649 = OpCompositeInsert %v8uint %1639 %1648 3 + %1650 = OpVectorShuffle %v8uint %1649 %1214 0 0 1 1 2 2 3 3 + %1651 = OpCompositeInsert %v8uint %1470 %1214 0 + %1652 = OpCompositeInsert %v8uint %1630 %1651 1 + %1653 = OpCompositeInsert %v8uint %1635 %1652 2 + %1654 = OpCompositeInsert %v8uint %1618 %1653 3 + %1655 = OpVectorShuffle %v8uint %1654 %1214 0 1 2 3 2 3 3 2 + %1656 = OpBitwiseAnd %v8uint %1650 %1655 + %1657 = OpIEqual %v8bool %1656 %1227 + %1658 = OpCompositeExtract %bool %1657 7 + %1659 = OpSelect %uint %1658 %1638 %uint_0 + %1660 = OpCompositeExtract %bool %1657 6 + %1661 = OpSelect %uint %1660 %1659 %1625 + %1662 = OpCompositeExtract %bool %1657 5 + %1663 = OpSelect %uint %1662 %1661 %uint_2147483648 + %1664 = OpCompositeExtract %bool %1657 4 + %1665 = OpSelect %uint %1664 %1663 %uint_0 + %1666 = OpCompositeExtract %bool %1657 3 + %1667 = OpSelect %uint %1666 %1665 %uint_4286578688 + %1668 = OpCompositeExtract %bool %1657 2 + %1669 = OpSelect %uint %1668 %1667 %uint_2139095040 + %1670 = OpCompositeExtract %bool %1657 1 + %1671 = OpSelect %uint %1670 %1669 %uint_0 + %1672 = OpCompositeExtract %bool %1657 0 + %1673 = OpSelect %uint %1672 %1671 %uint_2139095040 + %1674 = OpUGreaterThan %bool %1467 %uint_2139095040 + %1675 = OpSelect %uint %1674 %1466 %1673 + %1676 = OpIEqual %bool %1464 %uint_0 + %1677 = OpSelect %uint %1676 %uint_1065353216 %1675 + %1678 = OpCompositeExtract %uint %988 3 + %1679 = OpConvertSToF %float %1678 + %1680 = OpCompositeExtract %uint %984 3 + %1681 = OpBitwiseAnd %uint %1680 %uint_2147483647 + %1682 = OpBitcast %uint %1679 + %1683 = OpSGreaterThan %bool %1678 %uint_4294967295 + %1684 = OpSelect %uint %1683 %uint_1 %uint_0 + %1685 = OpBitcast %float %1681 + %1686 = OpFSub %float %float_1 %1685 + %1687 = OpBitcast %uint %1686 + %1688 = OpBitwiseAnd %uint %1687 %uint_2147483647 + %1689 = OpBitcast %float %1688 + %1690 = OpFOrdLessThan %bool %1689 %float_0_0625 + %1691 = OpFMul %float %1686 %1686 + %1692 = OpFMul %float %1686 %float_0_142857149 + %1693 = OpFAdd %float %1692 %float_0_166666672 + %1694 = OpFMul %float %1686 %1693 + %1695 = OpFAdd %float %1694 %float_0_200000003 + %1696 = OpFMul %float %1686 %1695 + %1697 = OpFAdd %float %1696 %float_0_25 + %1698 = OpFMul %float %1686 %1697 + %1699 = OpFAdd %float %1698 %float_0_333333343 + %1700 = OpFMul %float %1686 %1691 + %1701 = OpFMul %float %1691 %float_n0_5 + %1702 = OpFNegate %float %1699 + %1703 = OpFMul %float %1700 %1702 + %1704 = OpFAdd %float %1701 %1703 + %1705 = OpFNegate %float %1686 + %1706 = OpFSub %float %1704 %1686 + %1707 = OpShiftRightLogical %uint %1681 %uint_23 + %1708 = OpIAdd %uint %1707 %uint_4294967169 + %1709 = OpBitwiseOr %uint %1681 %uint_1065353216 + %1710 = OpBitcast %float %1709 + %1711 = OpFAdd %float %1710 %float_n1 + %1712 = OpBitcast %uint %1711 + %1713 = OpShiftRightArithmetic %uint %1712 %uint_23 + %1714 = OpIAdd %uint %1713 %uint_4294967043 + %1715 = OpULessThan %bool %1681 %uint_8388608 + %1716 = OpSelect %uint %1715 %1712 %1681 + %1717 = OpSelect %uint %1715 %1714 %1708 + %1718 = OpConvertSToF %float %1717 + %1719 = OpBitwiseAnd %uint %1716 %uint_8323072 + %1720 = OpShiftLeftLogical %uint %1716 %uint_1 + %1721 = OpBitwiseAnd %uint %1720 %uint_65536 + %1722 = OpIAdd %uint %1721 %1719 + %1723 = OpBitwiseOr %uint %1722 %uint_1056964608 + %1724 = OpBitcast %float %1723 + %1725 = OpBitwiseAnd %uint %1716 %uint_8388607 + %1726 = OpBitwiseOr %uint %1725 %uint_1056964608 + %1727 = OpBitcast %float %1726 + %1728 = OpFSub %float %1724 %1727 + %1729 = OpShiftRightLogical %uint %1722 %uint_16 + %1730 = OpAccessChain %_ptr_Private_float %771 %1729 %uint_0 + %1731 = OpLoad %float %1730 + %1732 = OpFMul %float %1728 %1731 + %1733 = OpAccessChain %_ptr_Private_float %771 %1729 %uint_1 + %1734 = OpLoad %float %1733 + %1735 = OpFMul %float %1728 %1734 + %1736 = OpFAdd %float %1732 %1735 + %1737 = OpFMul %float %1736 %float_0_25 + %1738 = OpFAdd %float %1737 %float_0_333333343 + %1739 = OpFMul %float %1736 %1738 + %1740 = OpFAdd %float %1739 %float_0_5 + %1741 = OpFMul %float %1736 %1736 + %1742 = OpFMul %float %1741 %1740 + %1743 = OpFSub %float %1732 %1736 + %1744 = OpFAdd %float %1735 %1743 + %1745 = OpFAdd %float %1744 %1742 + %1746 = OpAccessChain %_ptr_Private_v2float %405 %1729 + %1747 = OpLoad %v2float %1746 + %1748 = OpFNegate %float %1736 + %1749 = OpFMul %float %1718 %float_3_19461833en05 + %1750 = OpFSub %float %1749 %1745 + %1751 = OpCompositeExtract %float %1747 1 + %1752 = OpFAdd %float %1751 %1750 + %1753 = OpFSub %float %1752 %1736 + %1754 = OpCompositeExtract %float %1747 0 + %1755 = OpFMul %float %1718 %float_0_693115234 + %1756 = OpFAdd %float %1755 %1754 + %1757 = OpFAdd %float %1756 %1753 + %1758 = OpSelect %float %1690 %1701 %1748 + %1759 = OpSelect %float %1690 %1703 %1752 + %1760 = OpSelect %float %1690 %1704 %1753 + %1761 = OpSelect %float %1690 %1705 %1756 + %1762 = OpSelect %float %1690 %1706 %1757 + %1763 = OpBitcast %uint %1762 + %1764 = OpBitwiseAnd %uint %1763 %uint_4294963200 + %1765 = OpBitcast %float %1764 + %1766 = OpFSub %float %1760 %1758 + %1767 = OpFSub %float %1759 %1766 + %1768 = OpFSub %float %1761 %1762 + %1769 = OpFAdd %float %1760 %1768 + %1770 = OpFAdd %float %1767 %1769 + %1771 = OpFSub %float %1762 %1765 + %1772 = OpFAdd %float %1770 %1771 + %1773 = OpBitwiseAnd %uint %1682 %uint_4294963200 + %1774 = OpBitcast %float %1773 + %1775 = OpConvertFToS %uint %1774 + %1776 = OpISub %uint %1678 %1775 + %1777 = OpConvertSToF %float %1776 + %1778 = OpFMul %float %1772 %1777 + %1779 = OpFMul %float %1777 %1765 + %1780 = OpFAdd %float %1779 %1778 + %1781 = OpFMul %float %1772 %1774 + %1782 = OpFAdd %float %1781 %1780 + %1783 = OpFMul %float %1774 %1765 + %1784 = OpFAdd %float %1783 %1782 + %1785 = OpFSub %float %1783 %1784 + %1786 = OpFAdd %float %1782 %1785 + %1787 = OpFMul %float %1784 %float_92_3324814 + %1788 = OpConvertFToS %uint %1787 + %1789 = OpConvertSToF %float %1788 + %1790 = OpBitwiseAnd %uint %1788 %uint_63 + %1791 = OpShiftRightArithmetic %uint %1788 %uint_6 + %1792 = OpShiftLeftLogical %uint %1791 %uint_23 + %1793 = OpFMul %float %1789 %float_0_0108032227 + %1794 = OpFSub %float %1784 %1793 + %1795 = OpFMul %float %1789 %float_2_72020388en05 + %1796 = OpFSub %float %1794 %1795 + %1797 = OpFAdd %float %1786 %1796 + %1798 = OpFMul %float %1797 %float_0_0416666679 + %1799 = OpFAdd %float %1798 %float_0_166666672 + %1800 = OpFMul %float %1797 %1799 + %1801 = OpFAdd %float %1800 %float_0_5 + %1802 = OpFMul %float %1797 %1797 + %1803 = OpFMul %float %1802 %1801 + %1804 = OpFAdd %float %1797 %1803 + %1805 = OpAccessChain %_ptr_Private_float %958 %1790 %uint_0 + %1806 = OpLoad %float %1805 + %1807 = OpAccessChain %_ptr_Private_float %958 %1790 %uint_1 + %1808 = OpLoad %float %1807 + %1809 = OpFMul %float %1808 %1804 + %1810 = OpFAdd %float %1808 %1809 + %1811 = OpFMul %float %1806 %1804 + %1812 = OpFAdd %float %1811 %1810 + %1813 = OpFAdd %float %1806 %1812 + %1814 = OpIAdd %uint %1791 %uint_21 + %1815 = OpBitwiseAnd %uint %1814 %uint_31 + %1816 = OpShiftLeftLogical %uint %uint_1 %1815 + %1817 = OpBitcast %float %1816 + %1818 = OpFMul %float %1813 %1817 + %1819 = OpBitcast %uint %1813 + %1820 = OpIAdd %uint %1792 %1819 + %1821 = OpBitcast %float %1820 + %1822 = OpSLessThan %bool %1788 %uint_4294959296 + %1823 = OpSelect %float %1822 %1818 %1821 + %1824 = OpFOrdGreaterThan %bool %1784 %float_88_7228394 + %1825 = OpFOrdEqual %bool %1784 %float_88_7228394 + %1826 = OpFOrdGreaterThan %bool %1786 %float_n2_43795739en07 + %1827 = OpLogicalAnd %bool %1825 %1826 + %1828 = OpLogicalOr %bool %1824 %1827 + %1829 = OpSelect %float %1828 %float_0x1p_128 %1823 + %1830 = OpFOrdLessThan %bool %1784 %float_n103_278931 + %1831 = OpSelect %float %1830 %float_0 %1829 + %1832 = OpBitwiseAnd %uint %1678 %uint_1 + %1833 = OpFNegate %float %1831 + %1834 = OpShiftRightLogical %uint %1680 %uint_31 + %1835 = OpBitwiseAnd %uint %1834 %1678 + %1836 = OpIEqual %bool %1835 %uint_0 + %1837 = OpSelect %float %1836 %1831 %1833 + %1838 = OpBitcast %uint %1837 + %1839 = OpBitwiseAnd %uint %1680 %uint_2147483648 + %1840 = OpBitwiseOr %uint %1839 %uint_2139095040 + %1841 = OpIEqual %bool %1681 %uint_0 + %1842 = OpSelect %uint %1841 %uint_1 %uint_0 + %1843 = OpLogicalNot %bool %1683 + %1844 = OpSelect %uint %1843 %uint_1 %uint_0 + %1845 = OpBitwiseAnd %uint %1842 %1844 + %1846 = OpBitwiseAnd %uint %1845 %1832 + %1847 = OpIEqual %bool %1846 %uint_0 + %1848 = OpSelect %uint %1847 %1838 %1840 + %1849 = OpBitwiseXor %uint %1832 %uint_1 + %1850 = OpBitwiseAnd %uint %1845 %1849 + %1851 = OpIEqual %bool %1850 %uint_0 + %1852 = OpSelect %uint %1851 %1848 %uint_2139095040 + %1853 = OpBitwiseAnd %uint %1842 %1684 + %1854 = OpIEqual %bool %1680 %uint_4286578688 + %1855 = OpSelect %uint %1854 %uint_1 %uint_0 + %1856 = OpBitwiseAnd %uint %1844 %1855 + %1857 = OpBitwiseAnd %uint %1684 %1855 + %1858 = OpIEqual %bool %1680 %uint_2139095040 + %1859 = OpSelect %uint %1858 %uint_1 %uint_0 + %1860 = OpCompositeInsert %v8uint %1859 %1214 0 + %1861 = OpCompositeInsert %v8uint %1857 %1860 1 + %1862 = OpCompositeInsert %v8uint %1856 %1861 2 + %1863 = OpCompositeInsert %v8uint %1853 %1862 3 + %1864 = OpVectorShuffle %v8uint %1863 %1214 0 0 1 1 2 2 3 3 + %1865 = OpCompositeInsert %v8uint %1684 %1214 0 + %1866 = OpCompositeInsert %v8uint %1844 %1865 1 + %1867 = OpCompositeInsert %v8uint %1849 %1866 2 + %1868 = OpCompositeInsert %v8uint %1832 %1867 3 + %1869 = OpVectorShuffle %v8uint %1868 %1214 0 1 2 3 2 3 3 2 + %1870 = OpBitwiseAnd %v8uint %1864 %1869 + %1871 = OpIEqual %v8bool %1870 %1227 + %1872 = OpCompositeExtract %bool %1871 7 + %1873 = OpSelect %uint %1872 %1852 %uint_0 + %1874 = OpCompositeExtract %bool %1871 6 + %1875 = OpSelect %uint %1874 %1873 %1839 + %1876 = OpCompositeExtract %bool %1871 5 + %1877 = OpSelect %uint %1876 %1875 %uint_2147483648 + %1878 = OpCompositeExtract %bool %1871 4 + %1879 = OpSelect %uint %1878 %1877 %uint_0 + %1880 = OpCompositeExtract %bool %1871 3 + %1881 = OpSelect %uint %1880 %1879 %uint_4286578688 + %1882 = OpCompositeExtract %bool %1871 2 + %1883 = OpSelect %uint %1882 %1881 %uint_2139095040 + %1884 = OpCompositeExtract %bool %1871 1 + %1885 = OpSelect %uint %1884 %1883 %uint_0 + %1886 = OpCompositeExtract %bool %1871 0 + %1887 = OpSelect %uint %1886 %1885 %uint_2139095040 + %1888 = OpUGreaterThan %bool %1681 %uint_2139095040 + %1889 = OpSelect %uint %1888 %1680 %1887 + %1890 = OpIEqual %bool %1678 %uint_0 + %1891 = OpSelect %uint %1890 %uint_1065353216 %1889 + %1892 = OpCompositeConstruct %v2uint %1677 %1891 + %1893 = OpVectorShuffle %v4uint %1463 %1892 0 1 2 3 + %1894 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %1895 = OpLoad %uint %1894 + %1896 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %1897 = OpLoad %uint %1896 + %1898 = OpIAdd %uint %1895 %1897 + %1899 = OpBitcast %v4float %1893 + %1900 = OpAccessChain %_ptr_StorageBuffer_v4float %963 %uint_0 %1898 + OpStore %1900 %1899 + OpReturn + OpFunctionEnd + %1914 = OpExtInst %void %1902 PushConstantRegionOffset %uint_0 %uint_12 + %1906 = OpExtInst %void %1902 Kernel %971 %1903 %uint_2 %uint_0 %1904 + %1908 = OpExtInst %void %1902 ArgumentInfo %1907 + %1909 = OpExtInst %void %1902 ArgumentStorageBuffer %1906 %uint_0 %uint_0 %uint_0 %1908 + %1911 = OpExtInst %void %1902 ArgumentInfo %1910 + %1912 = OpExtInst %void %1902 ArgumentStorageBuffer %1906 %uint_1 %uint_0 %uint_1 %1911 + %1915 = OpExtInst %void %1902 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc2.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc2.spv.dis new file mode 100644 index 0000000000..a1b263296d --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc2.spv.dis @@ -0,0 +1,70 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %41 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %42 = OpString "foo" + %43 = OpString " __kernel" + %45 = OpString "shared" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_264 = OpConstant %uint 264 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %22 = OpLoad %uint %21 + %24 = OpBitwiseXor %uint %22 %uint_1 + %26 = OpUGreaterThan %bool %24 %22 + %28 = OpBitwiseAnd %uint %22 %uint_2 + %29 = OpIEqual %bool %28 %uint_0 + %30 = OpLogicalAnd %bool %26 %29 + OpSelectionMerge %39 None + OpBranchConditional %30 %33 %39 + %33 = OpLabel + %35 = OpAccessChain %_ptr_Workgroup_uint %14 %22 + %36 = OpLoad %uint %35 + %37 = OpAccessChain %_ptr_Workgroup_uint %14 %24 + OpStore %37 %36 + OpBranch %39 + %39 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpReturn + OpFunctionEnd + %44 = OpExtInst %void %41 Kernel %17 %42 %uint_1 %uint_0 %43 + %46 = OpExtInst %void %41 ArgumentInfo %45 + %49 = OpExtInst %void %41 ArgumentWorkgroup %44 %uint_0 %uint_3 %uint_4 %46 + %50 = OpExtInst %void %41 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc3.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc3.spv.dis new file mode 100644 index 0000000000..5a9fa3e081 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc3.spv.dis @@ -0,0 +1,39 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %13 "k" %gl_LocalInvocationID %10 + OpSource OpenCL_C 200 + %16 = OpString "k" + %17 = OpString " __kernel" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %13 = OpFunction %void Pure|Const %12 + %14 = OpLabel + OpReturn + OpFunctionEnd + %20 = OpExtInst %void %15 Kernel %13 %16 %uint_1 %uint_0 %17 + %22 = OpExtInst %void %15 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc4.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc4.spv.dis new file mode 100644 index 0000000000..76fefda694 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc4.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %18 = OpExtInst %void %13 Kernel %11 %14 %uint_2 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc7.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc7.spv.dis new file mode 100644 index 0000000000..91573a6515 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc7.spv.dis @@ -0,0 +1,126 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 87 +; Schema: 0 + OpCapability Shader + OpCapability Float64 + %65 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %31 "float_const" %gl_GlobalInvocationID %13 %18 %22 %27 %28 %5 + OpSource OpenCL_C 200 + %66 = OpString "float_const" + %67 = OpString " __kernel" + %70 = OpString "in1" + %73 = OpString "out1" + %76 = OpString "in2" + %80 = OpString "out2" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_double ArrayStride 8 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_20 0 Offset 0 + OpDecorate %_struct_20 Block + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_25 0 Offset 0 + OpDecorate %_struct_25 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 1 + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 2 + OpDecorate %28 DescriptorSet 0 + OpDecorate %28 Binding 3 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %double = OpTypeFloat 64 +%_runtimearr_double = OpTypeRuntimeArray %double + %_struct_16 = OpTypeStruct %_runtimearr_double +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_20 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_20 = OpTypePointer StorageBuffer %_struct_20 + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_25 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_25 = OpTypePointer StorageBuffer %_struct_25 + %void = OpTypeVoid + %30 = OpTypeFunction %void +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_StorageBuffer_double = OpTypePointer StorageBuffer %double + %bool = OpTypeBool +%double_0x1p_1024 = OpConstant %double 0x1p+1024 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float +%float_0x1p_128 = OpConstant %float 0x1p+128 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %22 = OpVariable %_ptr_StorageBuffer__struct_20 StorageBuffer + %27 = OpVariable %_ptr_StorageBuffer__struct_25 StorageBuffer + %28 = OpVariable %_ptr_StorageBuffer__struct_20 StorageBuffer + %31 = OpFunction %void None %30 + %32 = OpLabel + %35 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %39 = OpLoad %uint %38 + %40 = OpIAdd %uint %39 %36 + %42 = OpAccessChain %_ptr_StorageBuffer_double %18 %uint_0 %40 + %43 = OpLoad %double %42 + %46 = OpFOrdEqual %bool %43 %double_0x1p_1024 + %47 = OpIAdd %uint %39 %36 + %49 = OpAccessChain %_ptr_StorageBuffer_uint %22 %uint_0 %47 + %51 = OpSelect %uint %46 %uint_1 %uint_0 + OpStore %49 %51 + %52 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %53 = OpLoad %uint %52 + %54 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %55 = OpLoad %uint %54 + %56 = OpIAdd %uint %55 %53 + %58 = OpAccessChain %_ptr_StorageBuffer_float %27 %uint_0 %56 + %59 = OpLoad %float %58 + %61 = OpFOrdEqual %bool %59 %float_0x1p_128 + %62 = OpSelect %uint %61 %uint_1 %uint_0 + %63 = OpIAdd %uint %55 %53 + %64 = OpAccessChain %_ptr_StorageBuffer_uint %28 %uint_0 %63 + OpStore %64 %62 + OpReturn + OpFunctionEnd + %85 = OpExtInst %void %65 PushConstantRegionOffset %uint_0 %uint_12 + %69 = OpExtInst %void %65 Kernel %31 %66 %uint_4 %uint_0 %67 + %71 = OpExtInst %void %65 ArgumentInfo %70 + %72 = OpExtInst %void %65 ArgumentStorageBuffer %69 %uint_0 %uint_0 %uint_0 %71 + %74 = OpExtInst %void %65 ArgumentInfo %73 + %75 = OpExtInst %void %65 ArgumentStorageBuffer %69 %uint_1 %uint_0 %uint_1 %74 + %77 = OpExtInst %void %65 ArgumentInfo %76 + %79 = OpExtInst %void %65 ArgumentStorageBuffer %69 %uint_2 %uint_0 %uint_2 %77 + %81 = OpExtInst %void %65 ArgumentInfo %80 + %83 = OpExtInst %void %65 ArgumentStorageBuffer %69 %uint_3 %uint_0 %uint_3 %81 + %86 = OpExtInst %void %65 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc8.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc8.spv.dis new file mode 100644 index 0000000000..ab502fbbaa --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/misc/pass/misc8.spv.dis @@ -0,0 +1,83 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %47 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %13 %18 %5 + OpSource OpenCL_C 200 + %48 = OpString "foo" + %49 = OpString " __kernel" + %52 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_16 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %float_n1 = OpConstant %float -1 +%uint_2147483647 = OpConstant %uint 2147483647 + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %26 %29 + %32 = OpAccessChain %_ptr_StorageBuffer_float %18 %uint_0 %30 + %33 = OpLoad %float %32 + %36 = OpFUnordNotEqual %bool %33 %float_0 + OpSelectionMerge %46 None + OpBranchConditional %36 %39 %46 + %39 = OpLabel + %41 = OpBitcast %uint %float_n1 + %43 = OpBitwiseAnd %uint %41 %uint_2147483647 + %44 = OpBitcast %float %43 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd + %56 = OpExtInst %void %47 PushConstantRegionOffset %uint_0 %uint_12 + %51 = OpExtInst %void %47 Kernel %21 %48 %uint_1 %uint_0 %49 + %53 = OpExtInst %void %47 ArgumentInfo %52 + %54 = OpExtInst %void %47 ArgumentStorageBuffer %51 %uint_0 %uint_0 %uint_0 %53 + %58 = OpExtInst %void %47 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/modifyparam.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/modifyparam.spv.dis new file mode 100644 index 0000000000..31e32b91a4 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/modifyparam.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %18 = OpExtInst %void %13 Kernel %11 %14 %uint_1 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/multidimarrays/test1.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/multidimarrays/test1.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/multidimarrays/test1.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/multidimarrays/test2.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/multidimarrays/test2.spv.dis new file mode 100644 index 0000000000..8357c18766 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/multidimarrays/test2.spv.dis @@ -0,0 +1,39 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %13 "foo" %gl_LocalInvocationID %10 + OpSource OpenCL_C 200 + %16 = OpString "foo" + %17 = OpString " __kernel" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %13 = OpFunction %void Pure|Const %12 + %14 = OpLabel + OpReturn + OpFunctionEnd + %19 = OpExtInst %void %15 Kernel %13 %16 %uint_0 %uint_0 %17 + %22 = OpExtInst %void %15 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/multidimarrays/test3.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/multidimarrays/test3.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/multidimarrays/test3.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/multidimarrays/test4.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/multidimarrays/test4.spv.dis new file mode 100644 index 0000000000..8357c18766 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/multidimarrays/test4.spv.dis @@ -0,0 +1,39 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %13 "foo" %gl_LocalInvocationID %10 + OpSource OpenCL_C 200 + %16 = OpString "foo" + %17 = OpString " __kernel" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %13 = OpFunction %void Pure|Const %12 + %14 = OpLabel + OpReturn + OpFunctionEnd + %19 = OpExtInst %void %15 Kernel %13 %16 %uint_0 %uint_0 %17 + %22 = OpExtInst %void %15 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/multidimarrays/test5.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/multidimarrays/test5.spv.dis new file mode 100644 index 0000000000..99c1260c96 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/multidimarrays/test5.spv.dis @@ -0,0 +1,52 @@ +; @Input: %12 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %15 "foo" %8 %12 + OpSource OpenCL_C 200 + %21 = OpString "foo" + %22 = OpString " __kernel" + %25 = OpString "A" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_10 0 Offset 0 + OpDecorate %_struct_10 Block + OpDecorate %12 DescriptorSet 0 + OpDecorate %12 Binding 0 + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_10 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_10 = OpTypePointer StorageBuffer %_struct_10 + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %12 = OpVariable %_ptr_StorageBuffer__struct_10 StorageBuffer + %15 = OpFunction %void None %14 + %16 = OpLabel + %19 = OpAccessChain %_ptr_StorageBuffer_uint %12 %uint_0 %uint_0 + OpStore %19 %uint_0 + OpReturn + OpFunctionEnd + %24 = OpExtInst %void %20 Kernel %15 %21 %uint_1 %uint_0 %22 + %26 = OpExtInst %void %20 ArgumentInfo %25 + %27 = OpExtInst %void %20 ArgumentStorageBuffer %24 %uint_0 %uint_0 %uint_0 %26 + %29 = OpExtInst %void %20 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/multiplelocals.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/multiplelocals.spv.dis new file mode 100644 index 0000000000..31e32b91a4 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/multiplelocals.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %18 = OpExtInst %void %13 Kernel %11 %14 %uint_1 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/multiplelocals2.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/multiplelocals2.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/multiplelocals2.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/no_log/pass.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/no_log/pass.spv.dis new file mode 100644 index 0000000000..23758790e6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/no_log/pass.spv.dis @@ -0,0 +1,55 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %25 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %26 = OpString "foo" + %27 = OpString " __kernel" + %30 = OpString "A" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Workgroup_uint %14 %uint_0 + %23 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %24 = OpLoad %uint %23 + OpStore %21 %24 + OpReturn + OpFunctionEnd + %29 = OpExtInst %void %25 Kernel %17 %26 %uint_1 %uint_0 %27 + %31 = OpExtInst %void %25 ArgumentInfo %30 + %34 = OpExtInst %void %25 ArgumentWorkgroup %29 %uint_0 %uint_3 %uint_4 %31 + %36 = OpExtInst %void %25 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/noraceduetoreturn.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/noraceduetoreturn.spv.dis new file mode 100644 index 0000000000..355fecbb81 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/noraceduetoreturn.spv.dis @@ -0,0 +1,64 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + %35 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %18 "foo" %gl_LocalInvocationID %10 %15 + OpSource OpenCL_C 200 + %36 = OpString "foo" + %37 = OpString " __kernel" + %40 = OpString "A" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 + %float = OpTypeFloat 32 +%_arr_float_11 = OpTypeArray %float %11 +%_ptr_Workgroup__arr_float_11 = OpTypePointer Workgroup %_arr_float_11 + %void = OpTypeVoid + %17 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool +%_ptr_Workgroup_float = OpTypePointer Workgroup %float + %uint_4 = OpConstant %uint 4 +%float_26_7999992 = OpConstant %float 26.7999992 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %15 = OpVariable %_ptr_Workgroup__arr_float_11 Workgroup + %18 = OpFunction %void None %17 + %19 = OpLabel + %22 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %23 = OpLoad %uint %22 + %25 = OpIEqual %bool %23 %uint_0 + OpSelectionMerge %34 None + OpBranchConditional %25 %28 %34 + %28 = OpLabel + %31 = OpAccessChain %_ptr_Workgroup_float %15 %uint_4 + OpStore %31 %float_26_7999992 + OpBranch %34 + %34 = OpLabel + OpReturn + OpFunctionEnd + %39 = OpExtInst %void %35 Kernel %18 %36 %uint_1 %uint_0 %37 + %41 = OpExtInst %void %35 ArgumentInfo %40 + %43 = OpExtInst %void %35 ArgumentWorkgroup %39 %uint_0 %uint_3 %uint_4 %41 + %45 = OpExtInst %void %35 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/notunaryoptest.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/notunaryoptest.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/notunaryoptest.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/null_pointers/atomic_null.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/null_pointers/atomic_null.spv.dis new file mode 100644 index 0000000000..793cf7d620 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/null_pointers/atomic_null.spv.dis @@ -0,0 +1,41 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointersStorageBuffer + %18 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %19 = OpString "foo" + %20 = OpString " kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %14 = OpConstantNull %_ptr_StorageBuffer_uint + %uint_1 = OpConstant %uint 1 + %uint_80 = OpConstant %uint 80 + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void None %10 + %12 = OpLabel + %17 = OpAtomicIIncrement %uint %14 %uint_1 %uint_80 + OpReturn + OpFunctionEnd + %22 = OpExtInst %void %18 Kernel %11 %19 %uint_0 %uint_0 %20 + %24 = OpExtInst %void %18 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/null_pointers/load_from_null.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/null_pointers/load_from_null.spv.dis new file mode 100644 index 0000000000..6510f35994 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/null_pointers/load_from_null.spv.dis @@ -0,0 +1,46 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %16 "foo" %gl_GlobalInvocationID %13 %5 + OpSource OpenCL_C 200 + %19 = OpString "foo" + %20 = OpString " __kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %16 = OpFunction %void Pure|Const %15 + %17 = OpLabel + OpReturn + OpFunctionEnd + %25 = OpExtInst %void %18 PushConstantRegionOffset %uint_0 %uint_12 + %23 = OpExtInst %void %18 Kernel %16 %19 %uint_1 %uint_0 %20 + %27 = OpExtInst %void %18 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/null_pointers/null_pointer_assignment_equal.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/null_pointers/null_pointer_assignment_equal.spv.dis new file mode 100644 index 0000000000..77108c2ce2 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/null_pointers/null_pointer_assignment_equal.spv.dis @@ -0,0 +1,97 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 69 +; Schema: 0 + OpCapability Shader + %53 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %10 %18 %14 + OpSource OpenCL_C 200 + %54 = OpString "foo" + %55 = OpString " __kernel" + %58 = OpString "A" + %61 = OpString "i" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_12 0 Offset 0 + OpMemberDecorate %_struct_12 1 Offset 16 + OpDecorate %_struct_12 Block + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint + %_struct_12 = OpTypeStruct %v3uint %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool +%_ptr_Input_uint = OpTypePointer Input %uint + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_2 = OpConstant %uint 2 + %uint_16 = OpConstant %uint 16 + %uint_4 = OpConstant %uint 4 + %uint_12 = OpConstant %uint 12 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + %28 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_1 %uint_0 + %29 = OpLoad %uint %28 + %31 = OpINotEqual %bool %29 %uint_0 + %33 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %34 = OpLoad %uint %33 + %35 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %36 = OpLoad %uint %35 + %37 = OpIAdd %uint %36 %34 + OpSelectionMerge %44 None + OpBranchConditional %31 %40 %44 + %40 = OpLabel + %41 = OpIAdd %uint %34 %36 + %42 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %41 + OpStore %42 %37 + OpBranch %44 + %44 = OpLabel + %45 = OpPhi %bool %false %40 %true %22 + OpSelectionMerge %50 None + OpBranchConditional %45 %48 %50 + %48 = OpLabel + OpStore %25 %37 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd + %67 = OpExtInst %void %53 PushConstantRegionOffset %uint_0 %uint_12 + %57 = OpExtInst %void %53 Kernel %21 %54 %uint_2 %uint_0 %55 + %59 = OpExtInst %void %53 ArgumentInfo %58 + %60 = OpExtInst %void %53 ArgumentStorageBuffer %57 %uint_1 %uint_0 %uint_0 %59 + %62 = OpExtInst %void %53 ArgumentInfo %61 + %65 = OpExtInst %void %53 ArgumentPodPushConstant %57 %uint_0 %uint_16 %uint_4 %62 + %68 = OpExtInst %void %53 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/null_pointers/null_pointer_assignment_unequal.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/null_pointers/null_pointer_assignment_unequal.spv.dis new file mode 100644 index 0000000000..a93584cc3c --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/null_pointers/null_pointer_assignment_unequal.spv.dis @@ -0,0 +1,97 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 69 +; Schema: 0 + OpCapability Shader + %53 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %10 %18 %14 + OpSource OpenCL_C 200 + %54 = OpString "foo" + %55 = OpString " __kernel" + %58 = OpString "A" + %61 = OpString "i" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_12 0 Offset 0 + OpMemberDecorate %_struct_12 1 Offset 16 + OpDecorate %_struct_12 Block + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint + %_struct_12 = OpTypeStruct %v3uint %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool +%_ptr_Input_uint = OpTypePointer Input %uint + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_2 = OpConstant %uint 2 + %uint_16 = OpConstant %uint 16 + %uint_4 = OpConstant %uint 4 + %uint_12 = OpConstant %uint 12 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + %28 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_1 %uint_0 + %29 = OpLoad %uint %28 + %31 = OpINotEqual %bool %29 %uint_0 + %33 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %34 = OpLoad %uint %33 + %35 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %36 = OpLoad %uint %35 + %37 = OpIAdd %uint %36 %34 + OpSelectionMerge %42 None + OpBranchConditional %31 %40 %42 + %40 = OpLabel + OpStore %25 %37 + OpBranch %42 + %42 = OpLabel + %43 = OpPhi %bool %false %40 %true %22 + OpSelectionMerge %50 None + OpBranchConditional %43 %46 %50 + %46 = OpLabel + %47 = OpIAdd %uint %34 %36 + %48 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %47 + OpStore %48 %37 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd + %67 = OpExtInst %void %53 PushConstantRegionOffset %uint_0 %uint_12 + %57 = OpExtInst %void %53 Kernel %21 %54 %uint_2 %uint_0 %55 + %59 = OpExtInst %void %53 ArgumentInfo %58 + %60 = OpExtInst %void %53 ArgumentStorageBuffer %57 %uint_1 %uint_0 %uint_0 %59 + %62 = OpExtInst %void %53 ArgumentInfo %61 + %65 = OpExtInst %void %53 ArgumentPodPushConstant %57 %uint_0 %uint_16 %uint_4 %62 + %68 = OpExtInst %void %53 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/null_pointers/null_pointer_greater.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/null_pointers/null_pointer_greater.spv.dis new file mode 100644 index 0000000000..1bdd989cae --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/null_pointers/null_pointer_greater.spv.dis @@ -0,0 +1,98 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 70 +; Schema: 0 + OpCapability Shader + %53 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %10 %18 %14 + OpSource OpenCL_C 200 + %54 = OpString "foo" + %55 = OpString " __kernel" + %58 = OpString "A" + %61 = OpString "i" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_12 0 Offset 0 + OpMemberDecorate %_struct_12 1 Offset 16 + OpDecorate %_struct_12 Block + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint + %_struct_12 = OpTypeStruct %v3uint %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool +%_ptr_Input_uint = OpTypePointer Input %uint + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_3 = OpConstant %uint 3 + %uint_16 = OpConstant %uint 16 + %uint_4 = OpConstant %uint 4 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %uint_0 + %28 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_1 %uint_0 + %29 = OpLoad %uint %28 + %31 = OpINotEqual %bool %29 %uint_0 + %33 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %34 = OpLoad %uint %33 + %35 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %36 = OpLoad %uint %35 + %37 = OpIAdd %uint %36 %34 + OpSelectionMerge %42 None + OpBranchConditional %31 %40 %42 + %40 = OpLabel + OpStore %25 %37 + OpBranch %42 + %42 = OpLabel + %43 = OpPhi %bool %false %40 %true %22 + OpSelectionMerge %50 None + OpBranchConditional %43 %46 %50 + %46 = OpLabel + %47 = OpIAdd %uint %34 %36 + %48 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %47 + OpStore %48 %37 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd + %67 = OpExtInst %void %53 PushConstantRegionOffset %uint_0 %uint_12 + %57 = OpExtInst %void %53 Kernel %21 %54 %uint_3 %uint_0 %55 + %59 = OpExtInst %void %53 ArgumentInfo %58 + %60 = OpExtInst %void %53 ArgumentStorageBuffer %57 %uint_1 %uint_0 %uint_0 %59 + %62 = OpExtInst %void %53 ArgumentInfo %61 + %65 = OpExtInst %void %53 ArgumentPodPushConstant %57 %uint_0 %uint_16 %uint_4 %62 + %69 = OpExtInst %void %53 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/null_pointers/store_to_null_and_non_null.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/null_pointers/store_to_null_and_non_null.spv.dis new file mode 100644 index 0000000000..d8711b9140 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/null_pointers/store_to_null_and_non_null.spv.dis @@ -0,0 +1,81 @@ +; @Input: %17 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointersStorageBuffer + %41 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %20 "foo" %gl_GlobalInvocationID %13 %17 %5 + OpSource OpenCL_C 200 + %42 = OpString "foo" + %43 = OpString " __kernel" + %46 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %_ptr_StorageBuffer_uint ArrayStride 4 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %32 = OpConstantNull %_ptr_StorageBuffer_uint + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %20 = OpFunction %void None %19 + %21 = OpLabel + %24 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %25 = OpLoad %uint %24 + %27 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %28 = OpLoad %uint %27 + %29 = OpIAdd %uint %28 %25 + %30 = OpIAdd %uint %25 %28 + %33 = OpPtrAccessChain %_ptr_StorageBuffer_uint %32 %30 + OpStore %33 %29 + %34 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %35 = OpLoad %uint %34 + %36 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %37 = OpLoad %uint %36 + %38 = OpIAdd %uint %37 %35 + %39 = OpIAdd %uint %35 %37 + %40 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %39 + OpStore %40 %38 + OpReturn + OpFunctionEnd + %50 = OpExtInst %void %41 PushConstantRegionOffset %uint_0 %uint_12 + %45 = OpExtInst %void %41 Kernel %20 %42 %uint_1 %uint_0 %43 + %47 = OpExtInst %void %41 ArgumentInfo %46 + %48 = OpExtInst %void %41 ArgumentStorageBuffer %45 %uint_0 %uint_0 %uint_0 %47 + %52 = OpExtInst %void %41 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/null_statement.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/null_statement.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/null_statement.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/pointeranalysistests/manyprocedures.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/pointeranalysistests/manyprocedures.spv.dis new file mode 100644 index 0000000000..689e475482 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/pointeranalysistests/manyprocedures.spv.dis @@ -0,0 +1,248 @@ +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %22 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %23 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %24 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 191 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointersStorageBuffer + OpCapability VariablePointers + %157 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %27 "foo" %gl_GlobalInvocationID %10 %19 %20 %21 %22 %23 %24 %14 + OpSource OpenCL_C 200 + %158 = OpString "foo" + %159 = OpString " __kernel" + %162 = OpString "p" + %165 = OpString "q" + %168 = OpString "r" + %172 = OpString "s" + %176 = OpString "t" + %179 = OpString "u" + %183 = OpString "x" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_12 0 Offset 0 + OpMemberDecorate %_struct_12 1 Offset 16 + OpDecorate %_struct_12 Block + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 3 + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 4 + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 5 + OpDecorate %_ptr_StorageBuffer_float ArrayStride 4 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint + %_struct_12 = OpTypeStruct %v3uint %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_17 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %26 = OpTypeFunction %void +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_4 = OpConstant %uint 4 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_7 = OpConstant %uint 7 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_5 = OpConstant %uint 5 + %uint_6 = OpConstant %uint 6 + %uint_16 = OpConstant %uint 16 + %uint_12 = OpConstant %uint 12 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %22 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %23 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %27 = OpFunction %void None %26 + %28 = OpLabel + %31 = OpAccessChain %_ptr_StorageBuffer_float %19 %uint_0 %uint_0 + %32 = OpAccessChain %_ptr_StorageBuffer_float %20 %uint_0 %uint_0 + %35 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_1 %uint_0 + %36 = OpLoad %uint %35 + %39 = OpSGreaterThan %bool %36 %uint_4 + %40 = OpSelect %_ptr_StorageBuffer_float %39 %31 %32 + %42 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %43 = OpLoad %uint %42 + %44 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %45 = OpLoad %uint %44 + %46 = OpIAdd %uint %45 %43 + %47 = OpConvertUToF %float %46 + %48 = OpPtrAccessChain %_ptr_StorageBuffer_float %40 %46 + OpStore %48 %47 + %49 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %50 = OpLoad %uint %49 + %51 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %52 = OpLoad %uint %51 + %53 = OpIAdd %uint %52 %50 + %54 = OpConvertUToF %float %53 + %55 = OpIAdd %uint %50 %52 + %56 = OpIAdd %uint %55 %uint_1 + %57 = OpAccessChain %_ptr_StorageBuffer_float %21 %uint_0 %56 + OpStore %57 %54 + %58 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %59 = OpLoad %uint %58 + %60 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %61 = OpLoad %uint %60 + %62 = OpIAdd %uint %61 %59 + %63 = OpConvertUToF %float %62 + %64 = OpIAdd %uint %59 %61 + %65 = OpIAdd %uint %64 %uint_1 + %66 = OpAccessChain %_ptr_StorageBuffer_float %22 %uint_0 %65 + OpStore %66 %63 + %67 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %68 = OpLoad %uint %67 + %69 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %70 = OpLoad %uint %69 + %71 = OpIAdd %uint %70 %68 + %72 = OpConvertUToF %float %71 + %73 = OpIAdd %uint %68 %70 + %74 = OpIAdd %uint %73 %uint_1 + %75 = OpAccessChain %_ptr_StorageBuffer_float %23 %uint_0 %74 + OpStore %75 %72 + %76 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %77 = OpLoad %uint %76 + %78 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %79 = OpLoad %uint %78 + %80 = OpIAdd %uint %79 %77 + %81 = OpConvertUToF %float %80 + %82 = OpIAdd %uint %77 %79 + %83 = OpIAdd %uint %82 %uint_1 + %84 = OpAccessChain %_ptr_StorageBuffer_float %23 %uint_0 %83 + OpStore %84 %81 + %85 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %86 = OpLoad %uint %85 + %87 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %88 = OpLoad %uint %87 + %89 = OpIAdd %uint %88 %86 + %90 = OpConvertUToF %float %89 + %91 = OpIAdd %uint %86 %88 + %92 = OpIAdd %uint %91 %uint_1 + %93 = OpAccessChain %_ptr_StorageBuffer_float %24 %uint_0 %92 + OpStore %93 %90 + %94 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %95 = OpLoad %uint %94 + %96 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %97 = OpLoad %uint %96 + %98 = OpIAdd %uint %97 %95 + %99 = OpConvertUToF %float %98 + %100 = OpIAdd %uint %95 %97 + %101 = OpIAdd %uint %100 %uint_1 + %102 = OpAccessChain %_ptr_StorageBuffer_float %22 %uint_0 %101 + OpStore %102 %99 + %103 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %104 = OpLoad %uint %103 + %105 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %106 = OpLoad %uint %105 + %107 = OpIAdd %uint %106 %104 + %108 = OpConvertUToF %float %107 + %109 = OpIAdd %uint %104 %106 + %110 = OpIAdd %uint %109 %uint_1 + %111 = OpAccessChain %_ptr_StorageBuffer_float %21 %uint_0 %110 + OpStore %111 %108 + %112 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %113 = OpLoad %uint %112 + %114 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %115 = OpLoad %uint %114 + %116 = OpIAdd %uint %115 %113 + %117 = OpConvertUToF %float %116 + %118 = OpIAdd %uint %113 %115 + %119 = OpIAdd %uint %118 %uint_1 + %120 = OpAccessChain %_ptr_StorageBuffer_float %21 %uint_0 %119 + OpStore %120 %117 + %121 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %122 = OpLoad %uint %121 + %123 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %124 = OpLoad %uint %123 + %125 = OpIAdd %uint %124 %122 + %126 = OpConvertUToF %float %125 + %127 = OpIAdd %uint %122 %124 + %128 = OpIAdd %uint %127 %uint_1 + %129 = OpAccessChain %_ptr_StorageBuffer_float %23 %uint_0 %128 + OpStore %129 %126 + %130 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %131 = OpLoad %uint %130 + %132 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %133 = OpLoad %uint %132 + %134 = OpIAdd %uint %133 %131 + %135 = OpConvertUToF %float %134 + %136 = OpIAdd %uint %131 %133 + %137 = OpIAdd %uint %136 %uint_1 + %138 = OpAccessChain %_ptr_StorageBuffer_float %23 %uint_0 %137 + OpStore %138 %135 + %139 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %140 = OpLoad %uint %139 + %141 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %142 = OpLoad %uint %141 + %143 = OpIAdd %uint %142 %140 + %144 = OpConvertUToF %float %143 + %145 = OpIAdd %uint %140 %142 + %146 = OpIAdd %uint %145 %uint_1 + %147 = OpAccessChain %_ptr_StorageBuffer_float %22 %uint_0 %146 + OpStore %147 %144 + %148 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %149 = OpLoad %uint %148 + %150 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %151 = OpLoad %uint %150 + %152 = OpIAdd %uint %151 %149 + %153 = OpConvertUToF %float %152 + %154 = OpIAdd %uint %149 %151 + %155 = OpIAdd %uint %154 %uint_1 + %156 = OpAccessChain %_ptr_StorageBuffer_float %23 %uint_0 %155 + OpStore %156 %153 + OpReturn + OpFunctionEnd + %189 = OpExtInst %void %157 PushConstantRegionOffset %uint_0 %uint_12 + %161 = OpExtInst %void %157 Kernel %27 %158 %uint_7 %uint_0 %159 + %163 = OpExtInst %void %157 ArgumentInfo %162 + %164 = OpExtInst %void %157 ArgumentStorageBuffer %161 %uint_0 %uint_0 %uint_0 %163 + %166 = OpExtInst %void %157 ArgumentInfo %165 + %167 = OpExtInst %void %157 ArgumentStorageBuffer %161 %uint_1 %uint_0 %uint_1 %166 + %169 = OpExtInst %void %157 ArgumentInfo %168 + %171 = OpExtInst %void %157 ArgumentStorageBuffer %161 %uint_2 %uint_0 %uint_2 %169 + %173 = OpExtInst %void %157 ArgumentInfo %172 + %175 = OpExtInst %void %157 ArgumentStorageBuffer %161 %uint_3 %uint_0 %uint_3 %173 + %177 = OpExtInst %void %157 ArgumentInfo %176 + %178 = OpExtInst %void %157 ArgumentStorageBuffer %161 %uint_4 %uint_0 %uint_4 %177 + %180 = OpExtInst %void %157 ArgumentInfo %179 + %182 = OpExtInst %void %157 ArgumentStorageBuffer %161 %uint_5 %uint_0 %uint_5 %180 + %184 = OpExtInst %void %157 ArgumentInfo %183 + %187 = OpExtInst %void %157 ArgumentPodPushConstant %161 %uint_6 %uint_16 %uint_4 %184 + %190 = OpExtInst %void %157 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/pointeranalysistests/manyproceduresinlined.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/pointeranalysistests/manyproceduresinlined.spv.dis new file mode 100644 index 0000000000..689e475482 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/pointeranalysistests/manyproceduresinlined.spv.dis @@ -0,0 +1,248 @@ +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %21 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %22 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %23 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %24 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 191 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointersStorageBuffer + OpCapability VariablePointers + %157 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %27 "foo" %gl_GlobalInvocationID %10 %19 %20 %21 %22 %23 %24 %14 + OpSource OpenCL_C 200 + %158 = OpString "foo" + %159 = OpString " __kernel" + %162 = OpString "p" + %165 = OpString "q" + %168 = OpString "r" + %172 = OpString "s" + %176 = OpString "t" + %179 = OpString "u" + %183 = OpString "x" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_12 0 Offset 0 + OpMemberDecorate %_struct_12 1 Offset 16 + OpDecorate %_struct_12 Block + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 1 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 2 + OpDecorate %22 DescriptorSet 0 + OpDecorate %22 Binding 3 + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 4 + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 5 + OpDecorate %_ptr_StorageBuffer_float ArrayStride 4 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint + %_struct_12 = OpTypeStruct %v3uint %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_17 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %26 = OpTypeFunction %void +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_4 = OpConstant %uint 4 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_7 = OpConstant %uint 7 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_5 = OpConstant %uint 5 + %uint_6 = OpConstant %uint 6 + %uint_16 = OpConstant %uint 16 + %uint_12 = OpConstant %uint 12 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %22 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %23 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %24 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %27 = OpFunction %void None %26 + %28 = OpLabel + %31 = OpAccessChain %_ptr_StorageBuffer_float %19 %uint_0 %uint_0 + %32 = OpAccessChain %_ptr_StorageBuffer_float %20 %uint_0 %uint_0 + %35 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_1 %uint_0 + %36 = OpLoad %uint %35 + %39 = OpSGreaterThan %bool %36 %uint_4 + %40 = OpSelect %_ptr_StorageBuffer_float %39 %31 %32 + %42 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %43 = OpLoad %uint %42 + %44 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %45 = OpLoad %uint %44 + %46 = OpIAdd %uint %45 %43 + %47 = OpConvertUToF %float %46 + %48 = OpPtrAccessChain %_ptr_StorageBuffer_float %40 %46 + OpStore %48 %47 + %49 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %50 = OpLoad %uint %49 + %51 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %52 = OpLoad %uint %51 + %53 = OpIAdd %uint %52 %50 + %54 = OpConvertUToF %float %53 + %55 = OpIAdd %uint %50 %52 + %56 = OpIAdd %uint %55 %uint_1 + %57 = OpAccessChain %_ptr_StorageBuffer_float %21 %uint_0 %56 + OpStore %57 %54 + %58 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %59 = OpLoad %uint %58 + %60 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %61 = OpLoad %uint %60 + %62 = OpIAdd %uint %61 %59 + %63 = OpConvertUToF %float %62 + %64 = OpIAdd %uint %59 %61 + %65 = OpIAdd %uint %64 %uint_1 + %66 = OpAccessChain %_ptr_StorageBuffer_float %22 %uint_0 %65 + OpStore %66 %63 + %67 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %68 = OpLoad %uint %67 + %69 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %70 = OpLoad %uint %69 + %71 = OpIAdd %uint %70 %68 + %72 = OpConvertUToF %float %71 + %73 = OpIAdd %uint %68 %70 + %74 = OpIAdd %uint %73 %uint_1 + %75 = OpAccessChain %_ptr_StorageBuffer_float %23 %uint_0 %74 + OpStore %75 %72 + %76 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %77 = OpLoad %uint %76 + %78 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %79 = OpLoad %uint %78 + %80 = OpIAdd %uint %79 %77 + %81 = OpConvertUToF %float %80 + %82 = OpIAdd %uint %77 %79 + %83 = OpIAdd %uint %82 %uint_1 + %84 = OpAccessChain %_ptr_StorageBuffer_float %23 %uint_0 %83 + OpStore %84 %81 + %85 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %86 = OpLoad %uint %85 + %87 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %88 = OpLoad %uint %87 + %89 = OpIAdd %uint %88 %86 + %90 = OpConvertUToF %float %89 + %91 = OpIAdd %uint %86 %88 + %92 = OpIAdd %uint %91 %uint_1 + %93 = OpAccessChain %_ptr_StorageBuffer_float %24 %uint_0 %92 + OpStore %93 %90 + %94 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %95 = OpLoad %uint %94 + %96 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %97 = OpLoad %uint %96 + %98 = OpIAdd %uint %97 %95 + %99 = OpConvertUToF %float %98 + %100 = OpIAdd %uint %95 %97 + %101 = OpIAdd %uint %100 %uint_1 + %102 = OpAccessChain %_ptr_StorageBuffer_float %22 %uint_0 %101 + OpStore %102 %99 + %103 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %104 = OpLoad %uint %103 + %105 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %106 = OpLoad %uint %105 + %107 = OpIAdd %uint %106 %104 + %108 = OpConvertUToF %float %107 + %109 = OpIAdd %uint %104 %106 + %110 = OpIAdd %uint %109 %uint_1 + %111 = OpAccessChain %_ptr_StorageBuffer_float %21 %uint_0 %110 + OpStore %111 %108 + %112 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %113 = OpLoad %uint %112 + %114 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %115 = OpLoad %uint %114 + %116 = OpIAdd %uint %115 %113 + %117 = OpConvertUToF %float %116 + %118 = OpIAdd %uint %113 %115 + %119 = OpIAdd %uint %118 %uint_1 + %120 = OpAccessChain %_ptr_StorageBuffer_float %21 %uint_0 %119 + OpStore %120 %117 + %121 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %122 = OpLoad %uint %121 + %123 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %124 = OpLoad %uint %123 + %125 = OpIAdd %uint %124 %122 + %126 = OpConvertUToF %float %125 + %127 = OpIAdd %uint %122 %124 + %128 = OpIAdd %uint %127 %uint_1 + %129 = OpAccessChain %_ptr_StorageBuffer_float %23 %uint_0 %128 + OpStore %129 %126 + %130 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %131 = OpLoad %uint %130 + %132 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %133 = OpLoad %uint %132 + %134 = OpIAdd %uint %133 %131 + %135 = OpConvertUToF %float %134 + %136 = OpIAdd %uint %131 %133 + %137 = OpIAdd %uint %136 %uint_1 + %138 = OpAccessChain %_ptr_StorageBuffer_float %23 %uint_0 %137 + OpStore %138 %135 + %139 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %140 = OpLoad %uint %139 + %141 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %142 = OpLoad %uint %141 + %143 = OpIAdd %uint %142 %140 + %144 = OpConvertUToF %float %143 + %145 = OpIAdd %uint %140 %142 + %146 = OpIAdd %uint %145 %uint_1 + %147 = OpAccessChain %_ptr_StorageBuffer_float %22 %uint_0 %146 + OpStore %147 %144 + %148 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %149 = OpLoad %uint %148 + %150 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %151 = OpLoad %uint %150 + %152 = OpIAdd %uint %151 %149 + %153 = OpConvertUToF %float %152 + %154 = OpIAdd %uint %149 %151 + %155 = OpIAdd %uint %154 %uint_1 + %156 = OpAccessChain %_ptr_StorageBuffer_float %23 %uint_0 %155 + OpStore %156 %153 + OpReturn + OpFunctionEnd + %189 = OpExtInst %void %157 PushConstantRegionOffset %uint_0 %uint_12 + %161 = OpExtInst %void %157 Kernel %27 %158 %uint_7 %uint_0 %159 + %163 = OpExtInst %void %157 ArgumentInfo %162 + %164 = OpExtInst %void %157 ArgumentStorageBuffer %161 %uint_0 %uint_0 %uint_0 %163 + %166 = OpExtInst %void %157 ArgumentInfo %165 + %167 = OpExtInst %void %157 ArgumentStorageBuffer %161 %uint_1 %uint_0 %uint_1 %166 + %169 = OpExtInst %void %157 ArgumentInfo %168 + %171 = OpExtInst %void %157 ArgumentStorageBuffer %161 %uint_2 %uint_0 %uint_2 %169 + %173 = OpExtInst %void %157 ArgumentInfo %172 + %175 = OpExtInst %void %157 ArgumentStorageBuffer %161 %uint_3 %uint_0 %uint_3 %173 + %177 = OpExtInst %void %157 ArgumentInfo %176 + %178 = OpExtInst %void %157 ArgumentStorageBuffer %161 %uint_4 %uint_0 %uint_4 %177 + %180 = OpExtInst %void %157 ArgumentInfo %179 + %182 = OpExtInst %void %157 ArgumentStorageBuffer %161 %uint_5 %uint_0 %uint_5 %180 + %184 = OpExtInst %void %157 ArgumentInfo %183 + %187 = OpExtInst %void %157 ArgumentPodPushConstant %161 %uint_6 %uint_16 %uint_4 %184 + %190 = OpExtInst %void %157 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/pointeranalysistests/testbasicaliasing.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/pointeranalysistests/testbasicaliasing.spv.dis new file mode 100644 index 0000000000..b4de5704e6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/pointeranalysistests/testbasicaliasing.spv.dis @@ -0,0 +1,113 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + %66 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "foo" %gl_GlobalInvocationID %13 %18 %19 %5 + OpSource OpenCL_C 200 + %67 = OpString "foo" + %68 = OpString " __kernel" + %70 = OpString "p" + %73 = OpString "q" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %18 Coherent + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 1 + OpDecorate %19 Coherent + OpDecorate %39 NoContraction + OpDecorate %60 NoContraction + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_16 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_99 = OpConstant %uint 99 + %uint_2 = OpConstant %uint 2 + %uint_72 = OpConstant %uint 72 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + OpBranch %25 + %25 = OpLabel + %26 = OpPhi %uint %uint_0 %23 %41 %25 + %29 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %30 = OpLoad %uint %29 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %30 %33 + %36 = OpAccessChain %_ptr_StorageBuffer_float %18 %uint_0 %34 + %37 = OpLoad %float %36 + %39 = OpFAdd %float %37 %float_1 + OpStore %36 %39 + %41 = OpIAdd %uint %26 %uint_1 + %44 = OpUGreaterThanEqual %bool %26 %uint_99 + OpLoopMerge %47 %25 None + OpBranchConditional %44 %47 %25 + %47 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpBranch %51 + %51 = OpLabel + %52 = OpPhi %uint %uint_0 %47 %61 %51 + %53 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %54 = OpLoad %uint %53 + %55 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %56 = OpLoad %uint %55 + %57 = OpIAdd %uint %54 %56 + %58 = OpAccessChain %_ptr_StorageBuffer_float %19 %uint_0 %57 + %59 = OpLoad %float %58 + %60 = OpFAdd %float %59 %float_1 + OpStore %58 %60 + %61 = OpIAdd %uint %52 %uint_1 + %62 = OpUGreaterThanEqual %bool %52 %uint_99 + OpLoopMerge %65 %51 None + OpBranchConditional %62 %65 %51 + %65 = OpLabel + OpReturn + OpFunctionEnd + %77 = OpExtInst %void %66 PushConstantRegionOffset %uint_0 %uint_12 + %69 = OpExtInst %void %66 Kernel %22 %67 %uint_2 %uint_0 %68 + %71 = OpExtInst %void %66 ArgumentInfo %70 + %72 = OpExtInst %void %66 ArgumentStorageBuffer %69 %uint_0 %uint_0 %uint_0 %71 + %74 = OpExtInst %void %66 ArgumentInfo %73 + %75 = OpExtInst %void %66 ArgumentStorageBuffer %69 %uint_1 %uint_0 %uint_1 %74 + %78 = OpExtInst %void %66 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/pointeranalysistests/testbasicaliasing2.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/pointeranalysistests/testbasicaliasing2.spv.dis new file mode 100644 index 0000000000..abb904323e --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/pointeranalysistests/testbasicaliasing2.spv.dis @@ -0,0 +1,95 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 72 +; Schema: 0 + OpCapability Shader + %59 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "foo" %gl_LocalInvocationID %10 %15 %19 + OpSource OpenCL_C 200 + %60 = OpString "foo" + %61 = OpString " __kernel" + %63 = OpString "p" + %68 = OpString "q" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %16 SpecId 4 + OpDecorate %35 NoContraction + OpDecorate %53 NoContraction + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 + %float = OpTypeFloat 32 +%_arr_float_11 = OpTypeArray %float %11 +%_ptr_Workgroup__arr_float_11 = OpTypePointer Workgroup %_arr_float_11 + %16 = OpSpecConstant %uint 1 +%_arr_float_16 = OpTypeArray %float %16 +%_ptr_Workgroup__arr_float_16 = OpTypePointer Workgroup %_arr_float_16 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_float = OpTypePointer Workgroup %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_99 = OpConstant %uint 99 + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %15 = OpVariable %_ptr_Workgroup__arr_float_11 Workgroup + %19 = OpVariable %_ptr_Workgroup__arr_float_16 Workgroup + %22 = OpFunction %void None %21 + %23 = OpLabel + OpBranch %25 + %25 = OpLabel + %26 = OpPhi %uint %uint_0 %23 %37 %25 + %29 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %30 = OpLoad %uint %29 + %32 = OpAccessChain %_ptr_Workgroup_float %15 %30 + %33 = OpLoad %float %32 + %35 = OpFAdd %float %33 %float_1 + OpStore %32 %35 + %37 = OpIAdd %uint %26 %uint_1 + %40 = OpUGreaterThanEqual %bool %26 %uint_99 + OpLoopMerge %43 %25 None + OpBranchConditional %40 %43 %25 + %43 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %47 + %47 = OpLabel + %48 = OpPhi %uint %uint_0 %43 %54 %47 + %49 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %50 = OpLoad %uint %49 + %51 = OpAccessChain %_ptr_Workgroup_float %19 %50 + %52 = OpLoad %float %51 + %53 = OpFAdd %float %52 %float_1 + OpStore %51 %53 + %54 = OpIAdd %uint %48 %uint_1 + %55 = OpUGreaterThanEqual %bool %48 %uint_99 + OpLoopMerge %58 %47 None + OpBranchConditional %55 %58 %47 + %58 = OpLabel + OpReturn + OpFunctionEnd + %62 = OpExtInst %void %59 Kernel %22 %60 %uint_2 %uint_0 %61 + %64 = OpExtInst %void %59 ArgumentInfo %63 + %67 = OpExtInst %void %59 ArgumentWorkgroup %62 %uint_0 %uint_3 %uint_4 %64 + %69 = OpExtInst %void %59 ArgumentInfo %68 + %70 = OpExtInst %void %59 ArgumentWorkgroup %62 %uint_1 %uint_4 %uint_4 %69 + %71 = OpExtInst %void %59 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/pointeranalysistests/testbasicpointerarithmetic.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/pointeranalysistests/testbasicpointerarithmetic.spv.dis new file mode 100644 index 0000000000..108f06aefb --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/pointeranalysistests/testbasicpointerarithmetic.spv.dis @@ -0,0 +1,86 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 60 +; Schema: 0 + OpCapability Shader + %49 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %13 %18 %5 + OpSource OpenCL_C 200 + %50 = OpString "foo" + %51 = OpString " __kernel" + %54 = OpString "p" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %40 NoContraction + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_16 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_10 = OpConstant %uint 10 +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_99 = OpConstant %uint 99 + %uint_2 = OpConstant %uint 2 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + OpBranch %24 + %24 = OpLabel + %25 = OpPhi %uint %uint_0 %22 %42 %24 + %28 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %29 = OpLoad %uint %28 + %31 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %32 = OpLoad %uint %31 + %33 = OpIAdd %uint %29 %32 + %35 = OpIAdd %uint %33 %uint_10 + %37 = OpAccessChain %_ptr_StorageBuffer_float %18 %uint_0 %35 + %38 = OpLoad %float %37 + %40 = OpFAdd %float %38 %float_1 + OpStore %37 %40 + %42 = OpIAdd %uint %25 %uint_1 + %45 = OpUGreaterThanEqual %bool %25 %uint_99 + OpLoopMerge %48 %24 None + OpBranchConditional %45 %48 %24 + %48 = OpLabel + OpReturn + OpFunctionEnd + %58 = OpExtInst %void %49 PushConstantRegionOffset %uint_0 %uint_12 + %53 = OpExtInst %void %49 Kernel %21 %50 %uint_2 %uint_0 %51 + %55 = OpExtInst %void %49 ArgumentInfo %54 + %56 = OpExtInst %void %49 ArgumentStorageBuffer %53 %uint_0 %uint_0 %uint_0 %55 + %59 = OpExtInst %void %49 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/pointeranalysistests/testbasicpointerarithmetic2.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/pointeranalysistests/testbasicpointerarithmetic2.spv.dis new file mode 100644 index 0000000000..9950ffb17a --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/pointeranalysistests/testbasicpointerarithmetic2.spv.dis @@ -0,0 +1,72 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + %42 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %18 "foo" %gl_LocalInvocationID %10 %15 + OpSource OpenCL_C 200 + %43 = OpString "foo" + %44 = OpString " __kernel" + %47 = OpString "p" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %33 NoContraction + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 + %float = OpTypeFloat 32 +%_arr_float_11 = OpTypeArray %float %11 +%_ptr_Workgroup__arr_float_11 = OpTypePointer Workgroup %_arr_float_11 + %void = OpTypeVoid + %17 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %uint_10 = OpConstant %uint 10 +%_ptr_Workgroup_float = OpTypePointer Workgroup %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_99 = OpConstant %uint 99 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %15 = OpVariable %_ptr_Workgroup__arr_float_11 Workgroup + %18 = OpFunction %void None %17 + %19 = OpLabel + OpBranch %21 + %21 = OpLabel + %22 = OpPhi %uint %uint_0 %19 %35 %21 + %25 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpIAdd %uint %26 %uint_10 + %30 = OpAccessChain %_ptr_Workgroup_float %15 %28 + %31 = OpLoad %float %30 + %33 = OpFAdd %float %31 %float_1 + OpStore %30 %33 + %35 = OpIAdd %uint %22 %uint_1 + %38 = OpUGreaterThanEqual %bool %22 %uint_99 + OpLoopMerge %41 %21 None + OpBranchConditional %38 %41 %21 + %41 = OpLabel + OpReturn + OpFunctionEnd + %46 = OpExtInst %void %42 Kernel %18 %43 %uint_2 %uint_0 %44 + %48 = OpExtInst %void %42 ArgumentInfo %47 + %51 = OpExtInst %void %42 ArgumentWorkgroup %46 %uint_0 %uint_3 %uint_4 %48 + %52 = OpExtInst %void %42 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/pointeranalysistests/testinterprocedural.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/pointeranalysistests/testinterprocedural.spv.dis new file mode 100644 index 0000000000..3697631dfc --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/pointeranalysistests/testinterprocedural.spv.dis @@ -0,0 +1,107 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 76 +; Schema: 0 + OpCapability Shader + %62 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "foo" %gl_GlobalInvocationID %13 %18 %19 %5 + OpSource OpenCL_C 200 + %63 = OpString "foo" + %64 = OpString " __kernel" + %67 = OpString "p" + %70 = OpString "q" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 1 + OpDecorate %39 NoContraction + OpDecorate %56 NoContraction + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_16 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_99 = OpConstant %uint 99 + %uint_2 = OpConstant %uint 2 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + OpBranch %25 + %25 = OpLabel + %26 = OpPhi %uint %uint_0 %23 %41 %25 + %29 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %30 = OpLoad %uint %29 + %32 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %30 %33 + %36 = OpAccessChain %_ptr_StorageBuffer_float %18 %uint_0 %34 + %37 = OpLoad %float %36 + %39 = OpFAdd %float %37 %float_1 + OpStore %36 %39 + %41 = OpIAdd %uint %26 %uint_1 + %44 = OpUGreaterThanEqual %bool %26 %uint_99 + OpLoopMerge %47 %25 None + OpBranchConditional %44 %47 %25 + %47 = OpLabel + %48 = OpPhi %uint %57 %47 %uint_0 %25 + %49 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %50 = OpLoad %uint %49 + %51 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %52 = OpLoad %uint %51 + %53 = OpIAdd %uint %50 %52 + %54 = OpAccessChain %_ptr_StorageBuffer_float %19 %uint_0 %53 + %55 = OpLoad %float %54 + %56 = OpFAdd %float %55 %float_1 + OpStore %54 %56 + %57 = OpIAdd %uint %48 %uint_1 + %58 = OpUGreaterThanEqual %bool %48 %uint_99 + OpLoopMerge %61 %47 None + OpBranchConditional %58 %61 %47 + %61 = OpLabel + OpReturn + OpFunctionEnd + %74 = OpExtInst %void %62 PushConstantRegionOffset %uint_0 %uint_12 + %66 = OpExtInst %void %62 Kernel %22 %63 %uint_2 %uint_0 %64 + %68 = OpExtInst %void %62 ArgumentInfo %67 + %69 = OpExtInst %void %62 ArgumentStorageBuffer %66 %uint_0 %uint_0 %uint_0 %68 + %71 = OpExtInst %void %62 ArgumentInfo %70 + %72 = OpExtInst %void %62 ArgumentStorageBuffer %66 %uint_1 %uint_0 %uint_1 %71 + %75 = OpExtInst %void %62 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/pointertests/param_addressof.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/pointertests/param_addressof.spv.dis new file mode 100644 index 0000000000..76fefda694 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/pointertests/param_addressof.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %18 = OpExtInst %void %13 Kernel %11 %14 %uint_2 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/pointertests/pointerarith.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/pointertests/pointerarith.spv.dis new file mode 100644 index 0000000000..76fefda694 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/pointertests/pointerarith.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %18 = OpExtInst %void %13 Kernel %11 %14 %uint_2 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/pointertests/test_copy_between_memory_spaces.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/pointertests/test_copy_between_memory_spaces.spv.dis new file mode 100644 index 0000000000..49f6051cac --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/pointertests/test_copy_between_memory_spaces.spv.dis @@ -0,0 +1,38 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 22 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %16 = OpString "foo" + %17 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void None %10 + %12 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpReturn + OpFunctionEnd + %20 = OpExtInst %void %15 Kernel %11 %16 %uint_1 %uint_0 %17 + %21 = OpExtInst %void %15 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/pointertests/test_copy_between_memory_spaces2.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/pointertests/test_copy_between_memory_spaces2.spv.dis new file mode 100644 index 0000000000..a29a9dad4b --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/pointertests/test_copy_between_memory_spaces2.spv.dis @@ -0,0 +1,76 @@ +; @Input: %13 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + %38 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %20 "foo" %8 %13 %17 + OpSource OpenCL_C 200 + %39 = OpString "foo" + %40 = OpString " __kernel" + %42 = OpString "A" + %45 = OpString "B" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_11 0 Offset 0 + OpDecorate %_struct_11 Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 0 + OpDecorate %14 SpecId 3 + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_11 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_11 = OpTypePointer StorageBuffer %_struct_11 + %14 = OpSpecConstant %uint 1 +%_arr_float_14 = OpTypeArray %float %14 +%_ptr_Workgroup__arr_float_14 = OpTypePointer Workgroup %_arr_float_14 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Workgroup_float = OpTypePointer Workgroup %float + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %13 = OpVariable %_ptr_StorageBuffer__struct_11 StorageBuffer + %17 = OpVariable %_ptr_Workgroup__arr_float_14 Workgroup + %20 = OpFunction %void None %19 + %21 = OpLabel + %24 = OpAccessChain %_ptr_Workgroup_float %17 %uint_0 + %26 = OpAccessChain %_ptr_StorageBuffer_float %13 %uint_0 %uint_0 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpLoad %float %26 + %32 = OpFOrdGreaterThan %bool %29 %float_0 + OpSelectionMerge %37 None + OpBranchConditional %32 %35 %37 + %35 = OpLabel + OpStore %24 %29 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd + %41 = OpExtInst %void %38 Kernel %20 %39 %uint_2 %uint_0 %40 + %43 = OpExtInst %void %38 ArgumentInfo %42 + %44 = OpExtInst %void %38 ArgumentStorageBuffer %41 %uint_0 %uint_0 %uint_0 %43 + %46 = OpExtInst %void %38 ArgumentInfo %45 + %50 = OpExtInst %void %38 ArgumentWorkgroup %41 %uint_1 %uint_3 %uint_4 %46 + %51 = OpExtInst %void %38 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/pointertests/test_derived_from_binomial_opts.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/pointertests/test_derived_from_binomial_opts.spv.dis new file mode 100644 index 0000000000..157d026fe4 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/pointertests/test_derived_from_binomial_opts.spv.dis @@ -0,0 +1,49 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "binomial_options_kernel" %gl_LocalInvocationID %gl_WorkGroupID %14 %5 + OpSource OpenCL_C 200 + %20 = OpString "binomial_options_kernel" + %21 = OpString " __kernel" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %9 SpecId 0 + OpDecorate %10 SpecId 1 + OpDecorate %11 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %9 %10 %11 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %16 = OpTypeFunction %void + %uint_7 = OpConstant %uint 7 + %uint_0 = OpConstant %uint 0 + %uint_12 = OpConstant %uint 12 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpFunction %void Pure|Const %16 + %18 = OpLabel + OpReturn + OpFunctionEnd + %26 = OpExtInst %void %19 PushConstantRegionGroupOffset %uint_0 %uint_12 + %24 = OpExtInst %void %19 Kernel %17 %20 %uint_7 %uint_0 %21 + %29 = OpExtInst %void %19 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/pointertests/test_opencl_local_array.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/pointertests/test_opencl_local_array.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/pointertests/test_opencl_local_array.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/pointertests/test_opencl_local_param.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/pointertests/test_opencl_local_param.spv.dis new file mode 100644 index 0000000000..76fefda694 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/pointertests/test_opencl_local_param.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %18 = OpExtInst %void %13 Kernel %11 %14 %uint_2 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/pointertests/test_pass_value_from_array.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/pointertests/test_pass_value_from_array.spv.dis new file mode 100644 index 0000000000..31e32b91a4 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/pointertests/test_pass_value_from_array.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %18 = OpExtInst %void %13 Kernel %11 %14 %uint_1 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/pointertests/test_return_pointer.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/pointertests/test_return_pointer.spv.dis new file mode 100644 index 0000000000..9b890b5074 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/pointertests/test_return_pointer.spv.dis @@ -0,0 +1,55 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %25 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %26 = OpString "foo" + %27 = OpString " __kernel" + %30 = OpString "A" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %22 = OpLoad %uint %21 + %24 = OpAccessChain %_ptr_Workgroup_uint %14 %22 + OpStore %24 %22 + OpReturn + OpFunctionEnd + %29 = OpExtInst %void %25 Kernel %17 %26 %uint_1 %uint_0 %27 + %31 = OpExtInst %void %25 ArgumentInfo %30 + %34 = OpExtInst %void %25 ArgumentWorkgroup %29 %uint_0 %uint_3 %uint_4 %31 + %36 = OpExtInst %void %25 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/pow2/64bit_loopcounter.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/pow2/64bit_loopcounter.spv.dis new file mode 100644 index 0000000000..e380cf0051 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/pow2/64bit_loopcounter.spv.dis @@ -0,0 +1,104 @@ +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 75 +; Schema: 0 + OpCapability Shader + OpCapability Float64 + OpCapability Int64 + %59 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "foo" %gl_GlobalInvocationID %10 %19 %14 + OpSource OpenCL_C 200 + %60 = OpString "foo" + %61 = OpString " __kernel" + %64 = OpString "A" + %67 = OpString "n" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_12 0 Offset 0 + OpMemberDecorate %_struct_12 1 Offset 16 + OpDecorate %_struct_12 Block + OpDecorate %_runtimearr_double ArrayStride 8 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint + %_struct_12 = OpTypeStruct %v3uint %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 + %double = OpTypeFloat 64 +%_runtimearr_double = OpTypeRuntimeArray %double + %_struct_17 = OpTypeStruct %_runtimearr_double +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool + %ulong = OpTypeInt 64 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_StorageBuffer_double = OpTypePointer StorageBuffer %double + %double_0 = OpConstant %double 0 + %ulong_1 = OpConstant %ulong 1 + %ulong_2 = OpConstant %ulong 2 + %uint_2 = OpConstant %uint 2 + %uint_16 = OpConstant %uint 16 + %uint_4 = OpConstant %uint 4 + %uint_12 = OpConstant %uint 12 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + %27 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_1 %uint_0 + %28 = OpLoad %uint %27 + %30 = OpSGreaterThan %bool %28 %uint_0 + OpSelectionMerge %56 None + OpBranchConditional %30 %33 %56 + %33 = OpLabel + %35 = OpUConvert %ulong %28 + OpBranch %37 + %37 = OpLabel + %38 = OpPhi %ulong %49 %37 %35 %33 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %42 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %43 = OpLoad %uint %42 + %44 = OpIAdd %uint %41 %43 + %46 = OpAccessChain %_ptr_StorageBuffer_double %19 %uint_0 %44 + OpStore %46 %double_0 + %49 = OpShiftRightLogical %ulong %38 %ulong_1 + %51 = OpULessThan %bool %38 %ulong_2 + OpLoopMerge %54 %37 None + OpBranchConditional %51 %54 %37 + %54 = OpLabel + OpBranch %56 + %56 = OpLabel + OpBranch %58 + %58 = OpLabel + OpReturn + OpFunctionEnd + %73 = OpExtInst %void %59 PushConstantRegionOffset %uint_0 %uint_12 + %63 = OpExtInst %void %59 Kernel %22 %60 %uint_2 %uint_0 %61 + %65 = OpExtInst %void %59 ArgumentInfo %64 + %66 = OpExtInst %void %59 ArgumentStorageBuffer %63 %uint_0 %uint_0 %uint_0 %65 + %68 = OpExtInst %void %59 ArgumentInfo %67 + %71 = OpExtInst %void %59 ArgumentPodPushConstant %63 %uint_1 %uint_16 %uint_4 %68 + %74 = OpExtInst %void %59 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/pow2/64bit_relational.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/pow2/64bit_relational.spv.dis new file mode 100644 index 0000000000..e380cf0051 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/pow2/64bit_relational.spv.dis @@ -0,0 +1,104 @@ +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 75 +; Schema: 0 + OpCapability Shader + OpCapability Float64 + OpCapability Int64 + %59 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "foo" %gl_GlobalInvocationID %10 %19 %14 + OpSource OpenCL_C 200 + %60 = OpString "foo" + %61 = OpString " __kernel" + %64 = OpString "A" + %67 = OpString "n" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_12 0 Offset 0 + OpMemberDecorate %_struct_12 1 Offset 16 + OpDecorate %_struct_12 Block + OpDecorate %_runtimearr_double ArrayStride 8 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint + %_struct_12 = OpTypeStruct %v3uint %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 + %double = OpTypeFloat 64 +%_runtimearr_double = OpTypeRuntimeArray %double + %_struct_17 = OpTypeStruct %_runtimearr_double +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool + %ulong = OpTypeInt 64 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_StorageBuffer_double = OpTypePointer StorageBuffer %double + %double_0 = OpConstant %double 0 + %ulong_1 = OpConstant %ulong 1 + %ulong_2 = OpConstant %ulong 2 + %uint_2 = OpConstant %uint 2 + %uint_16 = OpConstant %uint 16 + %uint_4 = OpConstant %uint 4 + %uint_12 = OpConstant %uint 12 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + %27 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_1 %uint_0 + %28 = OpLoad %uint %27 + %30 = OpSGreaterThan %bool %28 %uint_0 + OpSelectionMerge %56 None + OpBranchConditional %30 %33 %56 + %33 = OpLabel + %35 = OpUConvert %ulong %28 + OpBranch %37 + %37 = OpLabel + %38 = OpPhi %ulong %49 %37 %35 %33 + %40 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %42 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %43 = OpLoad %uint %42 + %44 = OpIAdd %uint %41 %43 + %46 = OpAccessChain %_ptr_StorageBuffer_double %19 %uint_0 %44 + OpStore %46 %double_0 + %49 = OpShiftRightLogical %ulong %38 %ulong_1 + %51 = OpULessThan %bool %38 %ulong_2 + OpLoopMerge %54 %37 None + OpBranchConditional %51 %54 %37 + %54 = OpLabel + OpBranch %56 + %56 = OpLabel + OpBranch %58 + %58 = OpLabel + OpReturn + OpFunctionEnd + %73 = OpExtInst %void %59 PushConstantRegionOffset %uint_0 %uint_12 + %63 = OpExtInst %void %59 Kernel %22 %60 %uint_2 %uint_0 %61 + %65 = OpExtInst %void %59 ArgumentInfo %64 + %66 = OpExtInst %void %59 ArgumentStorageBuffer %63 %uint_0 %uint_0 %uint_0 %65 + %68 = OpExtInst %void %59 ArgumentInfo %67 + %71 = OpExtInst %void %59 ArgumentPodPushConstant %63 %uint_1 %uint_16 %uint_4 %68 + %74 = OpExtInst %void %59 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/predicated_undef.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/predicated_undef.spv.dis new file mode 100644 index 0000000000..fb765d65c4 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/predicated_undef.spv.dis @@ -0,0 +1,39 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %13 "k" %gl_LocalInvocationID %10 + OpSource OpenCL_C 200 + %16 = OpString "k" + %17 = OpString " __kernel" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %13 = OpFunction %void Pure|Const %12 + %14 = OpLabel + OpReturn + OpFunctionEnd + %20 = OpExtInst %void %15 Kernel %13 %16 %uint_2 %uint_0 %17 + %22 = OpExtInst %void %15 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/reducedstrength_generalised.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/reducedstrength_generalised.spv.dis new file mode 100644 index 0000000000..41736e2855 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/reducedstrength_generalised.spv.dis @@ -0,0 +1,94 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 76 +; Schema: 0 + OpCapability Shader + %64 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %8 %gl_LocalInvocationID %14 + OpSource OpenCL_C 200 + %65 = OpString "foo" + %66 = OpString " __kernel" + %69 = OpString "data" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %11 SpecId 3 + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %uint_10 = OpConstant %uint 10 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %19 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %20 = OpCompositeExtract %uint %19 0 + %22 = OpIMul %uint %20 %uint_10 + %25 = OpINotEqual %bool %22 %uint_0 + OpSelectionMerge %63 None + OpBranchConditional %25 %28 %63 + %28 = OpLabel + %29 = OpPhi %v3uint %54 %53 %19 %18 + %30 = OpPhi %uint %56 %53 %uint_0 %18 + %31 = OpCompositeExtract %uint %29 0 + %32 = OpIMul %uint %31 %uint_10 + %33 = OpULessThan %bool %30 %32 + OpLoopMerge %61 %53 None + OpBranchConditional %33 %36 %53 + %36 = OpLabel + %37 = OpPhi %uint %46 %36 %30 %28 + %39 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %40 = OpLoad %uint %39 + %41 = OpIAdd %uint %37 %40 + %43 = OpAccessChain %_ptr_Workgroup_uint %14 %41 + OpStore %43 %40 + %44 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %45 = OpCompositeExtract %uint %44 0 + %46 = OpIAdd %uint %45 %37 + %47 = OpIMul %uint %45 %uint_10 + %48 = OpUGreaterThanEqual %bool %46 %47 + OpLoopMerge %51 %36 None + OpBranchConditional %48 %51 %36 + %51 = OpLabel + OpBranch %53 + %53 = OpLabel + %54 = OpPhi %v3uint %29 %28 %44 %51 + %55 = OpPhi %uint %31 %28 %45 %51 + %56 = OpIAdd %uint %55 %30 + %57 = OpCompositeExtract %uint %54 0 + %58 = OpIMul %uint %57 %uint_10 + %59 = OpUGreaterThanEqual %bool %56 %58 + OpBranchConditional %59 %61 %28 + %61 = OpLabel + OpBranch %63 + %63 = OpLabel + OpReturn + OpFunctionEnd + %68 = OpExtInst %void %64 Kernel %17 %65 %uint_1 %uint_0 %66 + %70 = OpExtInst %void %64 ArgumentInfo %69 + %73 = OpExtInst %void %64 ArgumentWorkgroup %68 %uint_0 %uint_3 %uint_4 %70 + %75 = OpExtInst %void %64 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/reducedstrengthnonloopbug.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/reducedstrengthnonloopbug.spv.dis new file mode 100644 index 0000000000..5c19f88591 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/reducedstrengthnonloopbug.spv.dis @@ -0,0 +1,39 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %13 "foo" %8 %gl_LocalInvocationID + OpSource OpenCL_C 200 + %16 = OpString "foo" + %17 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpFunction %void Pure|Const %12 + %14 = OpLabel + OpReturn + OpFunctionEnd + %19 = OpExtInst %void %15 Kernel %13 %16 %uint_0 %uint_0 %17 + %22 = OpExtInst %void %15 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/report_global_id/test1.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/report_global_id/test1.spv.dis new file mode 100644 index 0000000000..38ab266396 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/report_global_id/test1.spv.dis @@ -0,0 +1,147 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 119 +; Schema: 0 + OpCapability Shader + %104 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %10 %18 %14 + OpSource OpenCL_C 200 + %105 = OpString "foo" + %106 = OpString " __kernel" + %108 = OpString "p" + %111 = OpString "x" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_12 0 Offset 0 + OpMemberDecorate %_struct_12 1 Offset 16 + OpDecorate %_struct_12 Block + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint + %_struct_12 = OpTypeStruct %v3uint %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_8 = OpConstant %uint 8 + %uint_13 = OpConstant %uint 13 + %uint_21 = OpConstant %uint 21 + %uint_16 = OpConstant %uint 16 + %uint_4 = OpConstant %uint 4 + %uint_12 = OpConstant %uint 12 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %26 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_1 %uint_0 + %27 = OpLoad %uint %26 + %29 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %30 = OpLoad %uint %29 + %31 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %32 = OpLoad %uint %31 + %33 = OpISub %uint %uint_0 %32 + %35 = OpIEqual %bool %30 %33 + OpSelectionMerge %66 None + OpBranchConditional %35 %38 %66 + %38 = OpLabel + %39 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_1 + %40 = OpLoad %uint %39 + %41 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_1 + %42 = OpLoad %uint %41 + %43 = OpIAdd %uint %42 %40 + %44 = OpIEqual %bool %43 %uint_1 + OpSelectionMerge %64 None + OpBranchConditional %44 %47 %64 + %47 = OpLabel + %49 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 + %50 = OpLoad %uint %49 + %51 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_2 + %52 = OpLoad %uint %51 + %53 = OpIAdd %uint %52 %50 + %54 = OpIEqual %bool %53 %uint_2 + OpSelectionMerge %62 None + OpBranchConditional %54 %57 %62 + %57 = OpLabel + %58 = OpIAdd %uint %30 %32 + %60 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %58 + OpStore %60 %uint_1 + OpBranch %62 + %62 = OpLabel + OpBranch %64 + %64 = OpLabel + OpBranch %66 + %66 = OpLabel + %67 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %68 = OpLoad %uint %67 + %69 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %70 = OpLoad %uint %69 + %71 = OpIAdd %uint %70 %68 + %73 = OpIEqual %bool %71 %uint_8 + OpSelectionMerge %103 None + OpBranchConditional %73 %76 %103 + %76 = OpLabel + %77 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_1 + %78 = OpLoad %uint %77 + %79 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_1 + %80 = OpLoad %uint %79 + %81 = OpIAdd %uint %80 %78 + %83 = OpIEqual %bool %81 %uint_13 + OpSelectionMerge %101 None + OpBranchConditional %83 %86 %101 + %86 = OpLabel + %87 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 + %88 = OpLoad %uint %87 + %89 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_2 + %90 = OpLoad %uint %89 + %91 = OpIAdd %uint %90 %88 + %93 = OpIEqual %bool %91 %uint_21 + OpSelectionMerge %99 None + OpBranchConditional %93 %96 %99 + %96 = OpLabel + %97 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %27 + OpStore %97 %uint_13 + OpBranch %99 + %99 = OpLabel + OpBranch %101 + %101 = OpLabel + OpBranch %103 + %103 = OpLabel + OpReturn + OpFunctionEnd + %117 = OpExtInst %void %104 PushConstantRegionOffset %uint_0 %uint_12 + %107 = OpExtInst %void %104 Kernel %21 %105 %uint_2 %uint_0 %106 + %109 = OpExtInst %void %104 ArgumentInfo %108 + %110 = OpExtInst %void %104 ArgumentStorageBuffer %107 %uint_0 %uint_0 %uint_0 %109 + %112 = OpExtInst %void %104 ArgumentInfo %111 + %115 = OpExtInst %void %104 ArgumentPodPushConstant %107 %uint_1 %uint_16 %uint_4 %112 + %118 = OpExtInst %void %104 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/report_global_id/test2.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/report_global_id/test2.spv.dis new file mode 100644 index 0000000000..069b9d91c7 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/report_global_id/test2.spv.dis @@ -0,0 +1,107 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + %63 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %10 %18 %14 + OpSource OpenCL_C 200 + %64 = OpString "foo" + %65 = OpString " __kernel" + %68 = OpString "p" + %71 = OpString "x" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_12 0 Offset 0 + OpMemberDecorate %_struct_12 1 Offset 16 + OpDecorate %_struct_12 Block + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint + %_struct_12 = OpTypeStruct %v3uint %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %bool = OpTypeBool +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_7 = OpConstant %uint 7 + %uint_45 = OpConstant %uint 45 + %uint_2 = OpConstant %uint 2 + %uint_16 = OpConstant %uint 16 + %uint_4 = OpConstant %uint 4 + %uint_12 = OpConstant %uint 12 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %26 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_1 %uint_0 + %27 = OpLoad %uint %26 + %29 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %30 = OpLoad %uint %29 + %31 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %32 = OpLoad %uint %31 + %33 = OpISub %uint %uint_0 %32 + %35 = OpIEqual %bool %30 %33 + OpSelectionMerge %48 None + OpBranchConditional %35 %38 %48 + %38 = OpLabel + %39 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_1 + %40 = OpLoad %uint %39 + %41 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_1 + %42 = OpLoad %uint %41 + %43 = OpIAdd %uint %42 %40 + %44 = OpIAdd %uint %30 %32 + %46 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %44 + OpStore %46 %43 + OpBranch %48 + %48 = OpLabel + %49 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %50 = OpLoad %uint %49 + %51 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %52 = OpLoad %uint %51 + %53 = OpIAdd %uint %52 %50 + %55 = OpIEqual %bool %53 %uint_7 + OpSelectionMerge %62 None + OpBranchConditional %55 %58 %62 + %58 = OpLabel + %59 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %27 + OpStore %59 %uint_45 + OpBranch %62 + %62 = OpLabel + OpReturn + OpFunctionEnd + %77 = OpExtInst %void %63 PushConstantRegionOffset %uint_0 %uint_12 + %67 = OpExtInst %void %63 Kernel %21 %64 %uint_2 %uint_0 %65 + %69 = OpExtInst %void %63 ArgumentInfo %68 + %70 = OpExtInst %void %63 ArgumentStorageBuffer %67 %uint_0 %uint_0 %uint_0 %69 + %72 = OpExtInst %void %63 ArgumentInfo %71 + %75 = OpExtInst %void %63 ArgumentPodPushConstant %67 %uint_1 %uint_16 %uint_4 %72 + %78 = OpExtInst %void %63 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/return_tests/id_dependent_return.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/return_tests/id_dependent_return.spv.dis new file mode 100644 index 0000000000..894e0e2bf1 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/return_tests/id_dependent_return.spv.dis @@ -0,0 +1,39 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %13 "foo" %gl_LocalInvocationID %10 + OpSource OpenCL_C 200 + %16 = OpString "foo" + %17 = OpString " __kernel" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %13 = OpFunction %void Pure|Const %12 + %14 = OpLabel + OpReturn + OpFunctionEnd + %20 = OpExtInst %void %15 Kernel %13 %16 %uint_1 %uint_0 %17 + %22 = OpExtInst %void %15 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/return_tests/multiloop_return.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/return_tests/multiloop_return.spv.dis new file mode 100644 index 0000000000..8357c18766 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/return_tests/multiloop_return.spv.dis @@ -0,0 +1,39 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %13 "foo" %gl_LocalInvocationID %10 + OpSource OpenCL_C 200 + %16 = OpString "foo" + %17 = OpString " __kernel" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %13 = OpFunction %void Pure|Const %12 + %14 = OpLabel + OpReturn + OpFunctionEnd + %19 = OpExtInst %void %15 Kernel %13 %16 %uint_0 %uint_0 %17 + %22 = OpExtInst %void %15 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/return_tests/multiloop_return_simplified.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/return_tests/multiloop_return_simplified.spv.dis new file mode 100644 index 0000000000..411b6e8e57 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/return_tests/multiloop_return_simplified.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "bar" %8 + OpSource OpenCL_C 200 + %14 = OpString "bar" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %18 = OpExtInst %void %13 Kernel %11 %14 %uint_1 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/return_tests/simple_return.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/return_tests/simple_return.spv.dis new file mode 100644 index 0000000000..894e0e2bf1 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/return_tests/simple_return.spv.dis @@ -0,0 +1,39 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %13 "foo" %gl_LocalInvocationID %10 + OpSource OpenCL_C 200 + %16 = OpString "foo" + %17 = OpString " __kernel" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %13 = OpFunction %void Pure|Const %12 + %14 = OpLabel + OpReturn + OpFunctionEnd + %20 = OpExtInst %void %15 Kernel %13 %16 %uint_1 %uint_0 %17 + %22 = OpExtInst %void %15 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/rightshiftequals.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/rightshiftequals.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/rightshiftequals.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/saturate/sadd.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/saturate/sadd.spv.dis new file mode 100644 index 0000000000..703ce55b4f --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/saturate/sadd.spv.dis @@ -0,0 +1,90 @@ +; @Input: %17 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + %47 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "test" %gl_GlobalInvocationID %13 %17 %18 %5 + OpSource OpenCL_C 200 + %48 = OpString "test" + %49 = OpString " __kernel" + %52 = OpString "A" + %55 = OpString "B" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool +%uint_2147483648 = OpConstant %uint 2147483648 +%uint_2147483647 = OpConstant %uint 2147483647 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %26 %29 + %32 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %30 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %26 %29 + %35 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %34 + %36 = OpLoad %uint %35 + %37 = OpIAdd %uint %33 %36 + %39 = OpSLessThan %bool %36 %uint_0 + %40 = OpSGreaterThan %bool %37 %33 + %41 = OpSLessThan %bool %37 %33 + %43 = OpSelect %uint %40 %uint_2147483648 %37 + %45 = OpSelect %uint %41 %uint_2147483647 %37 + %46 = OpSelect %uint %39 %43 %45 + OpStore %32 %46 + OpReturn + OpFunctionEnd + %60 = OpExtInst %void %47 PushConstantRegionOffset %uint_0 %uint_12 + %51 = OpExtInst %void %47 Kernel %21 %48 %uint_2 %uint_0 %49 + %53 = OpExtInst %void %47 ArgumentInfo %52 + %54 = OpExtInst %void %47 ArgumentStorageBuffer %51 %uint_0 %uint_0 %uint_0 %53 + %56 = OpExtInst %void %47 ArgumentInfo %55 + %58 = OpExtInst %void %47 ArgumentStorageBuffer %51 %uint_1 %uint_0 %uint_1 %56 + %61 = OpExtInst %void %47 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/saturate/ssub.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/saturate/ssub.spv.dis new file mode 100644 index 0000000000..c7b255df1f --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/saturate/ssub.spv.dis @@ -0,0 +1,90 @@ +; @Input: %17 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + %47 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "test" %gl_GlobalInvocationID %13 %17 %18 %5 + OpSource OpenCL_C 200 + %48 = OpString "test" + %49 = OpString " __kernel" + %52 = OpString "A" + %55 = OpString "B" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %bool = OpTypeBool +%uint_2147483647 = OpConstant %uint 2147483647 +%uint_2147483648 = OpConstant %uint 2147483648 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %26 %29 + %32 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %30 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %26 %29 + %35 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %34 + %36 = OpLoad %uint %35 + %37 = OpISub %uint %33 %36 + %39 = OpSLessThan %bool %36 %uint_0 + %40 = OpSGreaterThan %bool %37 %33 + %41 = OpSLessThan %bool %37 %33 + %43 = OpSelect %uint %41 %uint_2147483647 %37 + %45 = OpSelect %uint %40 %uint_2147483648 %37 + %46 = OpSelect %uint %39 %43 %45 + OpStore %32 %46 + OpReturn + OpFunctionEnd + %60 = OpExtInst %void %47 PushConstantRegionOffset %uint_0 %uint_12 + %51 = OpExtInst %void %47 Kernel %21 %48 %uint_2 %uint_0 %49 + %53 = OpExtInst %void %47 ArgumentInfo %52 + %54 = OpExtInst %void %47 ArgumentStorageBuffer %51 %uint_0 %uint_0 %uint_0 %53 + %56 = OpExtInst %void %47 ArgumentInfo %55 + %58 = OpExtInst %void %47 ArgumentStorageBuffer %51 %uint_1 %uint_0 %uint_1 %56 + %61 = OpExtInst %void %47 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/saturate/uadd.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/saturate/uadd.spv.dis new file mode 100644 index 0000000000..0da179c8a0 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/saturate/uadd.spv.dis @@ -0,0 +1,88 @@ +; @Input: %17 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 60 +; Schema: 0 + OpCapability Shader + %45 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "test" %gl_GlobalInvocationID %13 %17 %18 %5 + OpSource OpenCL_C 200 + %46 = OpString "test" + %47 = OpString " __kernel" + %50 = OpString "A" + %53 = OpString "B" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %_struct_37 = OpTypeStruct %uint %uint + %bool = OpTypeBool +%uint_4294967295 = OpConstant %uint 4294967295 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %26 %29 + %32 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %30 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %26 %29 + %35 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %34 + %36 = OpLoad %uint %35 + %38 = OpIAddCarry %_struct_37 %33 %36 + %39 = OpCompositeExtract %uint %38 0 + %40 = OpCompositeExtract %uint %38 1 + %42 = OpIEqual %bool %40 %uint_0 + %44 = OpSelect %uint %42 %39 %uint_4294967295 + OpStore %32 %44 + OpReturn + OpFunctionEnd + %58 = OpExtInst %void %45 PushConstantRegionOffset %uint_0 %uint_12 + %49 = OpExtInst %void %45 Kernel %21 %46 %uint_2 %uint_0 %47 + %51 = OpExtInst %void %45 ArgumentInfo %50 + %52 = OpExtInst %void %45 ArgumentStorageBuffer %49 %uint_0 %uint_0 %uint_0 %51 + %54 = OpExtInst %void %45 ArgumentInfo %53 + %56 = OpExtInst %void %45 ArgumentStorageBuffer %49 %uint_1 %uint_0 %uint_1 %54 + %59 = OpExtInst %void %45 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/saturate/usub.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/saturate/usub.spv.dis new file mode 100644 index 0000000000..237860087f --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/saturate/usub.spv.dis @@ -0,0 +1,87 @@ +; @Input: %17 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %44 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "test" %gl_GlobalInvocationID %13 %17 %18 %5 + OpSource OpenCL_C 200 + %45 = OpString "test" + %46 = OpString " __kernel" + %49 = OpString "A" + %52 = OpString "B" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %_struct_37 = OpTypeStruct %uint %uint + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %26 %29 + %32 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %30 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %26 %29 + %35 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %34 + %36 = OpLoad %uint %35 + %38 = OpISubBorrow %_struct_37 %33 %36 + %39 = OpCompositeExtract %uint %38 0 + %40 = OpCompositeExtract %uint %38 1 + %42 = OpIEqual %bool %40 %uint_0 + %43 = OpSelect %uint %42 %39 %uint_0 + OpStore %32 %43 + OpReturn + OpFunctionEnd + %57 = OpExtInst %void %44 PushConstantRegionOffset %uint_0 %uint_12 + %48 = OpExtInst %void %44 Kernel %21 %45 %uint_2 %uint_0 %46 + %50 = OpExtInst %void %44 ArgumentInfo %49 + %51 = OpExtInst %void %44 ArgumentStorageBuffer %48 %uint_0 %uint_0 %uint_0 %50 + %53 = OpExtInst %void %44 ArgumentInfo %52 + %55 = OpExtInst %void %44 ArgumentStorageBuffer %48 %uint_1 %uint_0 %uint_1 %53 + %58 = OpExtInst %void %44 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/shared_int.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/shared_int.spv.dis new file mode 100644 index 0000000000..8357c18766 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/shared_int.spv.dis @@ -0,0 +1,39 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %13 "foo" %gl_LocalInvocationID %10 + OpSource OpenCL_C 200 + %16 = OpString "foo" + %17 = OpString " __kernel" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %13 = OpFunction %void Pure|Const %12 + %14 = OpLabel + OpReturn + OpFunctionEnd + %19 = OpExtInst %void %15 Kernel %13 %16 %uint_0 %uint_0 %17 + %22 = OpExtInst %void %15 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/shuffle/shuffle.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/shuffle/shuffle.spv.dis new file mode 100644 index 0000000000..e45a5ed68e --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/shuffle/shuffle.spv.dis @@ -0,0 +1,109 @@ +; @Input: %19 = {{{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}} +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + %65 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "test" %gl_GlobalInvocationID %10 %19 %14 + OpSource OpenCL_C 200 + %66 = OpString "test" + %67 = OpString " __kernel" + %69 = OpString "A" + %72 = OpString "mask" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_11 1 Offset 4 + OpMemberDecorate %_struct_11 2 Offset 8 + OpMemberDecorate %_struct_11 3 Offset 12 + OpMemberDecorate %_struct_12 0 Offset 0 + OpMemberDecorate %_struct_12 1 Offset 16 + OpDecorate %_struct_12 Block + OpDecorate %_runtimearr_v4uint ArrayStride 16 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint %uint %uint %uint + %_struct_12 = OpTypeStruct %v3uint %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 + %v4uint = OpTypeVector %uint 4 +%_runtimearr_v4uint = OpTypeRuntimeArray %v4uint + %_struct_17 = OpTypeStruct %_runtimearr_v4uint +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_StorageBuffer_v4uint = OpTypePointer StorageBuffer %v4uint + %uint_4 = OpConstant %uint 4 + %uint_16 = OpConstant %uint 16 + %uint_12 = OpConstant %uint 12 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + %27 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_1 %uint_0 + %28 = OpLoad %uint %27 + %29 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_1 %uint_1 + %30 = OpLoad %uint %29 + %32 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_1 %uint_2 + %33 = OpLoad %uint %32 + %35 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_1 %uint_3 + %36 = OpLoad %uint %35 + %37 = OpCompositeConstruct %v4uint %28 %30 %33 %36 + %39 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %40 = OpLoad %uint %39 + %41 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %42 = OpLoad %uint %41 + %43 = OpIAdd %uint %40 %42 + %45 = OpAccessChain %_ptr_StorageBuffer_v4uint %19 %uint_0 %43 + %46 = OpLoad %v4uint %45 + %47 = OpUndef %v4uint + %49 = OpCompositeExtract %uint %37 0 + %50 = OpUMod %uint %49 %uint_4 + %51 = OpVectorExtractDynamic %uint %46 %50 + %52 = OpCompositeInsert %v4uint %51 %47 0 + %53 = OpCompositeExtract %uint %37 1 + %54 = OpUMod %uint %53 %uint_4 + %55 = OpVectorExtractDynamic %uint %46 %54 + %56 = OpCompositeInsert %v4uint %55 %52 1 + %57 = OpCompositeExtract %uint %37 2 + %58 = OpUMod %uint %57 %uint_4 + %59 = OpVectorExtractDynamic %uint %46 %58 + %60 = OpCompositeInsert %v4uint %59 %56 2 + %61 = OpCompositeExtract %uint %37 3 + %62 = OpUMod %uint %61 %uint_4 + %63 = OpVectorExtractDynamic %uint %46 %62 + %64 = OpCompositeInsert %v4uint %63 %60 3 + OpStore %45 %64 + OpReturn + OpFunctionEnd + %77 = OpExtInst %void %65 PushConstantRegionOffset %uint_0 %uint_12 + %68 = OpExtInst %void %65 Kernel %22 %66 %uint_2 %uint_0 %67 + %70 = OpExtInst %void %65 ArgumentInfo %69 + %71 = OpExtInst %void %65 ArgumentStorageBuffer %68 %uint_0 %uint_0 %uint_0 %70 + %73 = OpExtInst %void %65 ArgumentInfo %72 + %75 = OpExtInst %void %65 ArgumentPodPushConstant %68 %uint_1 %uint_16 %uint_16 %73 + %78 = OpExtInst %void %65 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/simplebinomialoptions.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/simplebinomialoptions.spv.dis new file mode 100644 index 0000000000..312f3c735a --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/simplebinomialoptions.spv.dis @@ -0,0 +1,215 @@ +; @Input: %24 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %25 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %26 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 170 +; Schema: 0 + OpCapability Shader + %85 = OpExtInstImport "GLSL.std.450" + %153 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %29 "binomial_options_kernel" %6 %7 %gl_LocalInvocationID %gl_WorkGroupID %20 %24 %25 %26 %11 + OpSource OpenCL_C 200 + %154 = OpString "binomial_options_kernel" + %155 = OpString " __kernel" + %158 = OpString "constant_array" + %161 = OpString "call_value" + %164 = OpString "call_buffer" + OpMemberDecorate %_struct_9 0 Offset 0 + OpDecorate %_struct_9 Block + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_22 0 Offset 0 + OpDecorate %_struct_22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 0 + OpDecorate %24 NonWritable + OpDecorate %25 DescriptorSet 0 + OpDecorate %25 Binding 1 + OpDecorate %26 DescriptorSet 0 + OpDecorate %26 Binding 2 + OpDecorate %26 Coherent + OpDecorate %110 NoContraction + OpDecorate %117 NoContraction + OpDecorate %15 SpecId 0 + OpDecorate %16 SpecId 1 + OpDecorate %17 SpecId 2 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_257 = OpConstant %uint 257 +%_arr_float_uint_257 = OpTypeArray %float %uint_257 +%_ptr_Workgroup__arr_float_uint_257 = OpTypePointer Workgroup %_arr_float_uint_257 + %v3uint = OpTypeVector %uint 3 + %_struct_9 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_9 = OpTypePointer PushConstant %_struct_9 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %15 = OpSpecConstant %uint 1 + %16 = OpSpecConstant %uint 1 + %17 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %15 %16 %17 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_22 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_22 = OpTypePointer StorageBuffer %_struct_22 + %void = OpTypeVoid + %28 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %uint_2049 = OpConstant %uint 2049 + %uint_2064 = OpConstant %uint 2064 +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %float_0 = OpConstant %float 0 + %uint_256 = OpConstant %uint 256 + %uint_1793 = OpConstant %uint 1793 +%_ptr_Workgroup_float = OpTypePointer Workgroup %float + %uint_1 = OpConstant %uint 1 + %uint_255 = OpConstant %uint 255 +%uint_4294967264 = OpConstant %uint 4294967264 + %uint_2 = OpConstant %uint 2 + %uint_328 = OpConstant %uint 328 +%uint_4294967294 = OpConstant %uint 4294967294 + %uint_224 = OpConstant %uint 224 + %uint_32 = OpConstant %uint 32 + %uint_2048 = OpConstant %uint 2048 + %uint_3 = OpConstant %uint 3 + %uint_12 = OpConstant %uint 12 + %6 = OpVariable %_ptr_Workgroup__arr_float_uint_257 Workgroup + %7 = OpVariable %_ptr_Workgroup__arr_float_uint_257 Workgroup + %11 = OpVariable %_ptr_PushConstant__struct_9 PushConstant +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %20 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %24 = OpVariable %_ptr_StorageBuffer__struct_22 StorageBuffer + %25 = OpVariable %_ptr_StorageBuffer__struct_22 StorageBuffer + %26 = OpVariable %_ptr_StorageBuffer__struct_22 StorageBuffer + %29 = OpFunction %void None %28 + %30 = OpLabel + %33 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %34 = OpLoad %uint %33 + %36 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_0 %uint_0 + %37 = OpLoad %uint %36 + %38 = OpIAdd %uint %37 %34 + %39 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %40 = OpLoad %uint %39 + %43 = OpSLessThan %bool %40 %uint_2049 + OpSelectionMerge %64 None + OpBranchConditional %43 %46 %64 + %46 = OpLabel + %48 = OpIMul %uint %38 %uint_2064 + OpBranch %50 + %50 = OpLabel + %51 = OpPhi %uint %57 %50 %40 %46 + %52 = OpIAdd %uint %48 %51 + %54 = OpAccessChain %_ptr_StorageBuffer_float %26 %uint_0 %52 + OpStore %54 %float_0 + %57 = OpIAdd %uint %51 %uint_256 + %59 = OpSGreaterThanEqual %bool %51 %uint_1793 + OpLoopMerge %62 %50 None + OpBranchConditional %59 %62 %50 + %62 = OpLabel + OpBranch %64 + %64 = OpLabel + OpBranch %66 + %66 = OpLabel + %67 = OpIMul %uint %38 %uint_2064 + %68 = OpIAdd %uint %67 %40 + %70 = OpAccessChain %_ptr_Workgroup_float %6 %40 + %71 = OpAccessChain %_ptr_StorageBuffer_float %24 %uint_0 %38 + %73 = OpIAdd %uint %40 %uint_1 + %74 = OpAccessChain %_ptr_Workgroup_float %6 %73 + %75 = OpAccessChain %_ptr_Workgroup_float %7 %40 + %76 = OpAccessChain %_ptr_Workgroup_float %7 %73 + OpBranch %78 + %78 = OpLabel + %79 = OpPhi %uint %uint_2048 %66 %138 %137 + OpLoopMerge %142 %137 None + OpBranch %82 + %82 = OpLabel + %83 = OpPhi %uint %132 %130 %uint_0 %78 + %84 = OpISub %uint %79 %83 + %87 = OpExtInst %uint %85 SMin %84 %uint_255 + %89 = OpIAdd %uint %87 %uint_4294967264 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %92 = OpSLessThanEqual %bool %40 %87 + OpLoopMerge %135 %130 None + OpBranch %95 + %95 = OpLabel + OpSelectionMerge %103 None + OpBranchConditional %92 %98 %103 + %98 = OpLabel + %99 = OpIAdd %uint %68 %83 + %100 = OpAccessChain %_ptr_StorageBuffer_float %26 %uint_0 %99 + %101 = OpLoad %float %100 + OpStore %70 %101 + OpBranch %103 + %103 = OpLabel + OpBranch %105 + %105 = OpLabel + %106 = OpPhi %uint %113 %105 %87 %103 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %107 = OpLoad %float %71 + %108 = OpLoad %float %74 + %109 = OpLoad %float %70 + %110 = OpFMul %float %107 %109 + %111 = OpExtInst %float %85 Fma %107 %108 %110 + OpStore %75 %111 + %113 = OpIAdd %uint %106 %uint_4294967294 + OpControlBarrier %uint_2 %uint_2 %uint_328 + %114 = OpLoad %float %71 + %115 = OpLoad %float %76 + %116 = OpLoad %float %75 + %117 = OpFMul %float %114 %116 + %118 = OpExtInst %float %85 Fma %114 %115 %117 + OpStore %70 %118 + %119 = OpSLessThanEqual %bool %113 %89 + OpLoopMerge %122 %105 None + OpBranchConditional %119 %122 %105 + %122 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_328 + %123 = OpSLessThanEqual %bool %40 %89 + OpBranchConditional %123 %125 %130 + %125 = OpLabel + %126 = OpLoad %float %70 + %127 = OpIAdd %uint %68 %83 + %128 = OpAccessChain %_ptr_StorageBuffer_float %26 %uint_0 %127 + OpStore %128 %126 + OpBranch %130 + %130 = OpLabel + %132 = OpIAdd %uint %83 %uint_224 + %133 = OpUGreaterThanEqual %bool %132 %79 + OpBranchConditional %133 %135 %82 + %135 = OpLabel + OpBranch %137 + %137 = OpLabel + %138 = OpIAdd %uint %79 %uint_4294967264 + %140 = OpULessThanEqual %bool %79 %uint_32 + OpBranchConditional %140 %142 %78 + %142 = OpLabel + %143 = OpIEqual %bool %40 %uint_0 + OpSelectionMerge %151 None + OpBranchConditional %143 %146 %151 + %146 = OpLabel + %147 = OpAccessChain %_ptr_Workgroup_float %6 %uint_0 + %148 = OpLoad %float %147 + %149 = OpAccessChain %_ptr_StorageBuffer_float %25 %uint_0 %38 + OpStore %149 %148 + OpBranch %151 + %151 = OpLabel + OpReturn + OpFunctionEnd + %168 = OpExtInst %void %153 PushConstantRegionGroupOffset %uint_0 %uint_12 + %157 = OpExtInst %void %153 Kernel %29 %154 %uint_3 %uint_0 %155 + %159 = OpExtInst %void %153 ArgumentInfo %158 + %160 = OpExtInst %void %153 ArgumentStorageBuffer %157 %uint_0 %uint_0 %uint_0 %159 + %162 = OpExtInst %void %153 ArgumentInfo %161 + %163 = OpExtInst %void %153 ArgumentStorageBuffer %157 %uint_1 %uint_0 %uint_1 %162 + %165 = OpExtInst %void %153 ArgumentInfo %164 + %166 = OpExtInst %void %153 ArgumentStorageBuffer %157 %uint_2 %uint_0 %uint_2 %165 + %169 = OpExtInst %void %153 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/simpleparampassing.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/simpleparampassing.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/simpleparampassing.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/simpleprocedurecall.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/simpleprocedurecall.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/simpleprocedurecall.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/simplereturn.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/simplereturn.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/simplereturn.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/skeletonbinomialoptions.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/skeletonbinomialoptions.spv.dis new file mode 100644 index 0000000000..4bbccaa4b8 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/skeletonbinomialoptions.spv.dis @@ -0,0 +1,76 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + %52 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "binomial_options_kernel" %8 + OpSource OpenCL_C 200 + %53 = OpString "binomial_options_kernel" + %54 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 +%uint_4294967295 = OpConstant %uint 4294967295 + %bool = OpTypeBool + %uint_239 = OpConstant %uint 239 + %uint_240 = OpConstant %uint 240 +%uint_4294967280 = OpConstant %uint 4294967280 + %uint_16 = OpConstant %uint 16 + %uint_1024 = OpConstant %uint 1024 + %uint_0 = OpConstant %uint 0 + %uint_254 = OpConstant %uint 254 + %uint_1 = OpConstant %uint 1 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void None %10 + %12 = OpLabel + OpBranch %14 + %14 = OpLabel + %15 = OpPhi %uint %uint_1024 %12 %44 %42 + OpLoopMerge %48 %42 None + OpBranch %18 + %18 = OpLabel + %19 = OpPhi %uint %37 %35 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpLoopMerge %40 %35 None + OpBranch %24 + %24 = OpLabel + %25 = OpPhi %uint %27 %24 %uint_254 %18 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %27 = OpIAdd %uint %25 %uint_4294967295 + %30 = OpULessThanEqual %bool %25 %uint_239 + OpLoopMerge %33 %24 None + OpBranchConditional %30 %33 %24 + %33 = OpLabel + OpBranch %35 + %35 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %37 = OpIAdd %uint %19 %uint_240 + %38 = OpUGreaterThanEqual %bool %37 %15 + OpBranchConditional %38 %40 %18 + %40 = OpLabel + OpBranch %42 + %42 = OpLabel + %44 = OpIAdd %uint %15 %uint_4294967280 + %46 = OpULessThanEqual %bool %15 %uint_16 + OpBranchConditional %46 %48 %14 + %48 = OpLabel + OpReturn + OpFunctionEnd + %55 = OpExtInst %void %52 Kernel %11 %53 %uint_0 %uint_0 %54 + %57 = OpExtInst %void %52 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/barrier_divergence/fail.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/barrier_divergence/fail.spv.dis new file mode 100644 index 0000000000..adc6a9c531 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/barrier_divergence/fail.spv.dis @@ -0,0 +1,66 @@ +; @Config: 4, 1, 2 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + %37 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %38 = OpString "foo" + %39 = OpString " __kernel" + %42 = OpString "a" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_72 = OpConstant %uint 72 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_1 = OpConstant %uint 1 + %uint_4 = OpConstant %uint 4 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %22 = OpLoad %uint %21 + %25 = OpIEqual %bool %22 %uint_3 + OpSelectionMerge %32 None + OpBranchConditional %25 %28 %32 + %28 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpBranch %32 + %32 = OpLabel + %33 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %34 = OpLoad %uint %33 + %36 = OpAccessChain %_ptr_Workgroup_uint %14 %34 + OpStore %36 %34 + OpReturn + OpFunctionEnd + %41 = OpExtInst %void %37 Kernel %17 %38 %uint_1 %uint_0 %39 + %43 = OpExtInst %void %37 ArgumentInfo %42 + %45 = OpExtInst %void %37 ArgumentWorkgroup %41 %uint_0 %uint_3 %uint_4 %43 + %46 = OpExtInst %void %37 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/barrier_divergence/pass.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/barrier_divergence/pass.spv.dis new file mode 100644 index 0000000000..c3db1ad1d9 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/barrier_divergence/pass.spv.dis @@ -0,0 +1,69 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + %34 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_LocalInvocationID %10 %14 %18 + OpSource OpenCL_C 200 + %35 = OpString "foo" + %36 = OpString " __kernel" + %38 = OpString "a" + %43 = OpString "b" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %15 SpecId 4 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %15 = OpSpecConstant %uint 1 +%_arr_uint_15 = OpTypeArray %uint %15 +%_ptr_Workgroup__arr_uint_15 = OpTypePointer Workgroup %_arr_uint_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_2 = OpConstant %uint 2 + %uint_72 = OpConstant %uint 72 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_1 = OpConstant %uint 1 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %18 = OpVariable %_ptr_Workgroup__arr_uint_15 Workgroup + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_Workgroup_uint %14 %26 + OpStore %28 %26 + OpControlBarrier %uint_2 %uint_2 %uint_72 + %31 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %32 = OpLoad %uint %31 + %33 = OpAccessChain %_ptr_Workgroup_uint %18 %32 + OpStore %33 %32 + OpReturn + OpFunctionEnd + %37 = OpExtInst %void %34 Kernel %21 %35 %uint_2 %uint_0 %36 + %39 = OpExtInst %void %34 ArgumentInfo %38 + %42 = OpExtInst %void %34 ArgumentWorkgroup %37 %uint_0 %uint_3 %uint_4 %39 + %44 = OpExtInst %void %34 ArgumentInfo %43 + %46 = OpExtInst %void %34 ArgumentWorkgroup %37 %uint_1 %uint_4 %uint_4 %44 + %47 = OpExtInst %void %34 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/needs_source_location_ensures.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/needs_source_location_ensures.spv.dis new file mode 100644 index 0000000000..13ed74dfa1 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/needs_source_location_ensures.spv.dis @@ -0,0 +1,77 @@ +; @Input: %17 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + %40 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %20 "foo" %gl_GlobalInvocationID %13 %17 %5 + OpSource OpenCL_C 200 + %41 = OpString "foo" + %42 = OpString " __kernel" + %45 = OpString "p" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %uint_24 = OpConstant %uint 24 + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %20 = OpFunction %void None %19 + %21 = OpLabel + %24 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 + %26 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %27 = OpLoad %uint %26 + %29 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %30 = OpLoad %uint %29 + %31 = OpIAdd %uint %30 %27 + %34 = OpIEqual %bool %31 %uint_24 + OpSelectionMerge %39 None + OpBranchConditional %34 %37 %39 + %37 = OpLabel + OpStore %24 %uint_24 + OpBranch %39 + %39 = OpLabel + OpReturn + OpFunctionEnd + %49 = OpExtInst %void %40 PushConstantRegionOffset %uint_0 %uint_12 + %44 = OpExtInst %void %40 Kernel %20 %41 %uint_1 %uint_0 %42 + %46 = OpExtInst %void %40 ArgumentInfo %45 + %47 = OpExtInst %void %40 ArgumentStorageBuffer %44 %uint_0 %uint_0 %uint_0 %46 + %51 = OpExtInst %void %40 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/needs_source_location_requires.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/needs_source_location_requires.spv.dis new file mode 100644 index 0000000000..3ef2d61b30 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/needs_source_location_requires.spv.dis @@ -0,0 +1,77 @@ +; @Input: %17 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + %40 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %20 "foo" %gl_GlobalInvocationID %13 %17 %5 + OpSource OpenCL_C 200 + %41 = OpString "foo" + %42 = OpString " __kernel" + %45 = OpString "p" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %uint_24 = OpConstant %uint 24 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %20 = OpFunction %void None %19 + %21 = OpLabel + %24 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %25 = OpLoad %uint %24 + %27 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %28 = OpLoad %uint %27 + %29 = OpIAdd %uint %28 %25 + %32 = OpIEqual %bool %29 %uint_24 + OpSelectionMerge %39 None + OpBranchConditional %32 %35 %39 + %35 = OpLabel + %37 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_24 + OpStore %37 %uint_24 + OpBranch %39 + %39 = OpLabel + OpReturn + OpFunctionEnd + %49 = OpExtInst %void %40 PushConstantRegionOffset %uint_0 %uint_12 + %44 = OpExtInst %void %40 Kernel %20 %41 %uint_1 %uint_0 %42 + %46 = OpExtInst %void %40 ArgumentInfo %45 + %47 = OpExtInst %void %40 ArgumentStorageBuffer %44 %uint_0 %uint_0 %uint_0 %46 + %51 = OpExtInst %void %40 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/race_from_call.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/race_from_call.spv.dis new file mode 100644 index 0000000000..74faa361c3 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/race_from_call.spv.dis @@ -0,0 +1,56 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %27 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "baz" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %28 = OpString "baz" + %29 = OpString " __kernel" + %31 = OpString "p" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %22 = OpLoad %uint %21 + %24 = OpIAdd %uint %22 %uint_1 + %26 = OpAccessChain %_ptr_Workgroup_uint %14 %24 + OpStore %26 %22 + OpReturn + OpFunctionEnd + %30 = OpExtInst %void %27 Kernel %17 %28 %uint_1 %uint_0 %29 + %32 = OpExtInst %void %27 ArgumentInfo %31 + %35 = OpExtInst %void %27 ArgumentWorkgroup %30 %uint_0 %uint_3 %uint_4 %32 + %37 = OpExtInst %void %27 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/race_from_call_in_loop.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/race_from_call_in_loop.spv.dis new file mode 100644 index 0000000000..4f9a9a9c50 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/race_from_call_in_loop.spv.dis @@ -0,0 +1,56 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %27 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "bar" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %28 = OpString "bar" + %29 = OpString " __kernel" + %31 = OpString "p" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %22 = OpLoad %uint %21 + %24 = OpIAdd %uint %22 %uint_1 + %26 = OpAccessChain %_ptr_Workgroup_uint %14 %24 + OpStore %26 %22 + OpReturn + OpFunctionEnd + %30 = OpExtInst %void %27 Kernel %17 %28 %uint_1 %uint_0 %29 + %32 = OpExtInst %void %27 ArgumentInfo %31 + %35 = OpExtInst %void %27 ArgumentWorkgroup %30 %uint_0 %uint_3 %uint_4 %32 + %37 = OpExtInst %void %27 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/race_with_loop.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/race_with_loop.spv.dis new file mode 100644 index 0000000000..51933401d2 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/race_with_loop.spv.dis @@ -0,0 +1,73 @@ +; @Config: 2, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 55 +; Schema: 0 + OpCapability Shader + %44 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %45 = OpString "foo" + %46 = OpString " __kernel" + %48 = OpString "p" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_99 = OpConstant %uint 99 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + OpBranch %20 + %20 = OpLabel + %21 = OpPhi %uint %uint_0 %18 %31 %20 + %22 = OpPhi %uint %uint_0 %18 %32 %20 + %24 = OpAccessChain %_ptr_Workgroup_uint %14 %22 + %25 = OpLoad %uint %24 + %26 = OpIAdd %uint %25 %21 + %28 = OpIAdd %uint %22 %uint_1 + %29 = OpAccessChain %_ptr_Workgroup_uint %14 %28 + %30 = OpLoad %uint %29 + %31 = OpIAdd %uint %26 %30 + %32 = OpIAdd %uint %22 %uint_1 + %35 = OpUGreaterThanEqual %bool %22 %uint_99 + OpLoopMerge %38 %20 None + OpBranchConditional %35 %38 %20 + %38 = OpLabel + %41 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %42 = OpLoad %uint %41 + %43 = OpAccessChain %_ptr_Workgroup_uint %14 %42 + OpStore %43 %31 + OpReturn + OpFunctionEnd + %47 = OpExtInst %void %44 Kernel %17 %45 %uint_1 %uint_0 %46 + %49 = OpExtInst %void %44 ArgumentInfo %48 + %52 = OpExtInst %void %44 ArgumentWorkgroup %47 %uint_0 %uint_3 %uint_4 %49 + %54 = OpExtInst %void %44 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races/fail/read_write.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races/fail/read_write.spv.dis new file mode 100644 index 0000000000..e3b5fbe370 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races/fail/read_write.spv.dis @@ -0,0 +1,72 @@ +; @Input: %11 = 9 +; @Input: %15 = 9 +; @Config: 9, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %35 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_LocalInvocationID %10 %14 %18 + OpSource OpenCL_C 200 + %36 = OpString "foo" + %37 = OpString " __kernel" + %40 = OpString "a" + %45 = OpString "b" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %15 SpecId 4 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %15 = OpSpecConstant %uint 1 +%_arr_uint_15 = OpTypeArray %uint %15 +%_ptr_Workgroup__arr_uint_15 = OpTypePointer Workgroup %_arr_uint_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_8 = OpConstant %uint 8 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_1 = OpConstant %uint 1 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %18 = OpVariable %_ptr_Workgroup__arr_uint_15 Workgroup + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Workgroup_uint %14 %uint_8 + %26 = OpLoad %uint %25 + %29 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %30 = OpLoad %uint %29 + %31 = OpAccessChain %_ptr_Workgroup_uint %18 %30 + OpStore %31 %26 + %32 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %33 = OpLoad %uint %32 + %34 = OpAccessChain %_ptr_Workgroup_uint %14 %33 + OpStore %34 %33 + OpReturn + OpFunctionEnd + %39 = OpExtInst %void %35 Kernel %21 %36 %uint_2 %uint_0 %37 + %41 = OpExtInst %void %35 ArgumentInfo %40 + %44 = OpExtInst %void %35 ArgumentWorkgroup %39 %uint_0 %uint_3 %uint_4 %41 + %46 = OpExtInst %void %35 ArgumentInfo %45 + %48 = OpExtInst %void %35 ArgumentWorkgroup %39 %uint_1 %uint_4 %uint_4 %46 + %49 = OpExtInst %void %35 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races/fail/write_read.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races/fail/write_read.spv.dis new file mode 100644 index 0000000000..dcd292d71e --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races/fail/write_read.spv.dis @@ -0,0 +1,68 @@ +; @Input: %11 = 4 +; @Config: 4, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + %33 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_LocalInvocationID %10 %14 %18 + OpSource OpenCL_C 200 + %34 = OpString "foo" + %35 = OpString " __kernel" + %38 = OpString "a" + %42 = OpString "b" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %15 SpecId 4 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %15 = OpSpecConstant %uint 1 +%_arr_uint_15 = OpTypeArray %uint %15 +%_ptr_Workgroup__arr_uint_15 = OpTypePointer Workgroup %_arr_uint_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_4 = OpConstant %uint 4 + %uint_1 = OpConstant %uint 1 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %18 = OpVariable %_ptr_Workgroup__arr_uint_15 Workgroup + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_Workgroup_uint %14 %26 + OpStore %28 %26 + %30 = OpAccessChain %_ptr_Workgroup_uint %14 %uint_3 + %31 = OpLoad %uint %30 + %32 = OpAccessChain %_ptr_Workgroup_uint %18 %26 + OpStore %32 %31 + OpReturn + OpFunctionEnd + %37 = OpExtInst %void %33 Kernel %21 %34 %uint_2 %uint_0 %35 + %39 = OpExtInst %void %33 ArgumentInfo %38 + %41 = OpExtInst %void %33 ArgumentWorkgroup %37 %uint_0 %uint_3 %uint_4 %39 + %43 = OpExtInst %void %33 ArgumentInfo %42 + %45 = OpExtInst %void %33 ArgumentWorkgroup %37 %uint_1 %uint_4 %uint_4 %43 + %46 = OpExtInst %void %33 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races/fail/write_write/elem_width_16.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races/fail/write_write/elem_width_16.spv.dis new file mode 100644 index 0000000000..99d39f8556 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races/fail/write_write/elem_width_16.spv.dis @@ -0,0 +1,62 @@ +; @Input: %15 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Int16 + %28 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %18 "foo" %gl_LocalInvocationID %10 %15 + OpSource OpenCL_C 200 + %29 = OpString "foo" + %30 = OpString " __kernel" + %33 = OpString "q" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_ushort ArrayStride 2 + OpMemberDecorate %_struct_13 0 Offset 0 + OpDecorate %_struct_13 Block + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %ushort = OpTypeInt 16 0 +%_runtimearr_ushort = OpTypeRuntimeArray %ushort + %_struct_13 = OpTypeStruct %_runtimearr_ushort +%_ptr_StorageBuffer__struct_13 = OpTypePointer StorageBuffer %_struct_13 + %void = OpTypeVoid + %17 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_ushort = OpTypePointer StorageBuffer %ushort + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %15 = OpVariable %_ptr_StorageBuffer__struct_13 StorageBuffer + %18 = OpFunction %void None %17 + %19 = OpLabel + %22 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %23 = OpLoad %uint %22 + %24 = OpUConvert %ushort %23 + %27 = OpAccessChain %_ptr_StorageBuffer_ushort %15 %uint_0 %uint_3 + OpStore %27 %24 + OpReturn + OpFunctionEnd + %32 = OpExtInst %void %28 Kernel %18 %29 %uint_2 %uint_0 %30 + %34 = OpExtInst %void %28 ArgumentInfo %33 + %36 = OpExtInst %void %28 ArgumentStorageBuffer %32 %uint_1 %uint_0 %uint_0 %34 + %37 = OpExtInst %void %28 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races/fail/write_write/loop.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races/fail/write_write/loop.spv.dis new file mode 100644 index 0000000000..1b34fdf3b7 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races/fail/write_write/loop.spv.dis @@ -0,0 +1,95 @@ +; @Input: %11 = 6 +; @Config: 6, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 75 +; Schema: 0 + OpCapability Shader + %65 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %66 = OpString "foo" + %67 = OpString " __kernel" + %69 = OpString "p" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_5 = OpConstant %uint 5 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool + %uint_4 = OpConstant %uint 4 + %uint_1 = OpConstant %uint 1 + %uint_99 = OpConstant %uint 99 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Workgroup_uint %14 %uint_5 + OpBranch %23 + %23 = OpLabel + %24 = OpPhi %uint %uint_0 %18 %58 %56 + %27 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %28 = OpLoad %uint %27 + OpLoopMerge %62 %56 None + OpBranch %31 + %31 = OpLabel + %33 = OpSGreaterThanEqual %bool %28 %uint_5 + OpSelectionMerge %44 None + OpBranchConditional %33 %36 %44 + %36 = OpLabel + %37 = OpIEqual %bool %28 %uint_5 + OpSelectionMerge %42 None + OpBranchConditional %37 %40 %42 + %40 = OpLabel + OpStore %21 %uint_5 + OpBranch %42 + %42 = OpLabel + OpBranch %44 + %44 = OpLabel + %45 = OpPhi %bool %false %42 %true %31 + OpBranchConditional %45 %47 %56 + %47 = OpLabel + %49 = OpIEqual %bool %28 %uint_4 + OpSelectionMerge %54 None + OpBranchConditional %49 %52 %54 + %52 = OpLabel + OpStore %21 %uint_4 + OpBranch %54 + %54 = OpLabel + OpBranch %56 + %56 = OpLabel + %58 = OpIAdd %uint %24 %uint_1 + %60 = OpUGreaterThanEqual %bool %24 %uint_99 + OpBranchConditional %60 %62 %23 + %62 = OpLabel + OpReturn + OpFunctionEnd + %68 = OpExtInst %void %65 Kernel %17 %66 %uint_1 %uint_0 %67 + %70 = OpExtInst %void %65 ArgumentInfo %69 + %72 = OpExtInst %void %65 ArgumentWorkgroup %68 %uint_0 %uint_3 %uint_4 %70 + %74 = OpExtInst %void %65 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races/fail/write_write/normal.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races/fail/write_write/normal.spv.dis new file mode 100644 index 0000000000..180347cfda --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races/fail/write_write/normal.spv.dis @@ -0,0 +1,67 @@ +; @Input: %14 = {0, 0, 0, 0, 0, 0, 0, 0} +; @Input: %11 = 8 +; @Config: 8, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + %34 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %35 = OpString "foo" + %36 = OpString " __kernel" + %39 = OpString "a" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %bool = OpTypeBool + %uint_7 = OpConstant %uint 7 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %22 = OpLoad %uint %21 + %24 = OpAccessChain %_ptr_Workgroup_uint %14 %22 + OpStore %24 %22 + %26 = OpIEqual %bool %22 %uint_0 + OpSelectionMerge %33 None + OpBranchConditional %26 %29 %33 + %29 = OpLabel + %31 = OpAccessChain %_ptr_Workgroup_uint %14 %uint_7 + OpStore %31 %uint_0 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd + %38 = OpExtInst %void %34 Kernel %17 %35 %uint_1 %uint_0 %36 + %40 = OpExtInst %void %34 ArgumentInfo %39 + %43 = OpExtInst %void %34 ArgumentWorkgroup %38 %uint_0 %uint_3 %uint_4 %40 + %45 = OpExtInst %void %34 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races/pass/no_race.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races/pass/no_race.spv.dis new file mode 100644 index 0000000000..fcefc98b74 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races/pass/no_race.spv.dis @@ -0,0 +1,98 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 77 +; Schema: 0 + OpCapability Shader + %58 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %25 "foo" %gl_LocalInvocationID %10 %14 %18 %22 + OpSource OpenCL_C 200 + %59 = OpString "foo" + %60 = OpString " __kernel" + %63 = OpString "p" + %67 = OpString "q" + %71 = OpString "r" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %15 SpecId 4 + OpDecorate %19 SpecId 5 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %15 = OpSpecConstant %uint 1 +%_arr_uint_15 = OpTypeArray %uint %15 +%_ptr_Workgroup__arr_uint_15 = OpTypePointer Workgroup %_arr_uint_15 + %19 = OpSpecConstant %uint 1 +%_arr_uint_19 = OpTypeArray %uint %19 +%_ptr_Workgroup__arr_uint_19 = OpTypePointer Workgroup %_arr_uint_19 + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool + %uint_10 = OpConstant %uint 10 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_11 = OpConstant %uint 11 + %true = OpConstantTrue %bool + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_5 = OpConstant %uint 5 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %18 = OpVariable %_ptr_Workgroup__arr_uint_15 Workgroup + %22 = OpVariable %_ptr_Workgroup__arr_uint_19 Workgroup + %25 = OpFunction %void None %24 + %26 = OpLabel + %29 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %30 = OpLoad %uint %29 + %33 = OpUGreaterThan %bool %30 %uint_10 + OpSelectionMerge %46 None + OpBranchConditional %33 %36 %46 + %36 = OpLabel + %38 = OpAccessChain %_ptr_Workgroup_uint %18 %30 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Workgroup_uint %14 %30 + OpStore %40 %39 + %41 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %42 = OpLoad %uint %41 + %44 = OpULessThan %bool %42 %uint_11 + OpBranch %46 + %46 = OpLabel + %47 = OpPhi %uint %42 %36 %30 %26 + %48 = OpPhi %bool %44 %36 %true %26 + OpSelectionMerge %56 None + OpBranchConditional %48 %51 %56 + %51 = OpLabel + %52 = OpAccessChain %_ptr_Workgroup_uint %14 %47 + %53 = OpLoad %uint %52 + %54 = OpAccessChain %_ptr_Workgroup_uint %22 %47 + OpStore %54 %53 + OpBranch %56 + %56 = OpLabel + OpReturn + OpFunctionEnd + %62 = OpExtInst %void %58 Kernel %25 %59 %uint_3 %uint_0 %60 + %64 = OpExtInst %void %58 ArgumentInfo %63 + %66 = OpExtInst %void %58 ArgumentWorkgroup %62 %uint_0 %uint_3 %uint_4 %64 + %68 = OpExtInst %void %58 ArgumentInfo %67 + %70 = OpExtInst %void %58 ArgumentWorkgroup %62 %uint_1 %uint_4 %uint_4 %68 + %72 = OpExtInst %void %58 ArgumentInfo %71 + %75 = OpExtInst %void %58 ArgumentWorkgroup %62 %uint_2 %uint_5 %uint_4 %72 + %76 = OpExtInst %void %58 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races/pass/read_read.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races/pass/read_read.spv.dis new file mode 100644 index 0000000000..018913df6e --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races/pass/read_read.spv.dis @@ -0,0 +1,80 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %40 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %25 "foo" %gl_LocalInvocationID %10 %14 %18 %22 + OpSource OpenCL_C 200 + %41 = OpString "foo" + %42 = OpString " __kernel" + %45 = OpString "p" + %49 = OpString "q" + %53 = OpString "r" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %15 SpecId 4 + OpDecorate %19 SpecId 5 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %15 = OpSpecConstant %uint 1 +%_arr_uint_15 = OpTypeArray %uint %15 +%_ptr_Workgroup__arr_uint_15 = OpTypePointer Workgroup %_arr_uint_15 + %19 = OpSpecConstant %uint 1 +%_arr_uint_19 = OpTypeArray %uint %19 +%_ptr_Workgroup__arr_uint_19 = OpTypePointer Workgroup %_arr_uint_19 + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_5 = OpConstant %uint 5 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %18 = OpVariable %_ptr_Workgroup__arr_uint_15 Workgroup + %22 = OpVariable %_ptr_Workgroup__arr_uint_19 Workgroup + %25 = OpFunction %void None %24 + %26 = OpLabel + %29 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %30 = OpLoad %uint %29 + %32 = OpAccessChain %_ptr_Workgroup_uint %18 %30 + %33 = OpLoad %uint %32 + %34 = OpAccessChain %_ptr_Workgroup_uint %14 %30 + OpStore %34 %33 + %35 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %37 = OpAccessChain %_ptr_Workgroup_uint %18 %36 + %38 = OpLoad %uint %37 + %39 = OpAccessChain %_ptr_Workgroup_uint %22 %36 + OpStore %39 %38 + OpReturn + OpFunctionEnd + %44 = OpExtInst %void %40 Kernel %25 %41 %uint_3 %uint_0 %42 + %46 = OpExtInst %void %40 ArgumentInfo %45 + %48 = OpExtInst %void %40 ArgumentWorkgroup %44 %uint_0 %uint_3 %uint_4 %46 + %50 = OpExtInst %void %40 ArgumentInfo %49 + %52 = OpExtInst %void %40 ArgumentWorkgroup %44 %uint_1 %uint_4 %uint_4 %50 + %54 = OpExtInst %void %40 ArgumentInfo %53 + %57 = OpExtInst %void %40 ArgumentWorkgroup %44 %uint_2 %uint_5 %uint_4 %54 + %58 = OpExtInst %void %40 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races_from_indirect_calls.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races_from_indirect_calls.spv.dis new file mode 100644 index 0000000000..74faa361c3 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/sourcelocation_tests/races_from_indirect_calls.spv.dis @@ -0,0 +1,56 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %27 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "baz" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %28 = OpString "baz" + %29 = OpString " __kernel" + %31 = OpString "p" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %22 = OpLoad %uint %21 + %24 = OpIAdd %uint %22 %uint_1 + %26 = OpAccessChain %_ptr_Workgroup_uint %14 %24 + OpStore %26 %22 + OpReturn + OpFunctionEnd + %30 = OpExtInst %void %27 Kernel %17 %28 %uint_1 %uint_0 %29 + %32 = OpExtInst %void %27 ArgumentInfo %31 + %35 = OpExtInst %void %27 ArgumentWorkgroup %30 %uint_0 %uint_3 %uint_4 %32 + %37 = OpExtInst %void %27 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/ternarytest.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/ternarytest.spv.dis new file mode 100644 index 0000000000..0e51e99625 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/ternarytest.spv.dis @@ -0,0 +1,61 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %32 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %18 "foo" %gl_LocalInvocationID %10 %15 + OpSource OpenCL_C 200 + %33 = OpString "foo" + %34 = OpString " __kernel" + %36 = OpString "A" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 + %float = OpTypeFloat 32 +%_arr_float_11 = OpTypeArray %float %11 +%_ptr_Workgroup__arr_float_11 = OpTypePointer Workgroup %_arr_float_11 + %void = OpTypeVoid + %17 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_float = OpTypePointer Workgroup %float +%float_2_4000001 = OpConstant %float 2.4000001 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %15 = OpVariable %_ptr_Workgroup__arr_float_11 Workgroup + %18 = OpFunction %void None %17 + %19 = OpLabel + %22 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %23 = OpLoad %uint %22 + %25 = OpIEqual %bool %23 %uint_0 + %27 = OpShiftLeftLogical %uint %23 %uint_1 + %28 = OpSelect %uint %25 %uint_1 %27 + %30 = OpAccessChain %_ptr_Workgroup_float %15 %28 + OpStore %30 %float_2_4000001 + OpReturn + OpFunctionEnd + %35 = OpExtInst %void %32 Kernel %18 %33 %uint_1 %uint_0 %34 + %37 = OpExtInst %void %32 ArgumentInfo %36 + %40 = OpExtInst %void %32 ArgumentWorkgroup %35 %uint_0 %uint_3 %uint_4 %37 + %42 = OpExtInst %void %32 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/ternarytest2.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/ternarytest2.spv.dis new file mode 100644 index 0000000000..0e51e99625 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/ternarytest2.spv.dis @@ -0,0 +1,61 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %32 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %18 "foo" %gl_LocalInvocationID %10 %15 + OpSource OpenCL_C 200 + %33 = OpString "foo" + %34 = OpString " __kernel" + %36 = OpString "A" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 + %float = OpTypeFloat 32 +%_arr_float_11 = OpTypeArray %float %11 +%_ptr_Workgroup__arr_float_11 = OpTypePointer Workgroup %_arr_float_11 + %void = OpTypeVoid + %17 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_float = OpTypePointer Workgroup %float +%float_2_4000001 = OpConstant %float 2.4000001 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %15 = OpVariable %_ptr_Workgroup__arr_float_11 Workgroup + %18 = OpFunction %void None %17 + %19 = OpLabel + %22 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %23 = OpLoad %uint %22 + %25 = OpIEqual %bool %23 %uint_0 + %27 = OpShiftLeftLogical %uint %23 %uint_1 + %28 = OpSelect %uint %25 %uint_1 %27 + %30 = OpAccessChain %_ptr_Workgroup_float %15 %28 + OpStore %30 %float_2_4000001 + OpReturn + OpFunctionEnd + %35 = OpExtInst %void %32 Kernel %18 %33 %uint_1 %uint_0 %34 + %37 = OpExtInst %void %32 ArgumentInfo %36 + %40 = OpExtInst %void %32 ArgumentWorkgroup %35 %uint_0 %uint_3 %uint_4 %37 + %42 = OpExtInst %void %32 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/test_2d_global_index_inference.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/test_2d_global_index_inference.spv.dis new file mode 100644 index 0000000000..4222b1cccf --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/test_2d_global_index_inference.spv.dis @@ -0,0 +1,117 @@ +; @Input: %5 = {{9, 1, 1}, {0, 0, 0}} +; @Input: %17 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 86 +; Schema: 0 + OpCapability Shader + %71 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %13 %17 %18 %5 + OpSource OpenCL_C 200 + %72 = OpString "foo" + %73 = OpString " __kernel" + %75 = OpString "A" + %78 = OpString "B" + OpMemberDecorate %_struct_3 0 Offset 0 + OpMemberDecorate %_struct_3 1 Offset 16 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpDecorate %_struct_15 Block + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 0 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_15 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_15 = OpTypePointer StorageBuffer %_struct_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_2 = OpConstant %uint 2 + %bool = OpTypeBool + %uint_99 = OpConstant %uint 99 + %uint_12 = OpConstant %uint 12 + %uint_16 = OpConstant %uint 16 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %17 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %18 = OpVariable %_ptr_StorageBuffer__struct_15 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %29 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_0 + %30 = OpLoad %uint %29 + %31 = OpIAdd %uint %30 %26 + %32 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_1 + %33 = OpLoad %uint %32 + %34 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_1 + %35 = OpLoad %uint %34 + %36 = OpIAdd %uint %35 %33 + %37 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %38 = OpLoad %uint %37 + %39 = OpIMul %uint %38 %36 + %40 = OpIAdd %uint %39 %31 + %42 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %40 + %43 = OpIAdd %uint %39 %26 + %44 = OpIAdd %uint %43 %30 + %45 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %44 + OpBranch %47 + %47 = OpLabel + %48 = OpPhi %uint %uint_0 %22 %64 %47 + %49 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_1 + %50 = OpLoad %uint %49 + %51 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_1 %uint_1 + %52 = OpLoad %uint %51 + %53 = OpIAdd %uint %52 %50 + %54 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %55 = OpLoad %uint %54 + %56 = OpIMul %uint %55 %53 + %57 = OpIAdd %uint %31 %56 + %58 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %57 + %59 = OpLoad %uint %58 + %61 = OpIAdd %uint %59 %uint_2 + OpStore %42 %61 + %62 = OpLoad %uint %45 + %63 = OpIAdd %uint %62 %uint_1 + OpStore %45 %63 + %64 = OpIAdd %uint %48 %uint_1 + %67 = OpUGreaterThanEqual %bool %48 %uint_99 + OpLoopMerge %70 %47 None + OpBranchConditional %67 %70 %47 + %70 = OpLabel + OpReturn + OpFunctionEnd + %82 = OpExtInst %void %71 PushConstantGlobalSize %uint_0 %uint_12 + %84 = OpExtInst %void %71 PushConstantRegionOffset %uint_16 %uint_12 + %74 = OpExtInst %void %71 Kernel %21 %72 %uint_2 %uint_0 %73 + %76 = OpExtInst %void %71 ArgumentInfo %75 + %77 = OpExtInst %void %71 ArgumentStorageBuffer %74 %uint_0 %uint_0 %uint_0 %76 + %79 = OpExtInst %void %71 ArgumentInfo %78 + %80 = OpExtInst %void %71 ArgumentStorageBuffer %74 %uint_1 %uint_0 %uint_1 %79 + %85 = OpExtInst %void %71 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/test_2d_local_index_inference.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/test_2d_local_index_inference.spv.dis new file mode 100644 index 0000000000..ae18f8000f --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/test_2d_local_index_inference.spv.dis @@ -0,0 +1,58 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + %35 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %5 %12 %gl_LocalInvocationID + OpSource OpenCL_C 200 + %36 = OpString "foo" + %37 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %6 SpecId 0 + OpDecorate %7 SpecId 1 + OpDecorate %8 SpecId 2 + %uint = OpTypeInt 32 0 + %uint_1024 = OpConstant %uint 1024 +%_arr_uint_uint_1024 = OpTypeArray %uint %uint_1024 +%_ptr_Workgroup__arr_uint_uint_1024 = OpTypePointer Workgroup %_arr_uint_uint_1024 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 + %8 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %6 %7 %8 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_100 = OpConstant %uint 100 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_Workgroup__arr_uint_uint_1024 Workgroup + %12 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %22 = OpLoad %uint %21 + %24 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %25 = OpLoad %uint %24 + %26 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %27 = OpCompositeExtract %uint %26 0 + %28 = OpIMul %uint %27 %25 + %29 = OpIAdd %uint %28 %22 + %31 = OpAccessChain %_ptr_Workgroup_uint %5 %29 + %32 = OpLoad %uint %31 + %34 = OpIAdd %uint %32 %uint_100 + OpStore %31 %34 + OpReturn + OpFunctionEnd + %38 = OpExtInst %void %35 Kernel %17 %36 %uint_0 %uint_0 %37 + %40 = OpExtInst %void %35 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/test_2d_local_index_inference_2.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/test_2d_local_index_inference_2.spv.dis new file mode 100644 index 0000000000..c59ca24eef --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/test_2d_local_index_inference_2.spv.dis @@ -0,0 +1,55 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %32 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %18 "foo" %6 %gl_LocalInvocationID %15 + OpSource OpenCL_C 200 + %33 = OpString "foo" + %34 = OpString " __kernel" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_uint_uint_16 = OpTypeArray %uint %uint_16 +%_arr__arr_uint_uint_16_uint_16 = OpTypeArray %_arr_uint_uint_16 %uint_16 +%_ptr_Workgroup__arr__arr_uint_uint_16_uint_16 = OpTypePointer Workgroup %_arr__arr_uint_uint_16_uint_16 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %17 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_100 = OpConstant %uint 100 + %uint_2 = OpConstant %uint 2 + %6 = OpVariable %_ptr_Workgroup__arr__arr_uint_uint_16_uint_16 Workgroup +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpFunction %void None %17 + %19 = OpLabel + %22 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %23 = OpLoad %uint %22 + %25 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_Workgroup_uint %6 %23 %26 + %29 = OpLoad %uint %28 + %31 = OpIAdd %uint %29 %uint_100 + OpStore %28 %31 + OpReturn + OpFunctionEnd + %35 = OpExtInst %void %32 Kernel %18 %33 %uint_0 %uint_0 %34 + %37 = OpExtInst %void %32 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/test_address_of_bug.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/test_address_of_bug.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/test_address_of_bug.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/test_float_neq.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/test_float_neq.spv.dis new file mode 100644 index 0000000000..76fefda694 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/test_float_neq.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %18 = OpExtInst %void %13 Kernel %11 %14 %uint_2 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/test_for_benign_read_write_bug.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/test_for_benign_read_write_bug.spv.dis new file mode 100644 index 0000000000..3219791a56 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/test_for_benign_read_write_bug.spv.dis @@ -0,0 +1,53 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Int16 + %24 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %16 "foo" %8 %13 + OpSource OpenCL_C 200 + %25 = OpString "foo" + %26 = OpString " __kernel" + %29 = OpString "p" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %9 SpecId 3 + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %9 = OpSpecConstant %uint 1 + %ushort = OpTypeInt 16 0 +%_arr_ushort_9 = OpTypeArray %ushort %9 +%_ptr_Workgroup__arr_ushort_9 = OpTypePointer Workgroup %_arr_ushort_9 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Workgroup_ushort = OpTypePointer Workgroup %ushort + %uint_0 = OpConstant %uint 0 + %ushort_1 = OpConstant %ushort 1 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %13 = OpVariable %_ptr_Workgroup__arr_ushort_9 Workgroup + %16 = OpFunction %void None %15 + %17 = OpLabel + %20 = OpAccessChain %_ptr_Workgroup_ushort %13 %uint_0 + %21 = OpLoad %ushort %20 + %23 = OpIAdd %ushort %21 %ushort_1 + OpStore %20 %23 + OpReturn + OpFunctionEnd + %28 = OpExtInst %void %24 Kernel %16 %25 %uint_1 %uint_0 %26 + %30 = OpExtInst %void %24 ArgumentInfo %29 + %33 = OpExtInst %void %24 ArgumentWorkgroup %28 %uint_0 %uint_3 %uint_2 %30 + %34 = OpExtInst %void %24 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/test_for_get_group_id.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/test_for_get_group_id.spv.dis new file mode 100644 index 0000000000..3bdb1ce7cb --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/test_for_get_group_id.spv.dis @@ -0,0 +1,82 @@ +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + %44 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "foo" %gl_LocalInvocationID %gl_WorkGroupID %14 %19 %5 + OpSource OpenCL_C 200 + %45 = OpString "foo" + %46 = OpString " __kernel" + %49 = OpString "A" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %9 SpecId 0 + OpDecorate %10 SpecId 1 + OpDecorate %11 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %9 %10 %11 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_17 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %float_42 = OpConstant %float 42 + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + %26 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %27 = OpLoad %uint %26 + %29 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %30 = OpLoad %uint %29 + %31 = OpISub %uint %uint_0 %30 + %33 = OpIEqual %bool %27 %31 + OpSelectionMerge %43 None + OpBranchConditional %33 %36 %43 + %36 = OpLabel + %37 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %38 = OpLoad %uint %37 + %40 = OpAccessChain %_ptr_StorageBuffer_float %19 %uint_0 %38 + OpStore %40 %float_42 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd + %53 = OpExtInst %void %44 PushConstantRegionGroupOffset %uint_0 %uint_12 + %48 = OpExtInst %void %44 Kernel %22 %45 %uint_1 %uint_0 %46 + %50 = OpExtInst %void %44 ArgumentInfo %49 + %51 = OpExtInst %void %44 ArgumentStorageBuffer %48 %uint_0 %uint_0 %uint_0 %50 + %55 = OpExtInst %void %44 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/test_for_ssa_bug.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/test_for_ssa_bug.spv.dis new file mode 100644 index 0000000000..1c926ced24 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/test_for_ssa_bug.spv.dis @@ -0,0 +1,72 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + %43 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %44 = OpString "foo" + %45 = OpString " __kernel" + %47 = OpString "A" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %uint_1 = OpConstant %uint 1 + %uint_7 = OpConstant %uint 7 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Workgroup_uint %14 %uint_0 + OpBranch %23 + %23 = OpLabel + %24 = OpPhi %uint %uint_0 %18 %38 %34 + %26 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %27 = OpLoad %uint %26 + %29 = OpIEqual %bool %27 %uint_0 + OpLoopMerge %42 %34 None + OpBranchConditional %29 %32 %34 + %32 = OpLabel + OpStore %21 %24 + OpBranch %34 + %34 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %38 = OpIAdd %uint %24 %uint_1 + %40 = OpUGreaterThanEqual %bool %24 %uint_7 + OpBranchConditional %40 %42 %23 + %42 = OpLabel + OpReturn + OpFunctionEnd + %46 = OpExtInst %void %43 Kernel %17 %44 %uint_1 %uint_0 %45 + %48 = OpExtInst %void %43 ArgumentInfo %47 + %51 = OpExtInst %void %43 ArgumentWorkgroup %46 %uint_0 %uint_3 %uint_4 %48 + %52 = OpExtInst %void %43 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/test_global_id_inference.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/test_global_id_inference.spv.dis new file mode 100644 index 0000000000..4cdcdcf910 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/test_global_id_inference.spv.dis @@ -0,0 +1,100 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 70 +; Schema: 0 + OpCapability Shader + %57 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "foo" %11 %gl_LocalInvocationID %gl_WorkGroupID %18 %19 %5 + OpSource OpenCL_C 200 + %58 = OpString "foo" + %59 = OpString " __kernel" + %61 = OpString "A" + %64 = OpString "B" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 1 + OpDecorate %6 SpecId 0 + OpDecorate %7 SpecId 1 + OpDecorate %8 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 + %8 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %6 %7 %8 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_99 = OpConstant %uint 99 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant + %11 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + %26 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %27 = OpLoad %uint %26 + %28 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %29 = OpLoad %uint %28 + %31 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %32 = OpLoad %uint %31 + %33 = OpIAdd %uint %32 %29 + %34 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %35 = OpCompositeExtract %uint %34 0 + %36 = OpIMul %uint %35 %33 + %37 = OpIAdd %uint %36 %27 + %39 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %37 + %40 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %37 + OpBranch %42 + %42 = OpLabel + %43 = OpPhi %uint %uint_0 %23 %50 %42 + %44 = OpLoad %uint %39 + %46 = OpIAdd %uint %44 %uint_2 + OpStore %40 %46 + %47 = OpLoad %uint %39 + %49 = OpIAdd %uint %47 %uint_1 + OpStore %39 %49 + %50 = OpIAdd %uint %43 %uint_1 + %53 = OpUGreaterThanEqual %bool %43 %uint_99 + OpLoopMerge %56 %42 None + OpBranchConditional %53 %56 %42 + %56 = OpLabel + OpReturn + OpFunctionEnd + %68 = OpExtInst %void %57 PushConstantRegionGroupOffset %uint_0 %uint_12 + %60 = OpExtInst %void %57 Kernel %22 %58 %uint_2 %uint_0 %59 + %62 = OpExtInst %void %57 ArgumentInfo %61 + %63 = OpExtInst %void %57 ArgumentStorageBuffer %60 %uint_0 %uint_0 %uint_0 %62 + %65 = OpExtInst %void %57 ArgumentInfo %64 + %66 = OpExtInst %void %57 ArgumentStorageBuffer %60 %uint_1 %uint_0 %uint_1 %65 + %69 = OpExtInst %void %57 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/test_line_number_problem.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/test_line_number_problem.spv.dis new file mode 100644 index 0000000000..fa4015e2ec --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/test_line_number_problem.spv.dis @@ -0,0 +1,96 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 77 +; Schema: 0 + OpCapability Shader + %67 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %8 %gl_LocalInvocationID %14 + OpSource OpenCL_C 200 + %68 = OpString "foo" + %69 = OpString " __kernel" + %71 = OpString "A" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %11 SpecId 3 + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %19 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %20 = OpCompositeExtract %uint %19 0 + %23 = OpUGreaterThan %bool %20 %uint_1 + OpSelectionMerge %66 None + OpBranchConditional %23 %26 %66 + %26 = OpLabel + %27 = OpPhi %uint %46 %58 %uint_0 %18 + %28 = OpPhi %uint %59 %58 %uint_1 %18 + %31 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %32 = OpLoad %uint %31 + %33 = OpULessThan %bool %28 %32 + OpLoopMerge %64 %58 None + OpBranch %36 + %36 = OpLabel + OpSelectionMerge %45 None + OpBranchConditional %33 %39 %45 + %39 = OpLabel + %40 = OpISub %uint %32 %28 + %42 = OpAccessChain %_ptr_Workgroup_uint %14 %40 + %43 = OpLoad %uint %42 + OpBranch %45 + %45 = OpLabel + %46 = OpPhi %uint %43 %39 %27 %36 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %49 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %50 = OpLoad %uint %49 + %51 = OpULessThan %bool %28 %50 + OpBranchConditional %51 %53 %58 + %53 = OpLabel + %54 = OpAccessChain %_ptr_Workgroup_uint %14 %50 + %55 = OpLoad %uint %54 + %56 = OpIAdd %uint %55 %46 + OpStore %54 %56 + OpBranch %58 + %58 = OpLabel + %59 = OpShiftLeftLogical %uint %28 %uint_1 + %60 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %61 = OpCompositeExtract %uint %60 0 + %62 = OpUGreaterThanEqual %bool %59 %61 + OpBranchConditional %62 %64 %26 + %64 = OpLabel + OpBranch %66 + %66 = OpLabel + OpReturn + OpFunctionEnd + %70 = OpExtInst %void %67 Kernel %17 %68 %uint_1 %uint_0 %69 + %72 = OpExtInst %void %67 ArgumentInfo %71 + %75 = OpExtInst %void %67 ArgumentWorkgroup %70 %uint_0 %uint_3 %uint_4 %72 + %76 = OpExtInst %void %67 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/test_local_id_inference.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/test_local_id_inference.spv.dis new file mode 100644 index 0000000000..35a5af43a4 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/test_local_id_inference.spv.dis @@ -0,0 +1,56 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %26 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %27 = OpString "foo" + %28 = OpString " __kernel" + %31 = OpString "A" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_100 = OpConstant %uint 100 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %22 = OpLoad %uint %21 + %24 = OpAccessChain %_ptr_Workgroup_uint %14 %22 + OpStore %24 %uint_100 + OpReturn + OpFunctionEnd + %30 = OpExtInst %void %26 Kernel %17 %27 %uint_1 %uint_0 %28 + %32 = OpExtInst %void %26 ArgumentInfo %31 + %35 = OpExtInst %void %26 ArgumentWorkgroup %30 %uint_0 %uint_3 %uint_4 %32 + %37 = OpExtInst %void %26 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/test_mod_invariants/global_reduce_strength.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/test_mod_invariants/global_reduce_strength.spv.dis new file mode 100644 index 0000000000..0b1f50b75a --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/test_mod_invariants/global_reduce_strength.spv.dis @@ -0,0 +1,114 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %19 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Input: %20 = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 80 +; Schema: 0 + OpCapability Shader + %61 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %23 "foo" %gl_GlobalInvocationID %gl_LocalInvocationID %14 %18 %19 %20 %5 + OpSource OpenCL_C 200 + %62 = OpString "foo" + %63 = OpString " __kernel" + %66 = OpString "A" + %69 = OpString "B" + %73 = OpString "C" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 1 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 2 + OpDecorate %9 SpecId 0 + OpDecorate %10 SpecId 1 + OpDecorate %11 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %9 %10 %11 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %bool = OpTypeBool + %uint_1024 = OpConstant %uint 1024 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_10 = OpConstant %uint 10 + %uint_20 = OpConstant %uint 20 + %uint_256 = OpConstant %uint 256 + %uint_768 = OpConstant %uint 768 + %uint_3 = OpConstant %uint 3 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_12 = OpConstant %uint 12 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %19 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %20 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %23 = OpFunction %void None %22 + %24 = OpLabel + %27 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %28 = OpLoad %uint %27 + %30 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %31 = OpLoad %uint %30 + %32 = OpIAdd %uint %31 %28 + %35 = OpSLessThan %bool %32 %uint_1024 + OpSelectionMerge %60 None + OpBranchConditional %35 %38 %60 + %38 = OpLabel + %39 = OpPhi %uint %53 %38 %32 %24 + %40 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %41 = OpLoad %uint %40 + %43 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %39 + OpStore %43 %41 + %45 = OpIAdd %uint %39 %uint_10 + %46 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %45 + OpStore %46 %41 + %47 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %48 = OpLoad %uint %47 + %50 = OpIAdd %uint %39 %uint_20 + %51 = OpAccessChain %_ptr_StorageBuffer_uint %20 %uint_0 %50 + OpStore %51 %48 + %53 = OpIAdd %uint %39 %uint_256 + %55 = OpSGreaterThanEqual %bool %39 %uint_768 + OpLoopMerge %58 %38 None + OpBranchConditional %55 %58 %38 + %58 = OpLabel + OpBranch %60 + %60 = OpLabel + OpReturn + OpFunctionEnd + %78 = OpExtInst %void %61 PushConstantRegionOffset %uint_0 %uint_12 + %65 = OpExtInst %void %61 Kernel %23 %62 %uint_3 %uint_0 %63 + %67 = OpExtInst %void %61 ArgumentInfo %66 + %68 = OpExtInst %void %61 ArgumentStorageBuffer %65 %uint_0 %uint_0 %uint_0 %67 + %70 = OpExtInst %void %61 ArgumentInfo %69 + %72 = OpExtInst %void %61 ArgumentStorageBuffer %65 %uint_1 %uint_0 %uint_1 %70 + %74 = OpExtInst %void %61 ArgumentInfo %73 + %76 = OpExtInst %void %61 ArgumentStorageBuffer %65 %uint_2 %uint_0 %uint_2 %74 + %79 = OpExtInst %void %61 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/test_mod_invariants/local_direct.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/test_mod_invariants/local_direct.spv.dis new file mode 100644 index 0000000000..8beeec2907 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/test_mod_invariants/local_direct.spv.dis @@ -0,0 +1,84 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 64 +; Schema: 0 + OpCapability Shader + %50 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_LocalInvocationID %10 %14 %18 + OpSource OpenCL_C 200 + %51 = OpString "foo" + %52 = OpString " __kernel" + %55 = OpString "A" + %59 = OpString "B" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %15 SpecId 4 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %15 = OpSpecConstant %uint 1 +%_arr_uint_15 = OpTypeArray %uint %15 +%_ptr_Workgroup__arr_uint_15 = OpTypePointer Workgroup %_arr_uint_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %uint_8 = OpConstant %uint 8 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_1023 = OpConstant %uint 1023 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %18 = OpVariable %_ptr_Workgroup__arr_uint_15 Workgroup + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %26 = OpLoad %uint %25 + OpBranch %28 + %28 = OpLabel + %29 = OpPhi %uint %uint_0 %22 %43 %28 + %30 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %31 = OpLoad %uint %30 + %33 = OpShiftLeftLogical %uint %29 %uint_8 + %34 = OpIAdd %uint %33 %26 + %36 = OpAccessChain %_ptr_Workgroup_uint %14 %34 + OpStore %36 %31 + %37 = OpIAdd %uint %33 %31 + %38 = OpAccessChain %_ptr_Workgroup_uint %14 %37 + %39 = OpLoad %uint %38 + %40 = OpIAdd %uint %31 %33 + %41 = OpAccessChain %_ptr_Workgroup_uint %18 %40 + OpStore %41 %39 + %43 = OpIAdd %uint %29 %uint_1 + %46 = OpUGreaterThanEqual %bool %29 %uint_1023 + OpLoopMerge %49 %28 None + OpBranchConditional %46 %49 %28 + %49 = OpLabel + OpReturn + OpFunctionEnd + %54 = OpExtInst %void %50 Kernel %21 %51 %uint_3 %uint_0 %52 + %56 = OpExtInst %void %50 ArgumentInfo %55 + %58 = OpExtInst %void %50 ArgumentWorkgroup %54 %uint_0 %uint_3 %uint_4 %56 + %60 = OpExtInst %void %50 ArgumentInfo %59 + %61 = OpExtInst %void %50 ArgumentWorkgroup %54 %uint_1 %uint_4 %uint_4 %60 + %63 = OpExtInst %void %50 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/test_mod_invariants/local_reduce_strength.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/test_mod_invariants/local_reduce_strength.spv.dis new file mode 100644 index 0000000000..b11896503a --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/test_mod_invariants/local_reduce_strength.spv.dis @@ -0,0 +1,99 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 77 +; Schema: 0 + OpCapability Shader + %58 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %25 "foo" %8 %gl_LocalInvocationID %14 %18 %22 + OpSource OpenCL_C 200 + %59 = OpString "foo" + %60 = OpString " __kernel" + %63 = OpString "A" + %67 = OpString "B" + %71 = OpString "C" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %11 SpecId 3 + OpDecorate %15 SpecId 4 + OpDecorate %19 SpecId 5 + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %15 = OpSpecConstant %uint 1 +%_arr_uint_15 = OpTypeArray %uint %15 +%_ptr_Workgroup__arr_uint_15 = OpTypePointer Workgroup %_arr_uint_15 + %19 = OpSpecConstant %uint 1 +%_arr_uint_19 = OpTypeArray %uint %19 +%_ptr_Workgroup__arr_uint_19 = OpTypePointer Workgroup %_arr_uint_19 + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool + %uint_1024 = OpConstant %uint 1024 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_10 = OpConstant %uint 10 + %uint_20 = OpConstant %uint 20 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_5 = OpConstant %uint 5 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %18 = OpVariable %_ptr_Workgroup__arr_uint_15 Workgroup + %22 = OpVariable %_ptr_Workgroup__arr_uint_19 Workgroup + %25 = OpFunction %void None %24 + %26 = OpLabel + %29 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %30 = OpLoad %uint %29 + %33 = OpSLessThan %bool %30 %uint_1024 + OpSelectionMerge %57 None + OpBranchConditional %33 %36 %57 + %36 = OpLabel + %37 = OpPhi %uint %42 %36 %30 %26 + %38 = OpPhi %uint %51 %36 %30 %26 + %40 = OpAccessChain %_ptr_Workgroup_uint %14 %38 + OpStore %40 %37 + %41 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %42 = OpLoad %uint %41 + %44 = OpIAdd %uint %38 %uint_10 + %45 = OpAccessChain %_ptr_Workgroup_uint %18 %44 + OpStore %45 %42 + %47 = OpIAdd %uint %38 %uint_20 + %48 = OpAccessChain %_ptr_Workgroup_uint %22 %47 + OpStore %48 %42 + %49 = OpBitwiseAnd %v3uint %gl_WorkGroupSize %gl_WorkGroupSize + %50 = OpCompositeExtract %uint %49 0 + %51 = OpIAdd %uint %50 %38 + %52 = OpSGreaterThanEqual %bool %51 %uint_1024 + OpLoopMerge %55 %36 None + OpBranchConditional %52 %55 %36 + %55 = OpLabel + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd + %62 = OpExtInst %void %58 Kernel %25 %59 %uint_3 %uint_0 %60 + %64 = OpExtInst %void %58 ArgumentInfo %63 + %66 = OpExtInst %void %58 ArgumentWorkgroup %62 %uint_0 %uint_3 %uint_4 %64 + %68 = OpExtInst %void %58 ArgumentInfo %67 + %70 = OpExtInst %void %58 ArgumentWorkgroup %62 %uint_1 %uint_4 %uint_4 %68 + %72 = OpExtInst %void %58 ArgumentInfo %71 + %75 = OpExtInst %void %58 ArgumentWorkgroup %62 %uint_2 %uint_5 %uint_4 %72 + %76 = OpExtInst %void %58 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/test_part_load_store/store_int_and_short.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/test_part_load_store/store_int_and_short.spv.dis new file mode 100644 index 0000000000..d06e6ce7ad --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/test_part_load_store/store_int_and_short.spv.dis @@ -0,0 +1,84 @@ +; @Input: %19 = {{{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 55 +; Schema: 0 + OpCapability Shader + OpCapability Int16 + %44 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "foo" %gl_GlobalInvocationID %13 %19 %5 + OpSource OpenCL_C 200 + %45 = OpString "foo" + %46 = OpString " __kernel" + %48 = OpString "q" + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_15 0 Offset 0 + OpMemberDecorate %_struct_15 1 Offset 4 + OpDecorate %_runtimearr__struct_15 ArrayStride 8 + OpMemberDecorate %_struct_17 0 Offset 0 + OpDecorate %_struct_17 Block + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 0 + OpDecorate %8 SpecId 0 + OpDecorate %9 SpecId 1 + OpDecorate %10 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %_struct_3 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_3 = OpTypePointer PushConstant %_struct_3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %8 = OpSpecConstant %uint 1 + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %8 %9 %10 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %ushort = OpTypeInt 16 0 + %_struct_15 = OpTypeStruct %uint %ushort +%_runtimearr__struct_15 = OpTypeRuntimeArray %_struct_15 + %_struct_17 = OpTypeStruct %_runtimearr__struct_15 +%_ptr_StorageBuffer__struct_17 = OpTypePointer StorageBuffer %_struct_17 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_42 = OpConstant %uint 42 +%_ptr_StorageBuffer_ushort = OpTypePointer StorageBuffer %ushort + %uint_1 = OpConstant %uint 1 + %ushort_43 = OpConstant %ushort 43 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %5 = OpVariable %_ptr_PushConstant__struct_3 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %13 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %19 = OpVariable %_ptr_StorageBuffer__struct_17 StorageBuffer + %22 = OpFunction %void None %21 + %23 = OpLabel + %26 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %27 = OpLoad %uint %26 + %29 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %30 = OpLoad %uint %29 + %31 = OpIAdd %uint %30 %27 + %33 = OpAccessChain %_ptr_StorageBuffer_uint %19 %uint_0 %31 %uint_0 + OpStore %33 %uint_42 + %35 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %36 = OpLoad %uint %35 + %37 = OpAccessChain %_ptr_PushConstant_uint %5 %uint_0 %uint_0 + %38 = OpLoad %uint %37 + %39 = OpIAdd %uint %38 %36 + %42 = OpAccessChain %_ptr_StorageBuffer_ushort %19 %uint_0 %39 %uint_1 + OpStore %42 %ushort_43 + OpReturn + OpFunctionEnd + %52 = OpExtInst %void %44 PushConstantRegionOffset %uint_0 %uint_12 + %47 = OpExtInst %void %44 Kernel %22 %45 %uint_1 %uint_0 %46 + %49 = OpExtInst %void %44 ArgumentInfo %48 + %50 = OpExtInst %void %44 ArgumentStorageBuffer %47 %uint_0 %uint_0 %uint_0 %49 + %54 = OpExtInst %void %44 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/test_structs/store_array_element.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/test_structs/store_array_element.spv.dis new file mode 100644 index 0000000000..3424fce807 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/test_structs/store_array_element.spv.dis @@ -0,0 +1,58 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_GlobalInvocationID %10 %14 + OpSource OpenCL_C 200 + %20 = OpString "foo" + %21 = OpString " __kernel" + %25 = OpString "q" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_11 1 Offset 4 + OpMemberDecorate %_struct_11 2 Offset 8 + OpMemberDecorate %_struct_11 3 Offset 12 + OpMemberDecorate %_struct_11 4 Offset 16 + OpMemberDecorate %_struct_12 0 Offset 0 + OpMemberDecorate %_struct_12 1 Offset 16 + OpDecorate %_struct_12 Block + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint %uint %uint %uint %uint + %_struct_12 = OpTypeStruct %v3uint %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_16 = OpConstant %uint 16 + %uint_20 = OpConstant %uint 20 + %uint_12 = OpConstant %uint 12 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %17 = OpFunction %void Pure %16 + %18 = OpLabel + OpReturn + OpFunctionEnd + %32 = OpExtInst %void %19 PushConstantRegionOffset %uint_0 %uint_12 + %24 = OpExtInst %void %19 Kernel %17 %20 %uint_2 %uint_0 %21 + %26 = OpExtInst %void %19 ArgumentInfo %25 + %30 = OpExtInst %void %19 ArgumentPodPushConstant %24 %uint_1 %uint_16 %uint_20 %26 + %33 = OpExtInst %void %19 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/test_structs/store_element.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/test_structs/store_element.spv.dis new file mode 100644 index 0000000000..e265cadd9a --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/test_structs/store_element.spv.dis @@ -0,0 +1,55 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_GlobalInvocationID %10 %14 + OpSource OpenCL_C 200 + %20 = OpString "foo" + %21 = OpString " __kernel" + %25 = OpString "q" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_11 1 Offset 4 + OpMemberDecorate %_struct_12 0 Offset 0 + OpMemberDecorate %_struct_12 1 Offset 16 + OpDecorate %_struct_12 Block + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint %uint + %_struct_12 = OpTypeStruct %v3uint %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_16 = OpConstant %uint 16 + %uint_8 = OpConstant %uint 8 + %uint_12 = OpConstant %uint 12 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %17 = OpFunction %void Pure %16 + %18 = OpLabel + OpReturn + OpFunctionEnd + %32 = OpExtInst %void %19 PushConstantRegionOffset %uint_0 %uint_12 + %24 = OpExtInst %void %19 Kernel %17 %20 %uint_2 %uint_0 %21 + %26 = OpExtInst %void %19 ArgumentInfo %25 + %30 = OpExtInst %void %19 ArgumentPodPushConstant %24 %uint_1 %uint_16 %uint_8 %26 + %33 = OpExtInst %void %19 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/test_structs/store_struct_element.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/test_structs/store_struct_element.spv.dis new file mode 100644 index 0000000000..246300bbf1 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/test_structs/store_struct_element.spv.dis @@ -0,0 +1,54 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "foo" %gl_GlobalInvocationID %10 %14 + OpSource OpenCL_C 200 + %20 = OpString "foo" + %21 = OpString " __kernel" + %25 = OpString "q" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_12 0 Offset 0 + OpMemberDecorate %_struct_12 1 Offset 16 + OpDecorate %_struct_12 Block + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint + %_struct_12 = OpTypeStruct %v3uint %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_16 = OpConstant %uint 16 + %uint_4 = OpConstant %uint 4 + %uint_12 = OpConstant %uint 12 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %17 = OpFunction %void Pure %16 + %18 = OpLabel + OpReturn + OpFunctionEnd + %32 = OpExtInst %void %19 PushConstantRegionOffset %uint_0 %uint_12 + %24 = OpExtInst %void %19 Kernel %17 %20 %uint_2 %uint_0 %21 + %26 = OpExtInst %void %19 ArgumentInfo %25 + %30 = OpExtInst %void %19 ArgumentPodPushConstant %24 %uint_1 %uint_16 %uint_4 %26 + %33 = OpExtInst %void %19 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/test_structs/use_array_element.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/test_structs/use_array_element.spv.dis new file mode 100644 index 0000000000..ef0d59e022 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/test_structs/use_array_element.spv.dis @@ -0,0 +1,85 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + %37 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %10 %18 %14 + OpSource OpenCL_C 200 + %38 = OpString "foo" + %39 = OpString " __kernel" + %42 = OpString "p" + %45 = OpString "q" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_11 1 Offset 4 + OpMemberDecorate %_struct_11 2 Offset 8 + OpMemberDecorate %_struct_11 3 Offset 12 + OpMemberDecorate %_struct_11 4 Offset 16 + OpMemberDecorate %_struct_11 5 Offset 20 + OpMemberDecorate %_struct_12 0 Offset 0 + OpMemberDecorate %_struct_12 1 Offset 16 + OpDecorate %_struct_12 Block + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint %uint %uint %uint %uint %uint + %_struct_12 = OpTypeStruct %v3uint %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_2 = OpConstant %uint 2 + %uint_16 = OpConstant %uint 16 + %uint_24 = OpConstant %uint 24 + %uint_12 = OpConstant %uint 12 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %26 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_1 %uint_3 + %27 = OpLoad %uint %26 + %30 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %31 = OpLoad %uint %30 + %32 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %33 = OpLoad %uint %32 + %34 = OpIAdd %uint %31 %33 + %36 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %34 + OpStore %36 %27 + OpReturn + OpFunctionEnd + %51 = OpExtInst %void %37 PushConstantRegionOffset %uint_0 %uint_12 + %41 = OpExtInst %void %37 Kernel %21 %38 %uint_2 %uint_0 %39 + %43 = OpExtInst %void %37 ArgumentInfo %42 + %44 = OpExtInst %void %37 ArgumentStorageBuffer %41 %uint_0 %uint_0 %uint_0 %43 + %46 = OpExtInst %void %37 ArgumentInfo %45 + %49 = OpExtInst %void %37 ArgumentPodPushConstant %41 %uint_1 %uint_16 %uint_24 %46 + %52 = OpExtInst %void %37 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/test_structs/use_element.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/test_structs/use_element.spv.dis new file mode 100644 index 0000000000..db7f3d68a8 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/test_structs/use_element.spv.dis @@ -0,0 +1,80 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + %36 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %10 %18 %14 + OpSource OpenCL_C 200 + %37 = OpString "foo" + %38 = OpString " __kernel" + %41 = OpString "p" + %44 = OpString "q" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_11 1 Offset 4 + OpMemberDecorate %_struct_12 0 Offset 0 + OpMemberDecorate %_struct_12 1 Offset 16 + OpDecorate %_struct_12 Block + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint %uint + %_struct_12 = OpTypeStruct %v3uint %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_2 = OpConstant %uint 2 + %uint_16 = OpConstant %uint 16 + %uint_8 = OpConstant %uint 8 + %uint_12 = OpConstant %uint 12 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_1 %uint_1 + %26 = OpLoad %uint %25 + %29 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %30 = OpLoad %uint %29 + %31 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %32 = OpLoad %uint %31 + %33 = OpIAdd %uint %30 %32 + %35 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %33 + OpStore %35 %26 + OpReturn + OpFunctionEnd + %50 = OpExtInst %void %36 PushConstantRegionOffset %uint_0 %uint_12 + %40 = OpExtInst %void %36 Kernel %21 %37 %uint_2 %uint_0 %38 + %42 = OpExtInst %void %36 ArgumentInfo %41 + %43 = OpExtInst %void %36 ArgumentStorageBuffer %40 %uint_0 %uint_0 %uint_0 %42 + %45 = OpExtInst %void %36 ArgumentInfo %44 + %48 = OpExtInst %void %36 ArgumentPodPushConstant %40 %uint_1 %uint_16 %uint_8 %45 + %51 = OpExtInst %void %36 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/test_structs/use_struct_element.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/test_structs/use_struct_element.spv.dis new file mode 100644 index 0000000000..db7f3d68a8 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/test_structs/use_struct_element.spv.dis @@ -0,0 +1,80 @@ +; @Input: %18 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + %36 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "foo" %gl_GlobalInvocationID %10 %18 %14 + OpSource OpenCL_C 200 + %37 = OpString "foo" + %38 = OpString " __kernel" + %41 = OpString "p" + %44 = OpString "q" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %_struct_11 0 Offset 0 + OpMemberDecorate %_struct_11 1 Offset 4 + OpMemberDecorate %_struct_12 0 Offset 0 + OpMemberDecorate %_struct_12 1 Offset 16 + OpDecorate %_struct_12 Block + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_16 0 Offset 0 + OpDecorate %_struct_16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 0 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %_struct_11 = OpTypeStruct %uint %uint + %_struct_12 = OpTypeStruct %v3uint %_struct_11 +%_ptr_PushConstant__struct_12 = OpTypePointer PushConstant %_struct_12 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_16 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_16 = OpTypePointer StorageBuffer %_struct_16 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_1 = OpConstant %uint 1 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_2 = OpConstant %uint 2 + %uint_16 = OpConstant %uint 16 + %uint_8 = OpConstant %uint 8 + %uint_12 = OpConstant %uint 12 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_PushConstant__struct_12 PushConstant + %18 = OpVariable %_ptr_StorageBuffer__struct_16 StorageBuffer + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_1 %uint_1 + %26 = OpLoad %uint %25 + %29 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %30 = OpLoad %uint %29 + %31 = OpAccessChain %_ptr_PushConstant_uint %14 %uint_0 %uint_0 + %32 = OpLoad %uint %31 + %33 = OpIAdd %uint %30 %32 + %35 = OpAccessChain %_ptr_StorageBuffer_uint %18 %uint_0 %33 + OpStore %35 %26 + OpReturn + OpFunctionEnd + %50 = OpExtInst %void %36 PushConstantRegionOffset %uint_0 %uint_12 + %40 = OpExtInst %void %36 Kernel %21 %37 %uint_2 %uint_0 %38 + %42 = OpExtInst %void %36 ArgumentInfo %41 + %43 = OpExtInst %void %36 ArgumentStorageBuffer %40 %uint_0 %uint_0 %uint_0 %42 + %45 = OpExtInst %void %36 ArgumentInfo %44 + %48 = OpExtInst %void %36 ArgumentPodPushConstant %40 %uint_1 %uint_16 %uint_8 %45 + %51 = OpExtInst %void %36 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/transitiveclosuresimplified.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/transitiveclosuresimplified.spv.dis new file mode 100644 index 0000000000..cd3fddfaba --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/transitiveclosuresimplified.spv.dis @@ -0,0 +1,139 @@ +; @Input: %14 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 111 +; Schema: 0 + OpCapability Shader + %99 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "transitive_closure_stage1_kernel" %gl_LocalInvocationID %10 %14 %18 + OpSource OpenCL_C 200 + %100 = OpString "transitive_closure_stage1_kernel" + %101 = OpString " __kernel" + %103 = OpString "graph" + %106 = OpString "primary_block_buffer" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_12 0 Offset 0 + OpDecorate %_struct_12 Block + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 0 + OpDecorate %15 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_12 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_12 = OpTypePointer StorageBuffer %_struct_12 + %15 = OpSpecConstant %uint 1 +%_arr_uint_15 = OpTypeArray %uint %15 +%_ptr_Workgroup__arr_uint_15 = OpTypePointer Workgroup %_arr_uint_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_6 = OpConstant %uint 6 + %uint_2048 = OpConstant %uint 2048 + %uint_32 = OpConstant %uint 32 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_3 = OpConstant %uint 3 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %bool = OpTypeBool + %uint_34 = OpConstant %uint 34 + %uint_7 = OpConstant %uint 7 + %uint_4 = OpConstant %uint 4 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_StorageBuffer__struct_12 StorageBuffer + %18 = OpVariable %_ptr_Workgroup__arr_uint_15 Workgroup + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %29 = OpLoad %uint %28 + %31 = OpShiftLeftLogical %uint %26 %uint_6 + %33 = OpIAdd %uint %31 %uint_2048 + %34 = OpIAdd %uint %33 %29 + %36 = OpIAdd %uint %34 %uint_32 + %38 = OpAccessChain %_ptr_StorageBuffer_uint %14 %uint_0 %36 + %39 = OpLoad %uint %38 + %41 = OpShiftLeftLogical %uint %26 %uint_3 + %42 = OpIAdd %uint %41 %29 + %44 = OpAccessChain %_ptr_Workgroup_uint %18 %42 + OpStore %44 %39 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %48 + %48 = OpLabel + %49 = OpPhi %uint %uint_0 %22 %86 %85 + %50 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %51 = OpLoad %uint %50 + %52 = OpShiftLeftLogical %uint %51 %uint_3 + %53 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %54 = OpLoad %uint %53 + %55 = OpIAdd %uint %52 %54 + %56 = OpAccessChain %_ptr_Workgroup_uint %18 %55 + %57 = OpLoad %uint %56 + %59 = OpIEqual %bool %57 %uint_0 + OpLoopMerge %90 %85 None + OpBranchConditional %59 %62 %85 + %62 = OpLabel + %63 = OpBitwiseOr %uint %52 %49 + %64 = OpAccessChain %_ptr_Workgroup_uint %18 %63 + %65 = OpLoad %uint %64 + %66 = OpINotEqual %bool %65 %uint_0 + OpSelectionMerge %83 None + OpBranchConditional %66 %69 %83 + %69 = OpLabel + %70 = OpShiftLeftLogical %uint %49 %uint_3 + %71 = OpIAdd %uint %70 %54 + %72 = OpAccessChain %_ptr_Workgroup_uint %18 %71 + %73 = OpLoad %uint %72 + %74 = OpINotEqual %bool %73 %uint_0 + OpSelectionMerge %81 None + OpBranchConditional %74 %77 %81 + %77 = OpLabel + %79 = OpIAdd %uint %49 %uint_34 + OpStore %56 %79 + OpBranch %81 + %81 = OpLabel + OpBranch %83 + %83 = OpLabel + OpBranch %85 + %85 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %86 = OpIAdd %uint %49 %uint_1 + %88 = OpUGreaterThanEqual %bool %49 %uint_7 + OpBranchConditional %88 %90 %48 + %90 = OpLabel + %91 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %92 = OpLoad %uint %91 + %93 = OpShiftLeftLogical %uint %92 %uint_3 + %94 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %95 = OpLoad %uint %94 + %96 = OpIAdd %uint %93 %95 + %97 = OpAccessChain %_ptr_Workgroup_uint %18 %96 + %98 = OpLoad %uint %97 + OpStore %38 %98 + OpReturn + OpFunctionEnd + %102 = OpExtInst %void %99 Kernel %21 %100 %uint_2 %uint_0 %101 + %104 = OpExtInst %void %99 ArgumentInfo %103 + %105 = OpExtInst %void %99 ArgumentStorageBuffer %102 %uint_0 %uint_0 %uint_0 %104 + %107 = OpExtInst %void %99 ArgumentInfo %106 + %109 = OpExtInst %void %99 ArgumentWorkgroup %102 %uint_1 %uint_3 %uint_4 %107 + %110 = OpExtInst %void %99 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/unusedreturn.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/unusedreturn.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/unusedreturn.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/vectortests/addressofvector.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/vectortests/addressofvector.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/vectortests/addressofvector.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/vectortests/double2simpleaccess.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/vectortests/double2simpleaccess.spv.dis new file mode 100644 index 0000000000..db3e4fa339 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/vectortests/double2simpleaccess.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "k" %8 + OpSource OpenCL_C 200 + %14 = OpString "k" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/vectortests/double4simpleaccess.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/vectortests/double4simpleaccess.spv.dis new file mode 100644 index 0000000000..db3e4fa339 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/vectortests/double4simpleaccess.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "k" %8 + OpSource OpenCL_C 200 + %14 = OpString "k" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/vectortests/float2simpleaccess.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/vectortests/float2simpleaccess.spv.dis new file mode 100644 index 0000000000..db3e4fa339 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/vectortests/float2simpleaccess.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "k" %8 + OpSource OpenCL_C 200 + %14 = OpString "k" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/vectortests/float4arrayaccess.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/vectortests/float4arrayaccess.spv.dis new file mode 100644 index 0000000000..4deb5acdec --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/vectortests/float4arrayaccess.spv.dis @@ -0,0 +1,87 @@ +; @Input: %24 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 60 +; Schema: 0 + OpCapability Shader + %48 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %27 "foo" %7 %gl_GlobalInvocationID %gl_LocalInvocationID %20 %24 %11 + OpSource OpenCL_C 200 + %49 = OpString "foo" + %50 = OpString " __kernel" + %53 = OpString "p" + OpMemberDecorate %_struct_9 0 Offset 0 + OpDecorate %_struct_9 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_22 0 Offset 0 + OpDecorate %_struct_22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 0 + OpDecorate %15 SpecId 0 + OpDecorate %16 SpecId 1 + OpDecorate %17 SpecId 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_2048 = OpConstant %uint 2048 +%_arr_v4float_uint_2048 = OpTypeArray %v4float %uint_2048 +%_ptr_Workgroup__arr_v4float_uint_2048 = OpTypePointer Workgroup %_arr_v4float_uint_2048 + %v3uint = OpTypeVector %uint 3 + %_struct_9 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_9 = OpTypePointer PushConstant %_struct_9 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %15 = OpSpecConstant %uint 1 + %16 = OpSpecConstant %uint 1 + %17 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %15 %16 %17 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_22 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_22 = OpTypePointer StorageBuffer %_struct_22 + %void = OpTypeVoid + %26 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float +%_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %7 = OpVariable %_ptr_Workgroup__arr_v4float_uint_2048 Workgroup + %11 = OpVariable %_ptr_PushConstant__struct_9 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %20 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %24 = OpVariable %_ptr_StorageBuffer__struct_22 StorageBuffer + %27 = OpFunction %void None %26 + %28 = OpLabel + %30 = OpVariable %_ptr_Function_float Function + %33 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %34 = OpLoad %uint %33 + %36 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_0 %uint_0 + %37 = OpLoad %uint %36 + %38 = OpIAdd %uint %34 %37 + %40 = OpAccessChain %_ptr_StorageBuffer_float %24 %uint_0 %38 + %41 = OpLoad %float %40 + %42 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %43 = OpLoad %uint %42 + %45 = OpAccessChain %_ptr_Workgroup_v4float %7 %43 + %46 = OpLoad %v4float %45 + %47 = OpCompositeInsert %v4float %41 %46 0 + OpStore %45 %47 + OpStore %30 %41 + OpReturn + OpFunctionEnd + %57 = OpExtInst %void %48 PushConstantRegionOffset %uint_0 %uint_12 + %52 = OpExtInst %void %48 Kernel %27 %49 %uint_1 %uint_0 %50 + %54 = OpExtInst %void %48 ArgumentInfo %53 + %55 = OpExtInst %void %48 ArgumentStorageBuffer %52 %uint_0 %uint_0 %uint_0 %54 + %59 = OpExtInst %void %48 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/vectortests/float4simpleaccess.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/vectortests/float4simpleaccess.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/vectortests/float4simpleaccess.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/vectortests/int3arrayaccess.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/vectortests/int3arrayaccess.spv.dis new file mode 100644 index 0000000000..4d48c7e5c9 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/vectortests/int3arrayaccess.spv.dis @@ -0,0 +1,86 @@ +; @Input: %23 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %47 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %26 "foo" %6 %gl_GlobalInvocationID %gl_LocalInvocationID %19 %23 %10 + OpSource OpenCL_C 200 + %48 = OpString "foo" + %49 = OpString " __kernel" + %52 = OpString "p" + OpMemberDecorate %_struct_8 0 Offset 0 + OpDecorate %_struct_8 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_21 0 Offset 0 + OpDecorate %_struct_21 Block + OpDecorate %23 DescriptorSet 0 + OpDecorate %23 Binding 0 + OpDecorate %14 SpecId 0 + OpDecorate %15 SpecId 1 + OpDecorate %16 SpecId 2 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_2048 = OpConstant %uint 2048 +%_arr_v4uint_uint_2048 = OpTypeArray %v4uint %uint_2048 +%_ptr_Workgroup__arr_v4uint_uint_2048 = OpTypePointer Workgroup %_arr_v4uint_uint_2048 + %v3uint = OpTypeVector %uint 3 + %_struct_8 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_8 = OpTypePointer PushConstant %_struct_8 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %14 = OpSpecConstant %uint 1 + %15 = OpSpecConstant %uint 1 + %16 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %14 %15 %16 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_21 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer__struct_21 = OpTypePointer StorageBuffer %_struct_21 + %void = OpTypeVoid + %25 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%_ptr_Workgroup_v4uint = OpTypePointer Workgroup %v4uint + %uint_1 = OpConstant %uint 1 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %6 = OpVariable %_ptr_Workgroup__arr_v4uint_uint_2048 Workgroup + %10 = OpVariable %_ptr_PushConstant__struct_8 PushConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %19 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %23 = OpVariable %_ptr_StorageBuffer__struct_21 StorageBuffer + %26 = OpFunction %void None %25 + %27 = OpLabel + %29 = OpVariable %_ptr_Function_uint Function + %32 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %33 = OpLoad %uint %32 + %35 = OpAccessChain %_ptr_PushConstant_uint %10 %uint_0 %uint_0 + %36 = OpLoad %uint %35 + %37 = OpIAdd %uint %33 %36 + %39 = OpAccessChain %_ptr_StorageBuffer_uint %23 %uint_0 %37 + %40 = OpLoad %uint %39 + %41 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %42 = OpLoad %uint %41 + %44 = OpAccessChain %_ptr_Workgroup_v4uint %6 %42 + %45 = OpLoad %v4uint %44 + %46 = OpCompositeInsert %v4uint %40 %45 0 + OpStore %44 %46 + OpStore %29 %40 + OpReturn + OpFunctionEnd + %56 = OpExtInst %void %47 PushConstantRegionOffset %uint_0 %uint_12 + %51 = OpExtInst %void %47 Kernel %26 %48 %uint_1 %uint_0 %49 + %53 = OpExtInst %void %47 ArgumentInfo %52 + %54 = OpExtInst %void %47 ArgumentStorageBuffer %51 %uint_0 %uint_0 %uint_0 %53 + %58 = OpExtInst %void %47 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/vectortests/test_paren.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/vectortests/test_paren.spv.dis new file mode 100644 index 0000000000..755927cd92 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/vectortests/test_paren.spv.dis @@ -0,0 +1,65 @@ +; @Input: %16 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + %32 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %19 "foo" %gl_LocalInvocationID %10 %16 + OpSource OpenCL_C 200 + %33 = OpString "foo" + %34 = OpString " __kernel" + %37 = OpString "acc" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %_struct_14 0 Offset 0 + OpDecorate %_struct_14 Block + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %_struct_14 = OpTypeStruct %_runtimearr_v4float +%_ptr_StorageBuffer__struct_14 = OpTypePointer StorageBuffer %_struct_14 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %31 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %16 = OpVariable %_ptr_StorageBuffer__struct_14 StorageBuffer + %19 = OpFunction %void None %18 + %20 = OpLabel + %23 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %24 = OpLoad %uint %23 + %26 = OpAccessChain %_ptr_StorageBuffer_v4float %16 %uint_0 %24 + OpStore %26 %31 + OpReturn + OpFunctionEnd + %36 = OpExtInst %void %32 Kernel %19 %33 %uint_1 %uint_0 %34 + %38 = OpExtInst %void %32 ArgumentInfo %37 + %39 = OpExtInst %void %32 ArgumentStorageBuffer %36 %uint_0 %uint_0 %uint_0 %38 + %41 = OpExtInst %void %32 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/vectortests/vectorsplat.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/vectortests/vectorsplat.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/vectortests/vectorsplat.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/vectortests/vectorswizzle.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/vectortests/vectorswizzle.spv.dis new file mode 100644 index 0000000000..4d83e11cb6 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/vectortests/vectorswizzle.spv.dis @@ -0,0 +1,36 @@ +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %11 "foo" %8 + OpSource OpenCL_C 200 + %14 = OpString "foo" + %15 = OpString " __kernel" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %2 SpecId 0 + OpDecorate %3 SpecId 1 + OpDecorate %4 SpecId 2 + %uint = OpTypeInt 32 0 + %2 = OpSpecConstant %uint 1 + %3 = OpSpecConstant %uint 1 + %4 = OpSpecConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %2 %3 %4 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %8 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %11 = OpFunction %void Pure|Const %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + %17 = OpExtInst %void %13 Kernel %11 %14 %uint_0 %uint_0 %15 + %20 = OpExtInst %void %13 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/warpsync/2d.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/warpsync/2d.spv.dis new file mode 100644 index 0000000000..a07970ce07 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/warpsync/2d.spv.dis @@ -0,0 +1,101 @@ +; @Input: %24 = {{0, 0, 0, 0, 0, 0, 0, 0, 0}} +; @Config: 3, 1, 3 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 73 +; Schema: 0 + OpCapability Shader + %63 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %27 "matrix_transpose" %7 %gl_LocalInvocationID %gl_WorkGroupID %20 %24 %11 + OpSource OpenCL_C 200 + %64 = OpString "matrix_transpose" + %65 = OpString " __kernel" + %67 = OpString "A" + OpMemberDecorate %_struct_9 0 Offset 0 + OpDecorate %_struct_9 Block + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_22 0 Offset 0 + OpDecorate %_struct_22 Block + OpDecorate %24 DescriptorSet 0 + OpDecorate %24 Binding 0 + OpDecorate %15 SpecId 0 + OpDecorate %16 SpecId 1 + OpDecorate %17 SpecId 2 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_arr__arr_float_uint_4_uint_4 = OpTypeArray %_arr_float_uint_4 %uint_4 +%_ptr_Workgroup__arr__arr_float_uint_4_uint_4 = OpTypePointer Workgroup %_arr__arr_float_uint_4_uint_4 + %v3uint = OpTypeVector %uint 3 + %_struct_9 = OpTypeStruct %v3uint +%_ptr_PushConstant__struct_9 = OpTypePointer PushConstant %_struct_9 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %15 = OpSpecConstant %uint 1 + %16 = OpSpecConstant %uint 1 + %17 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %15 %16 %17 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_22 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_22 = OpTypePointer StorageBuffer %_struct_22 + %void = OpTypeVoid + %26 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_Workgroup_float = OpTypePointer Workgroup %float + %uint_2 = OpConstant %uint 2 + %uint_72 = OpConstant %uint 72 + %uint_40 = OpConstant %uint 40 +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %uint_12 = OpConstant %uint 12 + %7 = OpVariable %_ptr_Workgroup__arr__arr_float_uint_4_uint_4 Workgroup + %11 = OpVariable %_ptr_PushConstant__struct_9 PushConstant +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %20 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %24 = OpVariable %_ptr_StorageBuffer__struct_22 StorageBuffer + %27 = OpFunction %void None %26 + %28 = OpLabel + %31 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %32 = OpLoad %uint %31 + %34 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %35 = OpLoad %uint %34 + %36 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %37 = OpLoad %uint %36 + %39 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_0 %uint_0 + %40 = OpLoad %uint %39 + %41 = OpIAdd %uint %40 %37 + %42 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_1 + %43 = OpLoad %uint %42 + %44 = OpAccessChain %_ptr_PushConstant_uint %11 %uint_0 %uint_1 + %45 = OpLoad %uint %44 + %46 = OpIAdd %uint %45 %43 + %48 = OpAccessChain %_ptr_Workgroup_float %7 %35 %32 + %49 = OpLoad %float %48 + %50 = OpAccessChain %_ptr_Workgroup_float %7 %32 %35 + OpStore %50 %49 + OpControlBarrier %uint_2 %uint_2 %uint_72 + %53 = OpLoad %float %50 + %54 = OpShiftLeftLogical %uint %46 %uint_2 + %55 = OpIAdd %uint %54 %32 + %57 = OpIMul %uint %55 %uint_40 + %58 = OpShiftLeftLogical %uint %41 %uint_2 + %59 = OpIAdd %uint %57 %35 + %60 = OpIAdd %uint %59 %58 + %62 = OpAccessChain %_ptr_StorageBuffer_float %24 %uint_0 %60 + OpStore %62 %53 + OpReturn + OpFunctionEnd + %71 = OpExtInst %void %63 PushConstantRegionGroupOffset %uint_0 %uint_12 + %66 = OpExtInst %void %63 Kernel %27 %64 %uint_1 %uint_0 %65 + %68 = OpExtInst %void %63 ArgumentInfo %67 + %69 = OpExtInst %void %63 ArgumentStorageBuffer %66 %uint_0 %uint_0 %uint_0 %68 + %72 = OpExtInst %void %63 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/warpsync/broken_shuffle.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/warpsync/broken_shuffle.spv.dis new file mode 100644 index 0000000000..b3392f0804 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/warpsync/broken_shuffle.spv.dis @@ -0,0 +1,73 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 55 +; Schema: 0 + OpCapability Shader + %29 = OpExtInstImport "GLSL.std.450" + %44 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "shuffle" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %45 = OpString "shuffle" + %46 = OpString " __kernel" + %48 = OpString "A" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %uint_32 = OpConstant %uint 32 + %uint_5 = OpConstant %uint 5 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool +%uint_4294967295 = OpConstant %uint 4294967295 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %22 = OpLoad %uint %21 + %24 = OpSDiv %uint %22 %uint_32 + %26 = OpShiftLeftLogical %uint %24 %uint_5 + %28 = OpIAdd %uint %22 %uint_1 + %30 = OpExtInst %uint %29 SAbs %28 + %31 = OpExtInst %uint %29 SAbs %uint_32 + %32 = OpUMod %uint %30 %31 + %34 = OpSGreaterThan %bool %28 %uint_0 + %36 = OpBitwiseXor %uint %32 %uint_4294967295 + %37 = OpIAdd %uint %36 %uint_1 + %38 = OpSelect %uint %34 %32 %37 + %39 = OpIAdd %uint %26 %38 + %41 = OpAccessChain %_ptr_Workgroup_uint %14 %39 + %42 = OpLoad %uint %41 + %43 = OpAccessChain %_ptr_Workgroup_uint %14 %22 + OpStore %43 %42 + OpReturn + OpFunctionEnd + %47 = OpExtInst %void %44 Kernel %17 %45 %uint_1 %uint_0 %46 + %49 = OpExtInst %void %44 ArgumentInfo %48 + %52 = OpExtInst %void %44 ArgumentWorkgroup %47 %uint_0 %uint_3 %uint_4 %49 + %54 = OpExtInst %void %44 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/warpsync/intragroup_scan.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/warpsync/intragroup_scan.spv.dis new file mode 100644 index 0000000000..d072dbc964 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/warpsync/intragroup_scan.spv.dis @@ -0,0 +1,213 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 181 +; Schema: 0 + OpCapability Shader + %172 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %21 "scan" %5 %gl_LocalInvocationID %14 %18 + OpSource OpenCL_C 200 + %173 = OpString "scan" + %174 = OpString " __kernel" + %176 = OpString "A" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %15 SpecId 3 + OpDecorate %9 SpecId 0 + OpDecorate %10 SpecId 1 + OpDecorate %11 SpecId 2 + %uint = OpTypeInt 32 0 + %uint_32 = OpConstant %uint 32 +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%_ptr_Workgroup__arr_uint_uint_32 = OpTypePointer Workgroup %_arr_uint_uint_32 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %9 = OpSpecConstant %uint 1 + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %9 %10 %11 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %15 = OpSpecConstant %uint 1 +%_arr_uint_15 = OpTypeArray %uint %15 +%_ptr_Workgroup__arr_uint_15 = OpTypePointer Workgroup %_arr_uint_15 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %uint_31 = OpConstant %uint 31 + %bool = OpTypeBool +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%uint_4294967295 = OpConstant %uint 4294967295 + %uint_1 = OpConstant %uint 1 +%uint_4294967294 = OpConstant %uint 4294967294 + %uint_3 = OpConstant %uint 3 +%uint_4294967292 = OpConstant %uint 4294967292 + %uint_7 = OpConstant %uint 7 +%uint_4294967288 = OpConstant %uint 4294967288 + %uint_15 = OpConstant %uint 15 +%uint_4294967280 = OpConstant %uint 4294967280 + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %uint_5 = OpConstant %uint 5 + %uint_4 = OpConstant %uint 4 + %5 = OpVariable %_ptr_Workgroup__arr_uint_uint_32 Workgroup +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %18 = OpVariable %_ptr_Workgroup__arr_uint_15 Workgroup + %21 = OpFunction %void None %20 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %28 = OpBitwiseAnd %uint %26 %uint_31 + %30 = OpINotEqual %bool %28 %uint_0 + OpSelectionMerge %91 None + OpBranchConditional %30 %33 %91 + %33 = OpLabel + %35 = OpAccessChain %_ptr_Workgroup_uint %18 %26 + %37 = OpIAdd %uint %26 %uint_4294967295 + %38 = OpAccessChain %_ptr_Workgroup_uint %18 %37 + %39 = OpLoad %uint %38 + %40 = OpLoad %uint %35 + %41 = OpIAdd %uint %40 %39 + OpStore %35 %41 + %43 = OpINotEqual %bool %28 %uint_1 + OpSelectionMerge %89 None + OpBranchConditional %43 %46 %89 + %46 = OpLabel + %48 = OpIAdd %uint %26 %uint_4294967294 + %49 = OpAccessChain %_ptr_Workgroup_uint %18 %48 + %50 = OpLoad %uint %49 + %51 = OpIAdd %uint %41 %50 + OpStore %35 %51 + %53 = OpUGreaterThan %bool %28 %uint_3 + OpSelectionMerge %87 None + OpBranchConditional %53 %56 %87 + %56 = OpLabel + %58 = OpIAdd %uint %26 %uint_4294967292 + %59 = OpAccessChain %_ptr_Workgroup_uint %18 %58 + %60 = OpLoad %uint %59 + %61 = OpIAdd %uint %51 %60 + OpStore %35 %61 + %63 = OpUGreaterThan %bool %28 %uint_7 + OpSelectionMerge %85 None + OpBranchConditional %63 %66 %85 + %66 = OpLabel + %68 = OpIAdd %uint %26 %uint_4294967288 + %69 = OpAccessChain %_ptr_Workgroup_uint %18 %68 + %70 = OpLoad %uint %69 + %71 = OpIAdd %uint %61 %70 + OpStore %35 %71 + %73 = OpUGreaterThan %bool %28 %uint_15 + OpSelectionMerge %83 None + OpBranchConditional %73 %76 %83 + %76 = OpLabel + %78 = OpIAdd %uint %26 %uint_4294967280 + %79 = OpAccessChain %_ptr_Workgroup_uint %18 %78 + %80 = OpLoad %uint %79 + %81 = OpIAdd %uint %71 %80 + OpStore %35 %81 + OpBranch %83 + %83 = OpLabel + OpBranch %85 + %85 = OpLabel + OpBranch %87 + %87 = OpLabel + OpBranch %89 + %89 = OpLabel + OpBranch %91 + %91 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %94 = OpIEqual %bool %28 %uint_31 + OpSelectionMerge %104 None + OpBranchConditional %94 %97 %104 + %97 = OpLabel + %98 = OpAccessChain %_ptr_Workgroup_uint %18 %26 + %99 = OpLoad %uint %98 + %101 = OpShiftRightLogical %uint %26 %uint_5 + %102 = OpAccessChain %_ptr_Workgroup_uint %5 %101 + OpStore %102 %99 + OpBranch %104 + %104 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %105 = OpULessThan %bool %26 %uint_32 + OpSelectionMerge %165 None + OpBranchConditional %105 %108 %165 + %108 = OpLabel + %109 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %110 = OpLoad %uint %109 + %111 = OpBitwiseAnd %uint %110 %uint_31 + %112 = OpINotEqual %bool %111 %uint_0 + OpSelectionMerge %163 None + OpBranchConditional %112 %115 %163 + %115 = OpLabel + %116 = OpIAdd %uint %110 %uint_4294967295 + %117 = OpAccessChain %_ptr_Workgroup_uint %5 %116 + %118 = OpLoad %uint %117 + %119 = OpAccessChain %_ptr_Workgroup_uint %5 %110 + %120 = OpLoad %uint %119 + %121 = OpIAdd %uint %120 %118 + OpStore %119 %121 + %122 = OpINotEqual %bool %111 %uint_1 + OpSelectionMerge %161 None + OpBranchConditional %122 %125 %161 + %125 = OpLabel + %126 = OpIAdd %uint %110 %uint_4294967294 + %127 = OpAccessChain %_ptr_Workgroup_uint %5 %126 + %128 = OpLoad %uint %127 + %129 = OpIAdd %uint %121 %128 + OpStore %119 %129 + %130 = OpUGreaterThan %bool %111 %uint_3 + OpSelectionMerge %159 None + OpBranchConditional %130 %133 %159 + %133 = OpLabel + %134 = OpIAdd %uint %110 %uint_4294967292 + %135 = OpAccessChain %_ptr_Workgroup_uint %5 %134 + %136 = OpLoad %uint %135 + %137 = OpIAdd %uint %129 %136 + OpStore %119 %137 + %138 = OpUGreaterThan %bool %111 %uint_7 + OpSelectionMerge %157 None + OpBranchConditional %138 %141 %157 + %141 = OpLabel + %142 = OpIAdd %uint %110 %uint_4294967288 + %143 = OpAccessChain %_ptr_Workgroup_uint %5 %142 + %144 = OpLoad %uint %143 + %145 = OpIAdd %uint %137 %144 + OpStore %119 %145 + %146 = OpUGreaterThan %bool %111 %uint_15 + OpSelectionMerge %155 None + OpBranchConditional %146 %149 %155 + %149 = OpLabel + %150 = OpIAdd %uint %110 %uint_4294967280 + %151 = OpAccessChain %_ptr_Workgroup_uint %5 %150 + %152 = OpLoad %uint %151 + %153 = OpIAdd %uint %145 %152 + OpStore %119 %153 + OpBranch %155 + %155 = OpLabel + OpBranch %157 + %157 = OpLabel + OpBranch %159 + %159 = OpLabel + OpBranch %161 + %161 = OpLabel + OpBranch %163 + %163 = OpLabel + OpBranch %165 + %165 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %166 = OpShiftRightLogical %uint %26 %uint_5 + %167 = OpAccessChain %_ptr_Workgroup_uint %5 %166 + %168 = OpLoad %uint %167 + %169 = OpAccessChain %_ptr_Workgroup_uint %18 %26 + %170 = OpLoad %uint %169 + %171 = OpIAdd %uint %170 %168 + OpStore %169 %171 + OpReturn + OpFunctionEnd + %175 = OpExtInst %void %172 Kernel %21 %173 %uint_1 %uint_0 %174 + %177 = OpExtInst %void %172 ArgumentInfo %176 + %179 = OpExtInst %void %172 ArgumentWorkgroup %175 %uint_0 %uint_3 %uint_4 %177 + %180 = OpExtInst %void %172 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/warpsync/scan_warp.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/warpsync/scan_warp.spv.dis new file mode 100644 index 0000000000..f9f0d05d26 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/warpsync/scan_warp.spv.dis @@ -0,0 +1,120 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 98 +; Schema: 0 + OpCapability Shader + %88 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "scan" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %89 = OpString "scan" + %90 = OpString " __kernel" + %92 = OpString "A" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %uint_31 = OpConstant %uint 31 + %bool = OpTypeBool +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%uint_4294967295 = OpConstant %uint 4294967295 + %uint_1 = OpConstant %uint 1 +%uint_4294967294 = OpConstant %uint 4294967294 + %uint_3 = OpConstant %uint 3 +%uint_4294967292 = OpConstant %uint 4294967292 + %uint_7 = OpConstant %uint 7 +%uint_4294967288 = OpConstant %uint 4294967288 + %uint_15 = OpConstant %uint 15 +%uint_4294967280 = OpConstant %uint 4294967280 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %22 = OpLoad %uint %21 + %24 = OpBitwiseAnd %uint %22 %uint_31 + %26 = OpINotEqual %bool %24 %uint_0 + OpSelectionMerge %87 None + OpBranchConditional %26 %29 %87 + %29 = OpLabel + %31 = OpAccessChain %_ptr_Workgroup_uint %14 %22 + %33 = OpIAdd %uint %22 %uint_4294967295 + %34 = OpAccessChain %_ptr_Workgroup_uint %14 %33 + %35 = OpLoad %uint %34 + %36 = OpLoad %uint %31 + %37 = OpIAdd %uint %36 %35 + OpStore %31 %37 + %39 = OpINotEqual %bool %24 %uint_1 + OpSelectionMerge %85 None + OpBranchConditional %39 %42 %85 + %42 = OpLabel + %44 = OpIAdd %uint %22 %uint_4294967294 + %45 = OpAccessChain %_ptr_Workgroup_uint %14 %44 + %46 = OpLoad %uint %45 + %47 = OpIAdd %uint %37 %46 + OpStore %31 %47 + %49 = OpUGreaterThan %bool %24 %uint_3 + OpSelectionMerge %83 None + OpBranchConditional %49 %52 %83 + %52 = OpLabel + %54 = OpIAdd %uint %22 %uint_4294967292 + %55 = OpAccessChain %_ptr_Workgroup_uint %14 %54 + %56 = OpLoad %uint %55 + %57 = OpIAdd %uint %47 %56 + OpStore %31 %57 + %59 = OpUGreaterThan %bool %24 %uint_7 + OpSelectionMerge %81 None + OpBranchConditional %59 %62 %81 + %62 = OpLabel + %64 = OpIAdd %uint %22 %uint_4294967288 + %65 = OpAccessChain %_ptr_Workgroup_uint %14 %64 + %66 = OpLoad %uint %65 + %67 = OpIAdd %uint %57 %66 + OpStore %31 %67 + %69 = OpUGreaterThan %bool %24 %uint_15 + OpSelectionMerge %79 None + OpBranchConditional %69 %72 %79 + %72 = OpLabel + %74 = OpIAdd %uint %22 %uint_4294967280 + %75 = OpAccessChain %_ptr_Workgroup_uint %14 %74 + %76 = OpLoad %uint %75 + %77 = OpIAdd %uint %67 %76 + OpStore %31 %77 + OpBranch %79 + %79 = OpLabel + OpBranch %81 + %81 = OpLabel + OpBranch %83 + %83 = OpLabel + OpBranch %85 + %85 = OpLabel + OpBranch %87 + %87 = OpLabel + OpReturn + OpFunctionEnd + %91 = OpExtInst %void %88 Kernel %17 %89 %uint_1 %uint_0 %90 + %93 = OpExtInst %void %88 ArgumentInfo %92 + %95 = OpExtInst %void %88 ArgumentWorkgroup %91 %uint_0 %uint_3 %uint_4 %93 + %97 = OpExtInst %void %88 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/dartagnan/src/test/resources/spirv/gpuverify/warpsync/shuffle.spv.dis b/dartagnan/src/test/resources/spirv/gpuverify/warpsync/shuffle.spv.dis new file mode 100644 index 0000000000..b3392f0804 --- /dev/null +++ b/dartagnan/src/test/resources/spirv/gpuverify/warpsync/shuffle.spv.dis @@ -0,0 +1,73 @@ +; @Config: 3, 1, 1 +; SPIR-V +; Version: 1.6 +; Generator: Google Clspv; 0 +; Bound: 55 +; Schema: 0 + OpCapability Shader + %29 = OpExtInstImport "GLSL.std.450" + %44 = OpExtInstImport "NonSemantic.ClspvReflection.5" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %17 "shuffle" %gl_LocalInvocationID %10 %14 + OpSource OpenCL_C 200 + %45 = OpString "shuffle" + %46 = OpString " __kernel" + %48 = OpString "A" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %11 SpecId 3 + OpDecorate %5 SpecId 0 + OpDecorate %6 SpecId 1 + OpDecorate %7 SpecId 2 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %5 = OpSpecConstant %uint 1 + %6 = OpSpecConstant %uint 1 + %7 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %5 %6 %7 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %11 = OpSpecConstant %uint 1 +%_arr_uint_11 = OpTypeArray %uint %11 +%_ptr_Workgroup__arr_uint_11 = OpTypePointer Workgroup %_arr_uint_11 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %uint_32 = OpConstant %uint 32 + %uint_5 = OpConstant %uint 5 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool +%uint_4294967295 = OpConstant %uint 4294967295 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %10 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %14 = OpVariable %_ptr_Workgroup__arr_uint_11 Workgroup + %17 = OpFunction %void None %16 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %22 = OpLoad %uint %21 + %24 = OpSDiv %uint %22 %uint_32 + %26 = OpShiftLeftLogical %uint %24 %uint_5 + %28 = OpIAdd %uint %22 %uint_1 + %30 = OpExtInst %uint %29 SAbs %28 + %31 = OpExtInst %uint %29 SAbs %uint_32 + %32 = OpUMod %uint %30 %31 + %34 = OpSGreaterThan %bool %28 %uint_0 + %36 = OpBitwiseXor %uint %32 %uint_4294967295 + %37 = OpIAdd %uint %36 %uint_1 + %38 = OpSelect %uint %34 %32 %37 + %39 = OpIAdd %uint %26 %38 + %41 = OpAccessChain %_ptr_Workgroup_uint %14 %39 + %42 = OpLoad %uint %41 + %43 = OpAccessChain %_ptr_Workgroup_uint %14 %22 + OpStore %43 %42 + OpReturn + OpFunctionEnd + %47 = OpExtInst %void %44 Kernel %17 %45 %uint_1 %uint_0 %46 + %49 = OpExtInst %void %44 ArgumentInfo %48 + %52 = OpExtInst %void %44 ArgumentWorkgroup %47 %uint_0 %uint_3 %uint_4 %49 + %54 = OpExtInst %void %44 SpecConstantWorkgroupSize %uint_0 %uint_1 %uint_2 diff --git a/litmus/VULKAN/Manual/IRIW.litmus b/litmus/VULKAN/Manual/IRIW.litmus new file mode 100644 index 0000000000..10f51c138c --- /dev/null +++ b/litmus/VULKAN/Manual/IRIW.litmus @@ -0,0 +1,12 @@ +Vulkan IRIW +{ +P2:r0 = 0; P2:r1 = 0; +P3:r2 = 0; P3:r3 = 0; +x=0; +y=0; +} + P0@sg 0, wg 0, qf 0 | P1@sg 0,wg 0, qf 0 | P2@sg 0,wg 0, qf 0 | P3@sg 0,wg 0, qf 0 ; + st.atom.rel.wg.sc0.semsc0 x, 1 | st.atom.rel.wg.sc0.semsc0 y, 1 | ld.atom.acq.wg.sc0.semsc0 r0, x | ld.atom.acq.wg.sc0.semsc0 r2, y ; + | | ld.atom.acq.wg.sc0.semsc0 r1, y | ld.atom.acq.wg.sc0.semsc0 r3, x ; +exists +(P2:r0 == 1 /\ P2:r1 == 0 /\ P3:r2 == 1 /\ P3:r3 == 0) \ No newline at end of file diff --git a/litmus/VULKAN/Manual/XF-Barrier-relacq.litmus b/litmus/VULKAN/Manual/XF-Barrier-relacq.litmus deleted file mode 100644 index 78edfefc03..0000000000 --- a/litmus/VULKAN/Manual/XF-Barrier-relacq.litmus +++ /dev/null @@ -1,22 +0,0 @@ -Vulkan XF-Barrier-relacq -"Adapted from Figure 2 in -Portable Inter-workgroup Barrier Synchronisation for GPUs -https://dl.acm.org/doi/pdf/10.1145/2983990.2984032" -{ -x=0; -f=0; -P0:r0=0; -P1:r0=0; -} - P0@sg 0, wg 0, qf 0 | P1@sg 0, wg 1, qf 0 | P2@sg 0, wg 1, qf 0 ; - st.av.dv.sc0 x, 1 | cbar.wg 1 | cbar.wg 1 ; - LC00: | st.atom.dv.sc0 f, 1 | cbar.wg 2 ; - ld.atom.dv.sc0 r2, f | LC10: | ; - bne r2, 0, LC01 | ld.atom.acq.dv.sc0.semsc0 r2, f | ; - goto LC00 | bne r2, 1, LC11 | ; - LC01: | goto LC10 | ; - cbar.wg 1 | LC11: | ; - st.atom.rel.dv.sc0.semsc0 f, 0 | cbar.wg 2 | ; - | ld.vis.dv.sc0 r1, x | ; -exists -(P1:r2 != 1 /\ P1:r1 == 0) \ No newline at end of file diff --git a/litmus/VULKAN/Manual/XF-Barrier-rlx.litmus b/litmus/VULKAN/Manual/XF-Barrier-rlx.litmus deleted file mode 100644 index 5114532174..0000000000 --- a/litmus/VULKAN/Manual/XF-Barrier-rlx.litmus +++ /dev/null @@ -1,22 +0,0 @@ -Vulkan XF-Barrier-rlx -"Adapted from Figure 2 in -Portable Inter-workgroup Barrier Synchronisation for GPUs -https://dl.acm.org/doi/pdf/10.1145/2983990.2984032" -{ -x=0; -f=0; -P0:r0=0; -P1:r0=0; -} - P0@sg 0, wg 0, qf 0 | P1@sg 0, wg 1, qf 0 | P2@sg 0, wg 1, qf 0 ; - st.av.dv.sc0 x, 1 | cbar.wg 1 | cbar.wg 1 ; - LC00: | st.atom.dv.sc0 f, 1 | cbar.wg 2 ; - ld.atom.dv.sc0 r2, f | LC10: | ; - bne r2, 0, LC01 | ld.atom.dv.sc0 r2, f | ; - goto LC00 | bne r2, 1, LC11 | ; - LC01: | goto LC10 | ; - cbar.wg 1 | LC11: | ; - st.atom.dv.sc0 f, 0 | cbar.wg 2 | ; - | ld.vis.dv.sc0 r1, x | ; -exists -(P1:r2 != 1 /\ P1:r1 == 0) \ No newline at end of file diff --git a/litmus/VULKAN/Manual/XF-Barrier-weak.litmus b/litmus/VULKAN/Manual/XF-Barrier-weak.litmus deleted file mode 100644 index b068555907..0000000000 --- a/litmus/VULKAN/Manual/XF-Barrier-weak.litmus +++ /dev/null @@ -1,22 +0,0 @@ -Vulkan XF-Barrier-weak -"Adapted from Figure 2 in -Portable Inter-workgroup Barrier Synchronisation for GPUs -https://dl.acm.org/doi/pdf/10.1145/2983990.2984032" -{ -x=0; -f=0; -P0:r0=0; -P1:r0=0; -} - P0@sg 0, wg 0, qf 0 | P1@sg 0, wg 1, qf 0 | P2@sg 0, wg 1, qf 0 ; - st.av.dv.sc0 x, 1 | cbar.wg 1 | cbar.wg 1 ; - LC00: | st.sc0 f, 1 | cbar.wg 2 ; - ld.sc0 r2, f | LC10: | ; - bne r2, 0, LC01 | ld.sc0 r2, f | ; - goto LC00 | bne r2, 1, LC11 | ; - LC01: | goto LC10 | ; - cbar.wg 1 | LC11: | ; - st.sc0 f, 0 | cbar.wg 2 | ; - | ld.vis.dv.sc0 r1, x | ; -exists -(P1:r2 != 1 /\ P1:r1 == 0) \ No newline at end of file diff --git a/litmus/VULKAN/Manual/asmo-weak.litmus b/litmus/VULKAN/Manual/asmo-plain.litmus similarity index 82% rename from litmus/VULKAN/Manual/asmo-weak.litmus rename to litmus/VULKAN/Manual/asmo-plain.litmus index b5d0510e43..2858c0a045 100644 --- a/litmus/VULKAN/Manual/asmo-weak.litmus +++ b/litmus/VULKAN/Manual/asmo-plain.litmus @@ -1,4 +1,4 @@ -VULKAN asmo-weak +VULKAN asmo-plain "Test if P2 and P3 can read updates to x in conflicting order" { P2:r0=0; @@ -8,7 +8,7 @@ P3:r3=0; x=0; } P0@sg 0,wg 0, qf 0 | P1@sg 0,wg 1, qf 0 | P2@sg 0,wg 2, qf 0 | P3@sg 0,wg 3, qf 0 ; - st.sc0 x, 1 | st.sc0 x, 2 | ld.atom.dv.sc0 r0, x | ld.atom.dv.sc0 r2, x ; + st.av.dv.sc0 x, 1 | st.av.dv.sc0 x, 2 | ld.atom.dv.sc0 r0, x | ld.atom.dv.sc0 r2, x ; | | ld.atom.dv.sc0 r1, x | ld.atom.dv.sc0 r3, x ; ~exists (P2:r0 == 1 /\ P2:r1 == 2 /\ P3:r2 == 2 /\ P3:r3 == 1) \ No newline at end of file diff --git a/litmus/VULKAN/Manual/cbar-1.litmus b/litmus/VULKAN/Manual/cbar-1.litmus new file mode 100644 index 0000000000..61c6e49218 --- /dev/null +++ b/litmus/VULKAN/Manual/cbar-1.litmus @@ -0,0 +1,18 @@ +Vulkan cbar-1 +{ +x=1; +P0:r0=0; +P0:r1=0; +P1:r0=0; +P1:r1=0; +} + P0@sg 0, wg 0, qf 0 | P1@sg 1, wg 0, qf 0 ; + LC00: | LC10: ; + ld.sc0 r0, x | ld.sc0 r0, x ; + bne r0, 0, LC01 | bne r0, 0, LC11 ; + goto LC00 | goto LC10 ; + LC01: | LC11: ; + cbar.wg 1 | cbar.wg 1 ; + ld.sc0 r1, x | ld.sc0 r1, x ; +forall +(P0:r0 == 1 /\ P0:r1 == 1 /\ P1:r0 == 1 /\ P1:r1 == 1) \ No newline at end of file diff --git a/litmus/VULKAN/Manual/cbar-2.litmus b/litmus/VULKAN/Manual/cbar-2.litmus new file mode 100644 index 0000000000..b9e7c5c0e2 --- /dev/null +++ b/litmus/VULKAN/Manual/cbar-2.litmus @@ -0,0 +1,18 @@ +Vulkan cbar-2 +{ +x=1; +P0:r0=0; +P0:r1=0; +P1:r0=0; +P1:r1=0; +} + P0@sg 0, wg 0, qf 0 | P1@sg 1, wg 0, qf 0 ; + LC00: | LC10: ; + ld.sc0 r0, x | ld.sc0 r0, x ; + bne r0, 0, LC01 | bne r0, 1, LC11 ; + goto LC00 | goto LC10 ; + LC01: | LC11: ; + cbar.wg 1 | cbar.wg 1 ; + ld.sc0 r1, x | ld.sc0 r1, x ; +forall +(P0:r0 == 1 /\ P0:r1 == 0 /\ P1:r0 == 1 /\ P1:r1 == 0) \ No newline at end of file diff --git a/litmus/VULKAN/Manual/cbar-3.litmus b/litmus/VULKAN/Manual/cbar-3.litmus new file mode 100644 index 0000000000..33c63f9d5e --- /dev/null +++ b/litmus/VULKAN/Manual/cbar-3.litmus @@ -0,0 +1,17 @@ +Vulkan cbar-3 +{ +x=1; +P0:r0=0; +P0:r1=0; +P1:r0=0; +P1:r1=0; +} + P0@sg 0, wg 0, qf 0 | P1@sg 1, wg 0, qf 0 ; + LC00: | LC10: ; + ld.sc0 r0, x | ld.sc0 r0, x ; + bne r0, 0, LC01 | bne r0, 0, LC11 ; + goto LC00 | goto LC10 ; + LC01: | LC11: ; + ld.sc0 r1, x | ld.sc0 r1, x ; +forall +(P0:r0 == 1 /\ P0:r1 == 1 /\ P1:r0 == 1 /\ P1:r1 == 1) \ No newline at end of file diff --git a/litmus/VULKAN/Manual/cbar-4.litmus b/litmus/VULKAN/Manual/cbar-4.litmus new file mode 100644 index 0000000000..8b6c6db22e --- /dev/null +++ b/litmus/VULKAN/Manual/cbar-4.litmus @@ -0,0 +1,17 @@ +Vulkan cbar-4 +{ +x=1; +P0:r0=0; +P0:r1=0; +P1:r0=0; +P1:r1=0; +} + P0@sg 0, wg 0, qf 0 | P1@sg 1, wg 0, qf 0 ; + LC00: | LC10: ; + ld.sc0 r0, x | ld.sc0 r0, x ; + bne r0, 0, LC01 | bne r0, 1, LC11 ; + goto LC00 | goto LC10 ; + LC01: | LC11: ; + ld.sc0 r1, x | ld.sc0 r1, x ; +forall +(P0:r0 == 1 /\ P0:r1 == 1 /\ P1:r0 == 1 /\ P1:r1 == 0) \ No newline at end of file diff --git a/litmus/VULKAN/Manual/counter-atomic-store-rmw.litmus b/litmus/VULKAN/Manual/counter-atomic-store-rmw.litmus new file mode 100644 index 0000000000..886ca7c493 --- /dev/null +++ b/litmus/VULKAN/Manual/counter-atomic-store-rmw.litmus @@ -0,0 +1,13 @@ +Vulkan counter-atomic-store-rmw +"Adapted from https://github.com/mc-imperial/gpuverify/blob/master/testsuite/OpenCL/atomics/counter/kernel.cl" +{ +P0:r0 = 0; +P1:r0 = 0; +x=0; +} + P0@sg 0, wg 0, qf 0 | P1@sg 1, wg 0, qf 0 ; + st.atom.dv.sc0 x, 1 | cbar.acq_rel.dv.semsc0 0 ; + cbar.acq_rel.dv.semsc0 0 | rmw.atom.acq_rel.dv.sc0.semsc0.add r0, x, 1 ; + rmw.atom.acq_rel.dv.sc0.semsc0.add r0, x, 1 | ; +~exists +(P0:r0 == 1 /\ P1:r0 == 1) \ No newline at end of file diff --git a/litmus/VULKAN/Manual/counter-plain-store-atomic-load.litmus b/litmus/VULKAN/Manual/counter-plain-store-atomic-load.litmus new file mode 100644 index 0000000000..8c4936bd67 --- /dev/null +++ b/litmus/VULKAN/Manual/counter-plain-store-atomic-load.litmus @@ -0,0 +1,13 @@ +Vulkan counter-plain-store-atomic-load +"Adapted from https://github.com/mc-imperial/gpuverify/blob/master/testsuite/OpenCL/atomics/counter/kernel.cl" +{ +P0:r0 = 0; +P1:r0 = 0; +x=0; +} + P0@sg 0, wg 0, qf 0 | P1@sg 1, wg 0, qf 0 ; + st.av.dv.sc0 x, 1 | cbar.acq_rel.dv.semsc0 0 ; + cbar.acq_rel.dv.semsc0 0 | ld.atom.dv.sc0 r0, x ; + ld.atom.dv.sc0 r0, x | ; +forall +(P0:r0 == 1 /\ P1:r0 == 1) \ No newline at end of file diff --git a/litmus/VULKAN/Manual/counter-plain-store-plain-load.litmus b/litmus/VULKAN/Manual/counter-plain-store-plain-load.litmus new file mode 100644 index 0000000000..37226ff6d5 --- /dev/null +++ b/litmus/VULKAN/Manual/counter-plain-store-plain-load.litmus @@ -0,0 +1,13 @@ +Vulkan counter-plain-store-plain-load +"Adapted from https://github.com/mc-imperial/gpuverify/blob/master/testsuite/OpenCL/atomics/counter/kernel.cl" +{ +P0:r0 = 0; +P1:r0 = 0; +x=0; +} + P0@sg 0, wg 0, qf 0 | P1@sg 1, wg 0, qf 0 ; + st.av.dv.sc0 x, 1 | cbar.acq_rel.dv.semsc0 0 ; + cbar.acq_rel.dv.semsc0 0 | ld.vis.dv.sc0 r0, x ; + ld.vis.dv.sc0 r0, x | ; +forall +(P0:r0 == 1 /\ P1:r0 == 1) \ No newline at end of file diff --git a/litmus/VULKAN/Manual/counter-plain-store-rmw.litmus b/litmus/VULKAN/Manual/counter-plain-store-rmw.litmus new file mode 100644 index 0000000000..540c8bd23b --- /dev/null +++ b/litmus/VULKAN/Manual/counter-plain-store-rmw.litmus @@ -0,0 +1,13 @@ +Vulkan counter-plain-store-rmw +"Adapted from https://github.com/mc-imperial/gpuverify/blob/master/testsuite/OpenCL/atomics/counter/kernel.cl" +{ +P0:r0 = 0; +P1:r0 = 0; +x=0; +} + P0@sg 0, wg 0, qf 0 | P1@sg 1, wg 0, qf 0 ; + st.av.dv.sc0 x, 1 | cbar.acq_rel.dv.semsc0 0 ; + cbar.acq_rel.dv.semsc0 0 | rmw.atom.acq_rel.dv.sc0.semsc0.add r0, x, 1 ; + rmw.atom.acq_rel.dv.sc0.semsc0.add r0, x, 1 | ; +~exists +(P0:r0 == 1 /\ P1:r0 == 1) \ No newline at end of file diff --git a/litmus/VULKAN/Manual/xf-barrier-cbar-rlx-1.litmus b/litmus/VULKAN/Manual/xf-barrier-cbar-rlx-1.litmus new file mode 100644 index 0000000000..2a9d244f38 --- /dev/null +++ b/litmus/VULKAN/Manual/xf-barrier-cbar-rlx-1.litmus @@ -0,0 +1,32 @@ +Vulkan xf-barrier-cbar-rlx-1 +"Adapted from Figure 2 in +Portable Inter-workgroup Barrier Synchronisation for GPUs +https://dl.acm.org/doi/pdf/10.1145/2983990.2984032" +{ +x0=0; x1=0; x2=0; x3=0; x4=0; x5=0; +f1=0; f2=0; +} + P0@sg 0, wg 0, qf 0 | P1@sg 0, wg 0, qf 0 | P2@sg 0, wg 1, qf 0 | P3@sg 0, wg 1, qf 0 | P4@sg 0, wg 2, qf 0 | P5@sg 0, wg 2, qf 0 ; + st.av.dv.sc0 x0, 1 | st.av.dv.sc0 x1, 1 | st.av.dv.sc0 x2, 1 | st.av.dv.sc0 x3, 1 | st.av.dv.sc0 x4, 1 | st.av.dv.sc0 x5, 1 ; + LC00: | LC10: | cbar.acq_rel.wg.semsc0 10 | cbar.acq_rel.wg.semsc0 10 | cbar.acq_rel.wg.semsc0 20 | cbar.acq_rel.wg.semsc0 20 ; + ld.atom.acq.dv.sc0.semsc0 r9, f1 | ld.atom.acq.dv.sc0.semsc0 r9, f2 | st.atom.rel.dv.sc0.semsc0 f1, 1 | cbar.acq_rel.wg.semsc0 11 | st.atom.rel.dv.sc0.semsc0 f2, 1 | cbar.acq_rel.wg.semsc0 21 ; + bne r9, 0, LC01 | bne r9, 0, LC11 | LC20: | ld.vis.dv.sc0 r0, x0 | LC40: | ld.vis.dv.sc0 r0, x0 ; + goto LC00 | goto LC10 | ld.atom.acq.dv.sc0.semsc0 r9, f1 | ld.vis.dv.sc0 r1, x1 | ld.atom.acq.dv.sc0.semsc0 r9, f2 | ld.vis.dv.sc0 r1, x1 ; + LC01: | LC11: | bne r9, 1, LC21 | ld.vis.dv.sc0 r2, x2 | bne r9, 1, LC41 | ld.vis.dv.sc0 r2, x2 ; + cbar.wg.semsc0 00 | cbar.wg.semsc0 00 | goto LC20 | ld.vis.dv.sc0 r3, x3 | goto LC40 | ld.vis.dv.sc0 r3, x3 ; + st.atom.rel.dv.sc0.semsc0 f1, 0 | st.atom.rel.dv.sc0.semsc0 f2, 0 | LC21: | ld.vis.dv.sc0 r4, x4 | LC41: | ld.vis.dv.sc0 r4, x4 ; + ld.vis.dv.sc0 r0, x0 | ld.vis.dv.sc0 r0, x0 | cbar.acq_rel.wg.semsc0 11 | ld.vis.dv.sc0 r5, x5 | cbar.acq_rel.wg.semsc0 21 | ld.vis.dv.sc0 r5, x5 ; + ld.vis.dv.sc0 r1, x1 | ld.vis.dv.sc0 r1, x1 | ld.vis.dv.sc0 r0, x0 | | ld.vis.dv.sc0 r0, x0 | ; + ld.vis.dv.sc0 r2, x2 | ld.vis.dv.sc0 r2, x2 | ld.vis.dv.sc0 r1, x1 | | ld.vis.dv.sc0 r1, x1 | ; + ld.vis.dv.sc0 r3, x3 | ld.vis.dv.sc0 r3, x3 | ld.vis.dv.sc0 r2, x2 | | ld.vis.dv.sc0 r2, x2 | ; + ld.vis.dv.sc0 r4, x4 | ld.vis.dv.sc0 r4, x4 | ld.vis.dv.sc0 r3, x3 | | ld.vis.dv.sc0 r3, x3 | ; + ld.vis.dv.sc0 r5, x5 | ld.vis.dv.sc0 r5, x5 | ld.vis.dv.sc0 r4, x4 | | ld.vis.dv.sc0 r4, x4 | ; + | | ld.vis.dv.sc0 r5, x5 | | ld.vis.dv.sc0 r5, x5 | ; + +forall( +P0:r0 == 1 /\ P0:r1 == 1 /\ P0:r2 == 1 /\ P0:r3 == 1 /\ P0:r4 == 1 /\ P0:r5 == 1 /\ +P1:r0 == 1 /\ P1:r1 == 1 /\ P1:r2 == 1 /\ P1:r3 == 1 /\ P1:r4 == 1 /\ P1:r5 == 1 /\ +P2:r0 == 1 /\ P2:r1 == 1 /\ P2:r2 == 1 /\ P2:r3 == 1 /\ P2:r4 == 1 /\ P2:r5 == 1 /\ +P3:r0 == 1 /\ P3:r1 == 1 /\ P3:r2 == 1 /\ P3:r3 == 1 /\ P3:r4 == 1 /\ P3:r5 == 1 /\ +P4:r0 == 1 /\ P4:r1 == 1 /\ P4:r2 == 1 /\ P4:r3 == 1 /\ P4:r4 == 1 /\ P4:r5 == 1 /\ +P5:r0 == 1 /\ P5:r1 == 1 /\ P5:r2 == 1 /\ P5:r3 == 1 /\ P5:r4 == 1 /\ P5:r5 == 1) diff --git a/litmus/VULKAN/Manual/xf-barrier-cbar-rlx-2.litmus b/litmus/VULKAN/Manual/xf-barrier-cbar-rlx-2.litmus new file mode 100644 index 0000000000..b3a583687b --- /dev/null +++ b/litmus/VULKAN/Manual/xf-barrier-cbar-rlx-2.litmus @@ -0,0 +1,32 @@ +Vulkan xf-barrier-cbar-rlx-2 +"Adapted from Figure 2 in +Portable Inter-workgroup Barrier Synchronisation for GPUs +https://dl.acm.org/doi/pdf/10.1145/2983990.2984032" +{ +x0=0; x1=0; x2=0; x3=0; x4=0; x5=0; +f1=0; f2=0; +} + P0@sg 0, wg 0, qf 0 | P1@sg 0, wg 0, qf 0 | P2@sg 0, wg 1, qf 0 | P3@sg 0, wg 1, qf 0 | P4@sg 0, wg 2, qf 0 | P5@sg 0, wg 2, qf 0 ; + st.av.dv.sc0 x0, 1 | st.av.dv.sc0 x1, 1 | st.av.dv.sc0 x2, 1 | st.av.dv.sc0 x3, 1 | st.av.dv.sc0 x4, 1 | st.av.dv.sc0 x5, 1 ; + LC00: | LC10: | cbar.wg.semsc0 10 | cbar.wg.semsc0 10 | cbar.wg.semsc0 20 | cbar.wg.semsc0 20 ; + ld.atom.acq.dv.sc0.semsc0 r9, f1 | ld.atom.acq.dv.sc0.semsc0 r9, f2 | st.atom.rel.dv.sc0.semsc0 f1, 1 | cbar.acq_rel.wg.semsc0 11 | st.atom.rel.dv.sc0.semsc0 f2, 1 | cbar.acq_rel.wg.semsc0 21 ; + bne r9, 0, LC01 | bne r9, 0, LC11 | LC20: | ld.vis.dv.sc0 r0, x0 | LC40: | ld.vis.dv.sc0 r0, x0 ; + goto LC00 | goto LC10 | ld.atom.acq.dv.sc0.semsc0 r9, f1 | ld.vis.dv.sc0 r1, x1 | ld.atom.acq.dv.sc0.semsc0 r9, f2 | ld.vis.dv.sc0 r1, x1 ; + LC01: | LC11: | bne r9, 1, LC21 | ld.vis.dv.sc0 r2, x2 | bne r9, 1, LC41 | ld.vis.dv.sc0 r2, x2 ; + cbar.acq_rel.wg.semsc0 00 | cbar.acq_rel.wg.semsc0 00 | goto LC20 | ld.vis.dv.sc0 r3, x3 | goto LC40 | ld.vis.dv.sc0 r3, x3 ; + st.atom.rel.dv.sc0.semsc0 f1, 0 | st.atom.rel.dv.sc0.semsc0 f2, 0 | LC21: | ld.vis.dv.sc0 r4, x4 | LC41: | ld.vis.dv.sc0 r4, x4 ; + ld.vis.dv.sc0 r0, x0 | ld.vis.dv.sc0 r0, x0 | cbar.acq_rel.wg.semsc0 11 | ld.vis.dv.sc0 r5, x5 | cbar.acq_rel.wg.semsc0 21 | ld.vis.dv.sc0 r5, x5 ; + ld.vis.dv.sc0 r1, x1 | ld.vis.dv.sc0 r1, x1 | ld.vis.dv.sc0 r0, x0 | | ld.vis.dv.sc0 r0, x0 | ; + ld.vis.dv.sc0 r2, x2 | ld.vis.dv.sc0 r2, x2 | ld.vis.dv.sc0 r1, x1 | | ld.vis.dv.sc0 r1, x1 | ; + ld.vis.dv.sc0 r3, x3 | ld.vis.dv.sc0 r3, x3 | ld.vis.dv.sc0 r2, x2 | | ld.vis.dv.sc0 r2, x2 | ; + ld.vis.dv.sc0 r4, x4 | ld.vis.dv.sc0 r4, x4 | ld.vis.dv.sc0 r3, x3 | | ld.vis.dv.sc0 r3, x3 | ; + ld.vis.dv.sc0 r5, x5 | ld.vis.dv.sc0 r5, x5 | ld.vis.dv.sc0 r4, x4 | | ld.vis.dv.sc0 r4, x4 | ; + | | ld.vis.dv.sc0 r5, x5 | | ld.vis.dv.sc0 r5, x5 | ; + +forall( +P0:r0 == 1 /\ P0:r1 == 1 /\ P0:r2 == 1 /\ P0:r3 == 1 /\ P0:r4 == 1 /\ P0:r5 == 1 /\ +P1:r0 == 1 /\ P1:r1 == 1 /\ P1:r2 == 1 /\ P1:r3 == 1 /\ P1:r4 == 1 /\ P1:r5 == 1 /\ +P2:r0 == 1 /\ P2:r1 == 1 /\ P2:r2 == 1 /\ P2:r3 == 1 /\ P2:r4 == 1 /\ P2:r5 == 1 /\ +P3:r0 == 1 /\ P3:r1 == 1 /\ P3:r2 == 1 /\ P3:r3 == 1 /\ P3:r4 == 1 /\ P3:r5 == 1 /\ +P4:r0 == 1 /\ P4:r1 == 1 /\ P4:r2 == 1 /\ P4:r3 == 1 /\ P4:r4 == 1 /\ P4:r5 == 1 /\ +P5:r0 == 1 /\ P5:r1 == 1 /\ P5:r2 == 1 /\ P5:r3 == 1 /\ P5:r4 == 1 /\ P5:r5 == 1) diff --git a/litmus/VULKAN/Manual/xf-barrier-cbar-rlx-3.litmus b/litmus/VULKAN/Manual/xf-barrier-cbar-rlx-3.litmus new file mode 100644 index 0000000000..5ff25aef34 --- /dev/null +++ b/litmus/VULKAN/Manual/xf-barrier-cbar-rlx-3.litmus @@ -0,0 +1,32 @@ +Vulkan xf-barrier-cbar-rlx-3 +"Adapted from Figure 2 in +Portable Inter-workgroup Barrier Synchronisation for GPUs +https://dl.acm.org/doi/pdf/10.1145/2983990.2984032" +{ +x0=0; x1=0; x2=0; x3=0; x4=0; x5=0; +f1=0; f2=0; +} + P0@sg 0, wg 0, qf 0 | P1@sg 0, wg 0, qf 0 | P2@sg 0, wg 1, qf 0 | P3@sg 0, wg 1, qf 0 | P4@sg 0, wg 2, qf 0 | P5@sg 0, wg 2, qf 0 ; + st.av.dv.sc0 x0, 1 | st.av.dv.sc0 x1, 1 | st.av.dv.sc0 x2, 1 | st.av.dv.sc0 x3, 1 | st.av.dv.sc0 x4, 1 | st.av.dv.sc0 x5, 1 ; + LC00: | LC10: | cbar.acq_rel.wg.semsc0 10 | cbar.acq_rel.wg.semsc0 10 | cbar.acq_rel.wg.semsc0 20 | cbar.acq_rel.wg.semsc0 20 ; + ld.atom.acq.dv.sc0.semsc0 r9, f1 | ld.atom.acq.dv.sc0.semsc0 r9, f2 | st.atom.rel.dv.sc0.semsc0 f1, 1 | cbar.wg.semsc0 11 | st.atom.rel.dv.sc0.semsc0 f2, 1 | cbar.wg.semsc0 21 ; + bne r9, 0, LC01 | bne r9, 0, LC11 | LC20: | ld.vis.dv.sc0 r0, x0 | LC40: | ld.vis.dv.sc0 r0, x0 ; + goto LC00 | goto LC10 | ld.atom.acq.dv.sc0.semsc0 r9, f1 | ld.vis.dv.sc0 r1, x1 | ld.atom.acq.dv.sc0.semsc0 r9, f2 | ld.vis.dv.sc0 r1, x1 ; + LC01: | LC11: | bne r9, 1, LC21 | ld.vis.dv.sc0 r2, x2 | bne r9, 1, LC41 | ld.vis.dv.sc0 r2, x2 ; + cbar.acq_rel.wg.semsc0 00 | cbar.acq_rel.wg.semsc0 00 | goto LC20 | ld.vis.dv.sc0 r3, x3 | goto LC40 | ld.vis.dv.sc0 r3, x3 ; + st.atom.rel.dv.sc0.semsc0 f1, 0 | st.atom.rel.dv.sc0.semsc0 f2, 0 | LC21: | ld.vis.dv.sc0 r4, x4 | LC41: | ld.vis.dv.sc0 r4, x4 ; + ld.vis.dv.sc0 r0, x0 | ld.vis.dv.sc0 r0, x0 | cbar.wg.semsc0 11 | ld.vis.dv.sc0 r5, x5 | cbar.wg.semsc0 21 | ld.vis.dv.sc0 r5, x5 ; + ld.vis.dv.sc0 r1, x1 | ld.vis.dv.sc0 r1, x1 | ld.vis.dv.sc0 r0, x0 | | ld.vis.dv.sc0 r0, x0 | ; + ld.vis.dv.sc0 r2, x2 | ld.vis.dv.sc0 r2, x2 | ld.vis.dv.sc0 r1, x1 | | ld.vis.dv.sc0 r1, x1 | ; + ld.vis.dv.sc0 r3, x3 | ld.vis.dv.sc0 r3, x3 | ld.vis.dv.sc0 r2, x2 | | ld.vis.dv.sc0 r2, x2 | ; + ld.vis.dv.sc0 r4, x4 | ld.vis.dv.sc0 r4, x4 | ld.vis.dv.sc0 r3, x3 | | ld.vis.dv.sc0 r3, x3 | ; + ld.vis.dv.sc0 r5, x5 | ld.vis.dv.sc0 r5, x5 | ld.vis.dv.sc0 r4, x4 | | ld.vis.dv.sc0 r4, x4 | ; + | | ld.vis.dv.sc0 r5, x5 | | ld.vis.dv.sc0 r5, x5 | ; + +forall( +P0:r0 == 1 /\ P0:r1 == 1 /\ P0:r2 == 1 /\ P0:r3 == 1 /\ P0:r4 == 1 /\ P0:r5 == 1 /\ +P1:r0 == 1 /\ P1:r1 == 1 /\ P1:r2 == 1 /\ P1:r3 == 1 /\ P1:r4 == 1 /\ P1:r5 == 1 /\ +P2:r0 == 1 /\ P2:r1 == 1 /\ P2:r2 == 1 /\ P2:r3 == 1 /\ P2:r4 == 1 /\ P2:r5 == 1 /\ +P3:r0 == 1 /\ P3:r1 == 1 /\ P3:r2 == 1 /\ P3:r3 == 1 /\ P3:r4 == 1 /\ P3:r5 == 1 /\ +P4:r0 == 1 /\ P4:r1 == 1 /\ P4:r2 == 1 /\ P4:r3 == 1 /\ P4:r4 == 1 /\ P4:r5 == 1 /\ +P5:r0 == 1 /\ P5:r1 == 1 /\ P5:r2 == 1 /\ P5:r3 == 1 /\ P5:r4 == 1 /\ P5:r5 == 1) diff --git a/litmus/VULKAN/Manual/xf-barrier-load-rlx-1.litmus b/litmus/VULKAN/Manual/xf-barrier-load-rlx-1.litmus new file mode 100644 index 0000000000..9a5a00b887 --- /dev/null +++ b/litmus/VULKAN/Manual/xf-barrier-load-rlx-1.litmus @@ -0,0 +1,32 @@ +Vulkan xf-barrier-load-rlx-1 +"Adapted from Figure 2 in +Portable Inter-workgroup Barrier Synchronisation for GPUs +https://dl.acm.org/doi/pdf/10.1145/2983990.2984032" +{ +x0=0; x1=0; x2=0; x3=0; x4=0; x5=0; +f1=0; f2=0; +} + P0@sg 0, wg 0, qf 0 | P1@sg 0, wg 0, qf 0 | P2@sg 0, wg 1, qf 0 | P3@sg 0, wg 1, qf 0 | P4@sg 0, wg 2, qf 0 | P5@sg 0, wg 2, qf 0 ; + st.av.dv.sc0 x0, 1 | st.av.dv.sc0 x1, 1 | st.av.dv.sc0 x2, 1 | st.av.dv.sc0 x3, 1 | st.av.dv.sc0 x4, 1 | st.av.dv.sc0 x5, 1 ; + LC00: | LC10: | cbar.acq_rel.wg.semsc0 10 | cbar.acq_rel.wg.semsc0 10 | cbar.acq_rel.wg.semsc0 20 | cbar.acq_rel.wg.semsc0 20 ; + ld.atom.dv.sc0.semsc0 r9, f1 | ld.atom.dv.sc0.semsc0 r9, f2 | st.atom.rel.dv.sc0.semsc0 f1, 1 | cbar.acq_rel.wg.semsc0 11 | st.atom.rel.dv.sc0.semsc0 f2, 1 | cbar.acq_rel.wg.semsc0 21 ; + bne r9, 0, LC01 | bne r9, 0, LC11 | LC20: | ld.vis.dv.sc0 r0, x0 | LC40: | ld.vis.dv.sc0 r0, x0 ; + goto LC00 | goto LC10 | ld.atom.acq.dv.sc0.semsc0 r9, f1 | ld.vis.dv.sc0 r1, x1 | ld.atom.acq.dv.sc0.semsc0 r9, f2 | ld.vis.dv.sc0 r1, x1 ; + LC01: | LC11: | bne r9, 1, LC21 | ld.vis.dv.sc0 r2, x2 | bne r9, 1, LC41 | ld.vis.dv.sc0 r2, x2 ; + cbar.acq_rel.wg.semsc0 00 | cbar.acq_rel.wg.semsc0 00 | goto LC20 | ld.vis.dv.sc0 r3, x3 | goto LC40 | ld.vis.dv.sc0 r3, x3 ; + st.atom.rel.dv.sc0.semsc0 f1, 0 | st.atom.rel.dv.sc0.semsc0 f2, 0 | LC21: | ld.vis.dv.sc0 r4, x4 | LC41: | ld.vis.dv.sc0 r4, x4 ; + ld.vis.dv.sc0 r0, x0 | ld.vis.dv.sc0 r0, x0 | cbar.acq_rel.wg.semsc0 11 | ld.vis.dv.sc0 r5, x5 | cbar.acq_rel.wg.semsc0 21 | ld.vis.dv.sc0 r5, x5 ; + ld.vis.dv.sc0 r1, x1 | ld.vis.dv.sc0 r1, x1 | ld.vis.dv.sc0 r0, x0 | | ld.vis.dv.sc0 r0, x0 | ; + ld.vis.dv.sc0 r2, x2 | ld.vis.dv.sc0 r2, x2 | ld.vis.dv.sc0 r1, x1 | | ld.vis.dv.sc0 r1, x1 | ; + ld.vis.dv.sc0 r3, x3 | ld.vis.dv.sc0 r3, x3 | ld.vis.dv.sc0 r2, x2 | | ld.vis.dv.sc0 r2, x2 | ; + ld.vis.dv.sc0 r4, x4 | ld.vis.dv.sc0 r4, x4 | ld.vis.dv.sc0 r3, x3 | | ld.vis.dv.sc0 r3, x3 | ; + ld.vis.dv.sc0 r5, x5 | ld.vis.dv.sc0 r5, x5 | ld.vis.dv.sc0 r4, x4 | | ld.vis.dv.sc0 r4, x4 | ; + | | ld.vis.dv.sc0 r5, x5 | | ld.vis.dv.sc0 r5, x5 | ; + +forall( +P0:r0 == 1 /\ P0:r1 == 1 /\ P0:r2 == 1 /\ P0:r3 == 1 /\ P0:r4 == 1 /\ P0:r5 == 1 /\ +P1:r0 == 1 /\ P1:r1 == 1 /\ P1:r2 == 1 /\ P1:r3 == 1 /\ P1:r4 == 1 /\ P1:r5 == 1 /\ +P2:r0 == 1 /\ P2:r1 == 1 /\ P2:r2 == 1 /\ P2:r3 == 1 /\ P2:r4 == 1 /\ P2:r5 == 1 /\ +P3:r0 == 1 /\ P3:r1 == 1 /\ P3:r2 == 1 /\ P3:r3 == 1 /\ P3:r4 == 1 /\ P3:r5 == 1 /\ +P4:r0 == 1 /\ P4:r1 == 1 /\ P4:r2 == 1 /\ P4:r3 == 1 /\ P4:r4 == 1 /\ P4:r5 == 1 /\ +P5:r0 == 1 /\ P5:r1 == 1 /\ P5:r2 == 1 /\ P5:r3 == 1 /\ P5:r4 == 1 /\ P5:r5 == 1) diff --git a/litmus/VULKAN/Manual/xf-barrier-load-rlx-2.litmus b/litmus/VULKAN/Manual/xf-barrier-load-rlx-2.litmus new file mode 100644 index 0000000000..c75f2bc904 --- /dev/null +++ b/litmus/VULKAN/Manual/xf-barrier-load-rlx-2.litmus @@ -0,0 +1,32 @@ +Vulkan xf-barrier-load-rlx-2 +"Adapted from Figure 2 in +Portable Inter-workgroup Barrier Synchronisation for GPUs +https://dl.acm.org/doi/pdf/10.1145/2983990.2984032" +{ +x0=0; x1=0; x2=0; x3=0; x4=0; x5=0; +f1=0; f2=0; +} + P0@sg 0, wg 0, qf 0 | P1@sg 0, wg 0, qf 0 | P2@sg 0, wg 1, qf 0 | P3@sg 0, wg 1, qf 0 | P4@sg 0, wg 2, qf 0 | P5@sg 0, wg 2, qf 0 ; + st.av.dv.sc0 x0, 1 | st.av.dv.sc0 x1, 1 | st.av.dv.sc0 x2, 1 | st.av.dv.sc0 x3, 1 | st.av.dv.sc0 x4, 1 | st.av.dv.sc0 x5, 1 ; + LC00: | LC10: | cbar.acq_rel.wg.semsc0 10 | cbar.acq_rel.wg.semsc0 10 | cbar.acq_rel.wg.semsc0 20 | cbar.acq_rel.wg.semsc0 20 ; + ld.atom.acq.dv.sc0.semsc0 r9, f1 | ld.atom.acq.dv.sc0.semsc0 r9, f2 | st.atom.rel.dv.sc0.semsc0 f1, 1 | cbar.acq_rel.wg.semsc0 11 | st.atom.rel.dv.sc0.semsc0 f2, 1 | cbar.acq_rel.wg.semsc0 21 ; + bne r9, 0, LC01 | bne r9, 0, LC11 | LC20: | ld.vis.dv.sc0 r0, x0 | LC40: | ld.vis.dv.sc0 r0, x0 ; + goto LC00 | goto LC10 | ld.atom.dv.sc0.semsc0 r9, f1 | ld.vis.dv.sc0 r1, x1 | ld.atom.dv.sc0.semsc0 r9, f2 | ld.vis.dv.sc0 r1, x1 ; + LC01: | LC11: | bne r9, 1, LC21 | ld.vis.dv.sc0 r2, x2 | bne r9, 1, LC41 | ld.vis.dv.sc0 r2, x2 ; + cbar.acq_rel.wg.semsc0 00 | cbar.acq_rel.wg.semsc0 00 | goto LC20 | ld.vis.dv.sc0 r3, x3 | goto LC40 | ld.vis.dv.sc0 r3, x3 ; + st.atom.rel.dv.sc0.semsc0 f1, 0 | st.atom.rel.dv.sc0.semsc0 f2, 0 | LC21: | ld.vis.dv.sc0 r4, x4 | LC41: | ld.vis.dv.sc0 r4, x4 ; + ld.vis.dv.sc0 r0, x0 | ld.vis.dv.sc0 r0, x0 | cbar.acq_rel.wg.semsc0 11 | ld.vis.dv.sc0 r5, x5 | cbar.acq_rel.wg.semsc0 21 | ld.vis.dv.sc0 r5, x5 ; + ld.vis.dv.sc0 r1, x1 | ld.vis.dv.sc0 r1, x1 | ld.vis.dv.sc0 r0, x0 | | ld.vis.dv.sc0 r0, x0 | ; + ld.vis.dv.sc0 r2, x2 | ld.vis.dv.sc0 r2, x2 | ld.vis.dv.sc0 r1, x1 | | ld.vis.dv.sc0 r1, x1 | ; + ld.vis.dv.sc0 r3, x3 | ld.vis.dv.sc0 r3, x3 | ld.vis.dv.sc0 r2, x2 | | ld.vis.dv.sc0 r2, x2 | ; + ld.vis.dv.sc0 r4, x4 | ld.vis.dv.sc0 r4, x4 | ld.vis.dv.sc0 r3, x3 | | ld.vis.dv.sc0 r3, x3 | ; + ld.vis.dv.sc0 r5, x5 | ld.vis.dv.sc0 r5, x5 | ld.vis.dv.sc0 r4, x4 | | ld.vis.dv.sc0 r4, x4 | ; + | | ld.vis.dv.sc0 r5, x5 | | ld.vis.dv.sc0 r5, x5 | ; + +forall( +P0:r0 == 1 /\ P0:r1 == 1 /\ P0:r2 == 1 /\ P0:r3 == 1 /\ P0:r4 == 1 /\ P0:r5 == 1 /\ +P1:r0 == 1 /\ P1:r1 == 1 /\ P1:r2 == 1 /\ P1:r3 == 1 /\ P1:r4 == 1 /\ P1:r5 == 1 /\ +P2:r0 == 1 /\ P2:r1 == 1 /\ P2:r2 == 1 /\ P2:r3 == 1 /\ P2:r4 == 1 /\ P2:r5 == 1 /\ +P3:r0 == 1 /\ P3:r1 == 1 /\ P3:r2 == 1 /\ P3:r3 == 1 /\ P3:r4 == 1 /\ P3:r5 == 1 /\ +P4:r0 == 1 /\ P4:r1 == 1 /\ P4:r2 == 1 /\ P4:r3 == 1 /\ P4:r4 == 1 /\ P4:r5 == 1 /\ +P5:r0 == 1 /\ P5:r1 == 1 /\ P5:r2 == 1 /\ P5:r3 == 1 /\ P5:r4 == 1 /\ P5:r5 == 1) diff --git a/litmus/VULKAN/Manual/xf-barrier-store-rlx-1.litmus b/litmus/VULKAN/Manual/xf-barrier-store-rlx-1.litmus new file mode 100644 index 0000000000..7a46094930 --- /dev/null +++ b/litmus/VULKAN/Manual/xf-barrier-store-rlx-1.litmus @@ -0,0 +1,32 @@ +Vulkan xf-barrier-store-rlx-1 +"Adapted from Figure 2 in +Portable Inter-workgroup Barrier Synchronisation for GPUs +https://dl.acm.org/doi/pdf/10.1145/2983990.2984032" +{ +x0=0; x1=0; x2=0; x3=0; x4=0; x5=0; +f1=0; f2=0; +} + P0@sg 0, wg 0, qf 0 | P1@sg 0, wg 0, qf 0 | P2@sg 0, wg 1, qf 0 | P3@sg 0, wg 1, qf 0 | P4@sg 0, wg 2, qf 0 | P5@sg 0, wg 2, qf 0 ; + st.av.dv.sc0 x0, 1 | st.av.dv.sc0 x1, 1 | st.av.dv.sc0 x2, 1 | st.av.dv.sc0 x3, 1 | st.av.dv.sc0 x4, 1 | st.av.dv.sc0 x5, 1 ; + LC00: | LC10: | cbar.acq_rel.wg.semsc0 10 | cbar.acq_rel.wg.semsc0 10 | cbar.acq_rel.wg.semsc0 20 | cbar.acq_rel.wg.semsc0 20 ; + ld.atom.acq.dv.sc0.semsc0 r9, f1 | ld.atom.acq.dv.sc0.semsc0 r9, f2 | st.atom.rel.dv.sc0.semsc0 f1, 1 | cbar.acq_rel.wg.semsc0 11 | st.atom.rel.dv.sc0.semsc0 f2, 1 | cbar.acq_rel.wg.semsc0 21 ; + bne r9, 0, LC01 | bne r9, 0, LC11 | LC20: | ld.vis.dv.sc0 r0, x0 | LC40: | ld.vis.dv.sc0 r0, x0 ; + goto LC00 | goto LC10 | ld.atom.acq.dv.sc0.semsc0 r9, f1 | ld.vis.dv.sc0 r1, x1 | ld.atom.acq.dv.sc0.semsc0 r9, f2 | ld.vis.dv.sc0 r1, x1 ; + LC01: | LC11: | bne r9, 1, LC21 | ld.vis.dv.sc0 r2, x2 | bne r9, 1, LC41 | ld.vis.dv.sc0 r2, x2 ; + cbar.acq_rel.wg.semsc0 00 | cbar.acq_rel.wg.semsc0 00 | goto LC20 | ld.vis.dv.sc0 r3, x3 | goto LC40 | ld.vis.dv.sc0 r3, x3 ; + st.atom.dv.sc0.semsc0 f1, 0 | st.atom.dv.sc0.semsc0 f2, 0 | LC21: | ld.vis.dv.sc0 r4, x4 | LC41: | ld.vis.dv.sc0 r4, x4 ; + ld.vis.dv.sc0 r0, x0 | ld.vis.dv.sc0 r0, x0 | cbar.acq_rel.wg.semsc0 11 | ld.vis.dv.sc0 r5, x5 | cbar.acq_rel.wg.semsc0 21 | ld.vis.dv.sc0 r5, x5 ; + ld.vis.dv.sc0 r1, x1 | ld.vis.dv.sc0 r1, x1 | ld.vis.dv.sc0 r0, x0 | | ld.vis.dv.sc0 r0, x0 | ; + ld.vis.dv.sc0 r2, x2 | ld.vis.dv.sc0 r2, x2 | ld.vis.dv.sc0 r1, x1 | | ld.vis.dv.sc0 r1, x1 | ; + ld.vis.dv.sc0 r3, x3 | ld.vis.dv.sc0 r3, x3 | ld.vis.dv.sc0 r2, x2 | | ld.vis.dv.sc0 r2, x2 | ; + ld.vis.dv.sc0 r4, x4 | ld.vis.dv.sc0 r4, x4 | ld.vis.dv.sc0 r3, x3 | | ld.vis.dv.sc0 r3, x3 | ; + ld.vis.dv.sc0 r5, x5 | ld.vis.dv.sc0 r5, x5 | ld.vis.dv.sc0 r4, x4 | | ld.vis.dv.sc0 r4, x4 | ; + | | ld.vis.dv.sc0 r5, x5 | | ld.vis.dv.sc0 r5, x5 | ; + +forall( +P0:r0 == 1 /\ P0:r1 == 1 /\ P0:r2 == 1 /\ P0:r3 == 1 /\ P0:r4 == 1 /\ P0:r5 == 1 /\ +P1:r0 == 1 /\ P1:r1 == 1 /\ P1:r2 == 1 /\ P1:r3 == 1 /\ P1:r4 == 1 /\ P1:r5 == 1 /\ +P2:r0 == 1 /\ P2:r1 == 1 /\ P2:r2 == 1 /\ P2:r3 == 1 /\ P2:r4 == 1 /\ P2:r5 == 1 /\ +P3:r0 == 1 /\ P3:r1 == 1 /\ P3:r2 == 1 /\ P3:r3 == 1 /\ P3:r4 == 1 /\ P3:r5 == 1 /\ +P4:r0 == 1 /\ P4:r1 == 1 /\ P4:r2 == 1 /\ P4:r3 == 1 /\ P4:r4 == 1 /\ P4:r5 == 1 /\ +P5:r0 == 1 /\ P5:r1 == 1 /\ P5:r2 == 1 /\ P5:r3 == 1 /\ P5:r4 == 1 /\ P5:r5 == 1) diff --git a/litmus/VULKAN/Manual/xf-barrier-store-rlx-2.litmus b/litmus/VULKAN/Manual/xf-barrier-store-rlx-2.litmus new file mode 100644 index 0000000000..f81cc46ce0 --- /dev/null +++ b/litmus/VULKAN/Manual/xf-barrier-store-rlx-2.litmus @@ -0,0 +1,32 @@ +Vulkan xf-barrier-store-rlx-2 +"Adapted from Figure 2 in +Portable Inter-workgroup Barrier Synchronisation for GPUs +https://dl.acm.org/doi/pdf/10.1145/2983990.2984032" +{ +x0=0; x1=0; x2=0; x3=0; x4=0; x5=0; +f1=0; f2=0; +} + P0@sg 0, wg 0, qf 0 | P1@sg 0, wg 0, qf 0 | P2@sg 0, wg 1, qf 0 | P3@sg 0, wg 1, qf 0 | P4@sg 0, wg 2, qf 0 | P5@sg 0, wg 2, qf 0 ; + st.av.dv.sc0 x0, 1 | st.av.dv.sc0 x1, 1 | st.av.dv.sc0 x2, 1 | st.av.dv.sc0 x3, 1 | st.av.dv.sc0 x4, 1 | st.av.dv.sc0 x5, 1 ; + LC00: | LC10: | cbar.acq_rel.wg.semsc0 10 | cbar.acq_rel.wg.semsc0 10 | cbar.acq_rel.wg.semsc0 20 | cbar.acq_rel.wg.semsc0 20 ; + ld.atom.acq.dv.sc0.semsc0 r9, f1 | ld.atom.acq.dv.sc0.semsc0 r9, f2 | st.atom.dv.sc0.semsc0 f1, 1 | cbar.acq_rel.wg.semsc0 11 | st.atom.dv.sc0.semsc0 f2, 1 | cbar.acq_rel.wg.semsc0 21 ; + bne r9, 0, LC01 | bne r9, 0, LC11 | LC20: | ld.vis.dv.sc0 r0, x0 | LC40: | ld.vis.dv.sc0 r0, x0 ; + goto LC00 | goto LC10 | ld.atom.acq.dv.sc0.semsc0 r9, f1 | ld.vis.dv.sc0 r1, x1 | ld.atom.acq.dv.sc0.semsc0 r9, f2 | ld.vis.dv.sc0 r1, x1 ; + LC01: | LC11: | bne r9, 1, LC21 | ld.vis.dv.sc0 r2, x2 | bne r9, 1, LC41 | ld.vis.dv.sc0 r2, x2 ; + cbar.acq_rel.wg.semsc0 00 | cbar.acq_rel.wg.semsc0 00 | goto LC20 | ld.vis.dv.sc0 r3, x3 | goto LC40 | ld.vis.dv.sc0 r3, x3 ; + st.atom.rel.dv.sc0.semsc0 f1, 0 | st.atom.rel.dv.sc0.semsc0 f2, 0 | LC21: | ld.vis.dv.sc0 r4, x4 | LC41: | ld.vis.dv.sc0 r4, x4 ; + ld.vis.dv.sc0 r0, x0 | ld.vis.dv.sc0 r0, x0 | cbar.acq_rel.wg.semsc0 11 | ld.vis.dv.sc0 r5, x5 | cbar.acq_rel.wg.semsc0 21 | ld.vis.dv.sc0 r5, x5 ; + ld.vis.dv.sc0 r1, x1 | ld.vis.dv.sc0 r1, x1 | ld.vis.dv.sc0 r0, x0 | | ld.vis.dv.sc0 r0, x0 | ; + ld.vis.dv.sc0 r2, x2 | ld.vis.dv.sc0 r2, x2 | ld.vis.dv.sc0 r1, x1 | | ld.vis.dv.sc0 r1, x1 | ; + ld.vis.dv.sc0 r3, x3 | ld.vis.dv.sc0 r3, x3 | ld.vis.dv.sc0 r2, x2 | | ld.vis.dv.sc0 r2, x2 | ; + ld.vis.dv.sc0 r4, x4 | ld.vis.dv.sc0 r4, x4 | ld.vis.dv.sc0 r3, x3 | | ld.vis.dv.sc0 r3, x3 | ; + ld.vis.dv.sc0 r5, x5 | ld.vis.dv.sc0 r5, x5 | ld.vis.dv.sc0 r4, x4 | | ld.vis.dv.sc0 r4, x4 | ; + | | ld.vis.dv.sc0 r5, x5 | | ld.vis.dv.sc0 r5, x5 | ; + +forall( +P0:r0 == 1 /\ P0:r1 == 1 /\ P0:r2 == 1 /\ P0:r3 == 1 /\ P0:r4 == 1 /\ P0:r5 == 1 /\ +P1:r0 == 1 /\ P1:r1 == 1 /\ P1:r2 == 1 /\ P1:r3 == 1 /\ P1:r4 == 1 /\ P1:r5 == 1 /\ +P2:r0 == 1 /\ P2:r1 == 1 /\ P2:r2 == 1 /\ P2:r3 == 1 /\ P2:r4 == 1 /\ P2:r5 == 1 /\ +P3:r0 == 1 /\ P3:r1 == 1 /\ P3:r2 == 1 /\ P3:r3 == 1 /\ P3:r4 == 1 /\ P3:r5 == 1 /\ +P4:r0 == 1 /\ P4:r1 == 1 /\ P4:r2 == 1 /\ P4:r3 == 1 /\ P4:r4 == 1 /\ P4:r5 == 1 /\ +P5:r0 == 1 /\ P5:r1 == 1 /\ P5:r2 == 1 /\ P5:r3 == 1 /\ P5:r4 == 1 /\ P5:r5 == 1) diff --git a/litmus/VULKAN/Manual/xf-barrier.litmus b/litmus/VULKAN/Manual/xf-barrier.litmus new file mode 100644 index 0000000000..319b805b5e --- /dev/null +++ b/litmus/VULKAN/Manual/xf-barrier.litmus @@ -0,0 +1,32 @@ +Vulkan xf-barrier +"Adapted from Figure 2 in +Portable Inter-workgroup Barrier Synchronisation for GPUs +https://dl.acm.org/doi/pdf/10.1145/2983990.2984032" +{ +x0=0; x1=0; x2=0; x3=0; x4=0; x5=0; +f1=0; f2=0; +} + P0@sg 0, wg 0, qf 0 | P1@sg 0, wg 0, qf 0 | P2@sg 0, wg 1, qf 0 | P3@sg 0, wg 1, qf 0 | P4@sg 0, wg 2, qf 0 | P5@sg 0, wg 2, qf 0 ; + st.av.dv.sc0 x0, 1 | st.av.dv.sc0 x1, 1 | st.av.dv.sc0 x2, 1 | st.av.dv.sc0 x3, 1 | st.av.dv.sc0 x4, 1 | st.av.dv.sc0 x5, 1 ; + LC00: | LC10: | cbar.acq_rel.wg.semsc0 10 | cbar.acq_rel.wg.semsc0 10 | cbar.acq_rel.wg.semsc0 20 | cbar.acq_rel.wg.semsc0 20 ; + ld.atom.acq.dv.sc0.semsc0 r9, f1 | ld.atom.acq.dv.sc0.semsc0 r9, f2 | st.atom.rel.dv.sc0.semsc0 f1, 1 | cbar.acq_rel.wg.semsc0 11 | st.atom.rel.dv.sc0.semsc0 f2, 1 | cbar.acq_rel.wg.semsc0 21 ; + bne r9, 0, LC01 | bne r9, 0, LC11 | LC20: | ld.vis.dv.sc0 r0, x0 | LC40: | ld.vis.dv.sc0 r0, x0 ; + goto LC00 | goto LC10 | ld.atom.acq.dv.sc0.semsc0 r9, f1 | ld.vis.dv.sc0 r1, x1 | ld.atom.acq.dv.sc0.semsc0 r9, f2 | ld.vis.dv.sc0 r1, x1 ; + LC01: | LC11: | bne r9, 1, LC21 | ld.vis.dv.sc0 r2, x2 | bne r9, 1, LC41 | ld.vis.dv.sc0 r2, x2 ; + cbar.acq_rel.wg.semsc0 00 | cbar.acq_rel.wg.semsc0 00 | goto LC20 | ld.vis.dv.sc0 r3, x3 | goto LC40 | ld.vis.dv.sc0 r3, x3 ; + st.atom.rel.dv.sc0.semsc0 f1, 0 | st.atom.rel.dv.sc0.semsc0 f2, 0 | LC21: | ld.vis.dv.sc0 r4, x4 | LC41: | ld.vis.dv.sc0 r4, x4 ; + ld.vis.dv.sc0 r0, x0 | ld.vis.dv.sc0 r0, x0 | cbar.acq_rel.wg.semsc0 11 | ld.vis.dv.sc0 r5, x5 | cbar.acq_rel.wg.semsc0 21 | ld.vis.dv.sc0 r5, x5 ; + ld.vis.dv.sc0 r1, x1 | ld.vis.dv.sc0 r1, x1 | ld.vis.dv.sc0 r0, x0 | | ld.vis.dv.sc0 r0, x0 | ; + ld.vis.dv.sc0 r2, x2 | ld.vis.dv.sc0 r2, x2 | ld.vis.dv.sc0 r1, x1 | | ld.vis.dv.sc0 r1, x1 | ; + ld.vis.dv.sc0 r3, x3 | ld.vis.dv.sc0 r3, x3 | ld.vis.dv.sc0 r2, x2 | | ld.vis.dv.sc0 r2, x2 | ; + ld.vis.dv.sc0 r4, x4 | ld.vis.dv.sc0 r4, x4 | ld.vis.dv.sc0 r3, x3 | | ld.vis.dv.sc0 r3, x3 | ; + ld.vis.dv.sc0 r5, x5 | ld.vis.dv.sc0 r5, x5 | ld.vis.dv.sc0 r4, x4 | | ld.vis.dv.sc0 r4, x4 | ; + | | ld.vis.dv.sc0 r5, x5 | | ld.vis.dv.sc0 r5, x5 | ; + +forall( +P0:r0 == 1 /\ P0:r1 == 1 /\ P0:r2 == 1 /\ P0:r3 == 1 /\ P0:r4 == 1 /\ P0:r5 == 1 /\ +P1:r0 == 1 /\ P1:r1 == 1 /\ P1:r2 == 1 /\ P1:r3 == 1 /\ P1:r4 == 1 /\ P1:r5 == 1 /\ +P2:r0 == 1 /\ P2:r1 == 1 /\ P2:r2 == 1 /\ P2:r3 == 1 /\ P2:r4 == 1 /\ P2:r5 == 1 /\ +P3:r0 == 1 /\ P3:r1 == 1 /\ P3:r2 == 1 /\ P3:r3 == 1 /\ P3:r4 == 1 /\ P3:r5 == 1 /\ +P4:r0 == 1 /\ P4:r1 == 1 /\ P4:r2 == 1 /\ P4:r3 == 1 /\ P4:r4 == 1 /\ P4:r5 == 1 /\ +P5:r0 == 1 /\ P5:r1 == 1 /\ P5:r2 == 1 /\ P5:r3 == 1 /\ P5:r4 == 1 /\ P5:r5 == 1) diff --git a/pom.xml b/pom.xml index ab2cc7d50b..fa020eba60 100644 --- a/pom.xml +++ b/pom.xml @@ -47,6 +47,7 @@ 32.1.2-jre 4.13.2 2.23.0 + 5.11.0 3.3.4 From cdc0689ef5561b1a36b8a64d65d0960bfebd5de5 Mon Sep 17 00:00:00 2001 From: natgavrilenko Date: Mon, 12 Aug 2024 15:50:08 +0200 Subject: [PATCH 23/28] Add memory effects to LLVM grammar and better error message (#710) Co-authored-by: Natalia Gavrilenko --- dartagnan/src/main/antlr4/LLVMIR.g4 | 12 +++++++++++- .../parsers/program/visitors/VisitorLlvm.java | 16 ++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/dartagnan/src/main/antlr4/LLVMIR.g4 b/dartagnan/src/main/antlr4/LLVMIR.g4 index 79c9168ee3..a745ada78c 100644 --- a/dartagnan/src/main/antlr4/LLVMIR.g4 +++ b/dartagnan/src/main/antlr4/LLVMIR.g4 @@ -740,7 +740,17 @@ funcAttr: | 'sspstrong' | 'strictfp' | 'willreturn' - | 'writeonly'; + | 'writeonly' + | 'memory(' memoryEffect+ ')'; +memoryEffect + : accessKind + | 'argmem:' accessKind + | 'inaccessiblemem:' accessKind; +accessKind + : 'none' + | 'readwrite' + | 'read' + | 'write'; distinct: 'distinct'; inBounds: 'inbounds'; returnAttr: diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLlvm.java b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLlvm.java index e150cafd35..e9be54d72f 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLlvm.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/parsers/program/visitors/VisitorLlvm.java @@ -240,13 +240,17 @@ public void visitGlobalDeclaration(GlobalDefContext ctx) { final String name = globalIdent(ctx.GlobalIdent()); check(!constantMap.containsKey(name), "Redeclared constant in %s.", ctx); final int size = types.getMemorySizeInBytes(parseType(ctx.type())); - final MemoryObject globalObject = program.getMemory().allocate(size); - globalObject.setName(name); - if (ctx.threadLocal() != null) { - globalObject.setIsThreadLocal(true); + if (size > 0) { + final MemoryObject globalObject = program.getMemory().allocate(size); + globalObject.setName(name); + if (ctx.threadLocal() != null) { + globalObject.setIsThreadLocal(true); + } + // TODO: mark the global as constant, if possible. + constantMap.put(name, globalObject); + return; } - // TODO: mark the global as constant, if possible. - constantMap.put(name, globalObject); + throw new ParsingException(String.format("Cannot compute memory size for '%s'", name)); } @Override From 618c3f72c9eba4be020b8f7a13236c0751c58f6f Mon Sep 17 00:00:00 2001 From: natgavrilenko Date: Tue, 13 Aug 2024 21:12:29 +0200 Subject: [PATCH 24/28] Fix printer OutOfBoundsException (#713) Co-authored-by: Natalia Gavrilenko --- .../main/java/com/dat3m/dartagnan/utils/printer/Printer.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/utils/printer/Printer.java b/dartagnan/src/main/java/com/dat3m/dartagnan/utils/printer/Printer.java index 8ff3aa4361..c1ef0ec36c 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/utils/printer/Printer.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/utils/printer/Printer.java @@ -113,7 +113,9 @@ private void appendEvent(Event event){ if(!(event instanceof Label)) { result.append(" "); } - result.append(padding, idSb.length(), padding.length()); + if (idSb.length() < padding.length()) { + result.append(padding, idSb.length(), padding.length()); + } result.append(event).append("\n"); } } From f6d10e26151194b25ef36a71cc079c5d252e6d0f Mon Sep 17 00:00:00 2001 From: Dmitry Ivanov <32366373+DIvanov503@users.noreply.github.com> Date: Mon, 26 Aug 2024 11:32:09 +0300 Subject: [PATCH 25/28] Compute missing tuples in transitive closure (#718) Co-authored-by: Dmitry Ivanov --- .../wmm/analysis/NativeRelationAnalysis.java | 33 +++++-------------- 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/analysis/NativeRelationAnalysis.java b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/analysis/NativeRelationAnalysis.java index 1333ececf3..2f9ec76059 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/analysis/NativeRelationAnalysis.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/wmm/analysis/NativeRelationAnalysis.java @@ -1064,7 +1064,7 @@ private Map computeViltualAddressMap() { program.getThreadEvents(MemoryCoreEvent.class).forEach(e -> { Set s = e.getAddress().getMemoryObjects().stream() .filter(VirtualMemoryObject.class::isInstance) - .map(o -> (VirtualMemoryObject)o) + .map(o -> (VirtualMemoryObject) o) .collect(Collectors.toSet()); if (s.size() > 1) { throw new UnsupportedOperationException( @@ -1622,30 +1622,15 @@ public Delta visitTransitiveClosure(TransitiveClosure trans) { } private EventGraph computeTransitiveClosure(EventGraph oldOuter, EventGraph inner, boolean isMay) { - EventGraph next; EventGraph outer = new EventGraph(oldOuter); - outer.addAll(inner); - for (EventGraph current = inner; !current.isEmpty(); current = next) { - next = new EventGraph(); - for (Event e1 : current.getDomain()) { - Set update = new HashSet<>(); - for (Event e2 : current.getRange(e1)) { - if (isMay) { - update.addAll(outer.getRange(e2)); - } else { - boolean implies = exec.isImplied(e1, e2); - update.addAll(outer.getRange(e2).stream() - .filter(e -> implies || exec.isImplied(e, e2)) - .toList()); - } - } - Set known = outer.getRange(e1); - update.removeIf(e -> known.contains(e) || exec.areMutuallyExclusive(e1, e)); - if (!update.isEmpty()) { - next.addRange(e1, update); - } - } - outer.addAll(next); + EventGraph update = inner.filter(outer::add); + EventGraph updateComposition = new EventGraph(); + computeComposition(updateComposition, inner, oldOuter, isMay); + update.addAll(updateComposition.filter(outer::add)); + while (!update.isEmpty()) { + EventGraph t = new EventGraph(); + computeComposition(t, inner, update, isMay); + update = t.filter(outer::add); } return outer; } From 053afd6d2f9965caf8670488d352382d7025067d Mon Sep 17 00:00:00 2001 From: Thomas Haas Date: Fri, 30 Aug 2024 09:37:42 +0200 Subject: [PATCH 26/28] Improved DynamicSpinLoopDetection to handle RMWStoreExclusive correctly --- .../processing/DynamicSpinLoopDetection.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/DynamicSpinLoopDetection.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/DynamicSpinLoopDetection.java index 1c65201ce4..a7e9e2bc92 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/DynamicSpinLoopDetection.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/DynamicSpinLoopDetection.java @@ -132,6 +132,7 @@ private void reduceToDominatingSideEffects(LoopData loop) { final List sideEffects = loop.sideEffects; final Event start = loop.getStart(); final Event end = loop.getEnd(); + final Predicate isAlwaysSideEffectful = (e -> e.cfImpliesExec() && sideEffects.contains(e)); final DominatorTree preDominatorTree = DominatorAnalysis.computePreDominatorTree(start, end); final DominatorTree postDominatorTree = DominatorAnalysis.computePostDominatorTree(start, end); @@ -144,7 +145,7 @@ private void reduceToDominatingSideEffects(LoopData loop) { // (2) Check if always side-effect-full at the end of an iteration directly before entering the next one. // This is an approximation: If the end of the iteration is predominated by some side effect // then we always observe side effects. - loop.isAlwaysSideEffectful = Streams.stream(preDominatorTree.getDominators(end)).anyMatch(sideEffects::contains); + loop.isAlwaysSideEffectful = Streams.stream(preDominatorTree.getDominators(end)).anyMatch(isAlwaysSideEffectful); if (loop.isAlwaysSideEffectful) { return; } @@ -157,7 +158,7 @@ private void reduceToDominatingSideEffects(LoopData loop) { preDominatorTree.getStrictDominators(sideEffect), postDominatorTree.getStrictDominators(sideEffect) ); - final boolean isDominated = Iterables.tryFind(dominators, sideEffects::contains).isPresent(); + final boolean isDominated = Iterables.tryFind(dominators, isAlwaysSideEffectful::test).isPresent(); if (isDominated) { sideEffects.remove(i); } @@ -173,12 +174,22 @@ private void instrumentLoop(LoopData loop) { final ExpressionFactory expressions = ExpressionFactory.getInstance(); final Function func = loop.loopInfo.function(); final int loopNum = loop.loopInfo.loopNumber(); + final Register tempReg = func.newRegister("__possiblySideEffectless#" + loopNum, types.getBooleanType()); final Register trackingReg = func.newRegister("__sideEffect#" + loopNum, types.getBooleanType()); final Event init = EventFactory.newLocal(trackingReg, expressions.makeFalse()); loop.getStart().insertAfter(init); for (Event sideEffect : loop.sideEffects) { - final Event updateSideEffect = EventFactory.newLocal(trackingReg, expressions.makeTrue()); + final List updateSideEffect = new ArrayList<>(); + if (sideEffect.cfImpliesExec()) { + updateSideEffect.add(EventFactory.newLocal(trackingReg, expressions.makeTrue())); + } else { + updateSideEffect.addAll(List.of( + EventFactory.newExecutionStatus(tempReg, sideEffect), + EventFactory.newLocal(trackingReg, expressions.makeOr(trackingReg, expressions.makeNot(tempReg))) + )); + + } sideEffect.getPredecessor().insertAfter(updateSideEffect); } From dc34e7e1c52b16626037563ff3bc3795c2aa6e16 Mon Sep 17 00:00:00 2001 From: Thomas Haas Date: Fri, 30 Aug 2024 09:38:39 +0200 Subject: [PATCH 27/28] Refactored PropertyEncoder.LivenessEncoder and added fairness conditions for RMWStoreExclusive when checking for liveness issues --- .../dartagnan/encoding/PropertyEncoder.java | 158 +++++++++++------- 1 file changed, 99 insertions(+), 59 deletions(-) diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/PropertyEncoder.java b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/PropertyEncoder.java index fa7ed2b267..4bafd5518f 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/PropertyEncoder.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/PropertyEncoder.java @@ -21,7 +21,6 @@ import com.dat3m.dartagnan.wmm.utils.EventGraph; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; -import com.google.common.collect.Maps; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.sosy_lab.common.configuration.InvalidConfigurationException; @@ -36,8 +35,8 @@ import java.util.stream.Collectors; import static com.dat3m.dartagnan.configuration.Property.*; -import static com.dat3m.dartagnan.wmm.RelationNameRepository.CO; import static com.dat3m.dartagnan.program.Program.SourceLanguage.LLVM; +import static com.dat3m.dartagnan.wmm.RelationNameRepository.CO; public class PropertyEncoder implements Encoder { @@ -66,7 +65,7 @@ public class PropertyEncoder implements Encoder { Since we encode a lot of potential violations, and we want to trace back which one lead to our query being SAT, we use trackable formulas. */ - private static class TrackableFormula { + public static class TrackableFormula { private final BooleanFormula trackingLiteral; private final BooleanFormula trackedFormula; @@ -304,7 +303,7 @@ public List encodeCATSpecificationViolations() { final EncodingContext ctx = this.context; final Wmm memoryModel = this.memoryModel; final List flaggedAxioms = memoryModel.getAxioms().stream() - .filter(Axiom::isFlagged).collect(Collectors.toList()); + .filter(Axiom::isFlagged).toList(); if (flaggedAxioms.isEmpty()) { logger.info("No CAT specification in the WMM. Skipping encoding."); @@ -402,20 +401,27 @@ public TrackableFormula encodeDataRaces() { private TrackableFormula encodeDeadlocks() { logger.info("Encoding dead locks"); - return new LivenessEncoder().encodeDeadlocks(); + return new LivenessEncoder().encodeLivenessBugs(); } /* Encoder for the liveness property. We have a liveness violation in some execution if - - At least one thread is stuck inside a loop (*) + - At least one thread is stuck (*) - All other threads are either stuck or terminated normally (**) - (*) A thread is stuck if it finishes a loop iteration - - without causing side-effects (e.g., visible stores) - - while reading only from co-maximal stores - => Without external help, a stuck thread will never be able to exit the loop. + (*) A thread is stuck if + (1) it performs a loop iteration without causing side-effects (e.g., visible stores) + while satisfying fairness conditions + => Without external help, a stuck thread will never be able to exit the loop. + OR (2) the thread is blocked by a control barrier. + + Fairness conditions for loops: + - Memory fairness: the loop iteration reads only co-maximal values + - Excl-Store progress: all exclusive stores in the iteration succeed (infinite spurious failures are unfair) + NOTE: Here we assume strong progress. Under weak fairness, a loop with two exclusive stores that need + to succeed in the same iteration could fail liveness if they succeed in alternation. (**) A thread terminates normally IFF it does not terminate early (denoted by EARLYTERMINATION-tagged jumps) due to e.g., @@ -429,33 +435,16 @@ in a deadlock without satisfying the stated conditions (e.g., while producing si */ private class LivenessEncoder { - private static class SpinIteration { - public final List containedLoads = new ArrayList<>(); - // Execution of the means the loop performed a side-effect-free - // iteration without exiting. If such a jump is executed + all loads inside the loop - // were co-maximal, then we have a deadlock condition. - public final List spinningJumps = new ArrayList<>(); - } - - public TrackableFormula encodeDeadlocks() { + public TrackableFormula encodeLivenessBugs() { final Program program = PropertyEncoder.this.program; final EncodingContext context = PropertyEncoder.this.context; final BooleanFormulaManager bmgr = context.getBooleanFormulaManager(); - final LoopAnalysis loopAnalysis = LoopAnalysis.newInstance(program); - - // Find spin loops of all threads - final Map> spinloopsMap = - Maps.toMap(program.getThreads(), t -> this.findSpinLoopsInThread(t, loopAnalysis)); - // Compute "stuckness" encoding for all threads - final Map isStuckMap = Maps.toMap(program.getThreads(), t -> - bmgr.or(generateBarrierStucknessEncoding(t, context), - this.generateSpinloopStucknessEncoding(spinloopsMap.get(t), context))); // Deadlock <=> allStuckOrDone /\ atLeastOneStuck BooleanFormula allStuckOrDone = bmgr.makeTrue(); BooleanFormula atLeastOneStuck = bmgr.makeFalse(); for (Thread thread : program.getThreads()) { - final BooleanFormula isStuck = isStuckMap.get(thread); + final BooleanFormula isStuck = isStuckEncoding(thread, context); final BooleanFormula isTerminatingNormally = thread .getEvents().stream() .filter(e -> e.hasTag(Tag.EARLYTERMINATION)) @@ -471,6 +460,16 @@ public TrackableFormula encodeDeadlocks() { return new TrackableFormula(bmgr.not(LIVENESS.getSMTVariable(context)), hasDeadlock); } + private BooleanFormula isStuckEncoding(Thread thread, EncodingContext context) { + return context.getBooleanFormulaManager().or( + generateSpinloopStucknessEncoding(thread, context), + generateBarrierStucknessEncoding(thread, context) + ); + } + + // ------------------------------------------------------------------------------ + // Liveness issue due to blocked execution (due to ControlBarrier) + private BooleanFormula generateBarrierStucknessEncoding(Thread thread, EncodingContext context) { final BooleanFormulaManager bmgr = context.getBooleanFormulaManager(); return bmgr.or(thread.getEvents().stream() @@ -479,37 +478,85 @@ private BooleanFormula generateBarrierStucknessEncoding(Thread thread, EncodingC .toList()); } - // Compute "stuckness": A thread is stuck if it reaches a spin loop bound event - // while only reading from co-maximal stores. - private BooleanFormula generateSpinloopStucknessEncoding(List loops, EncodingContext context) { + // ------------------------------------------------------------------------------ + // Liveness issue due to non-terminating loops (~ deadlocks) + + private record SpinIteration(List body, List spinningJumps) { + // Execution of the means the loop performed a side-effect-free + // iteration without exiting. If such a jump is executed + all loads inside the loop + // were co-maximal, then we have a deadlock condition. + } + + private BooleanFormula generateSpinloopStucknessEncoding(Thread thread, EncodingContext context) { + final LoopAnalysis loopAnalysis = LoopAnalysis.onFunction(thread); + final BooleanFormulaManager bmgr = context.getBooleanFormulaManager(); + + return this.findSpinLoopsInThread(thread, loopAnalysis).stream() + .map(loop -> generateSpinloopStucknessEncoding(loop, context)) + .reduce(bmgr.makeFalse(), bmgr::or); + } + + private BooleanFormula generateSpinloopStucknessEncoding(SpinIteration loop, EncodingContext context) { + return context.getBooleanFormulaManager().and( + isSideEffectFreeEncoding(loop, context), + fairnessEncoding(loop, context) + ); + } + + private BooleanFormula isSideEffectFreeEncoding(SpinIteration loop, EncodingContext context) { + // Note that we assume (for now) that a SPINLOOP-tagged jump is executed only if the loop iteration + // was side-effect free. + final BooleanFormulaManager bmgr = context.getBooleanFormulaManager(); + final BooleanFormula isSideEffectFree = loop.spinningJumps.stream() + .map(j -> bmgr.and(context.execution(j), context.jumpCondition(j))) + .reduce(bmgr.makeFalse(), bmgr::or); + return isSideEffectFree; + } + + private BooleanFormula fairnessEncoding(SpinIteration loop, EncodingContext context) { + return context.getBooleanFormulaManager().and( + memoryFairnessEncoding(loop, context), + exclStoreFairnessEncoding(loop, context) + ); + } + + private BooleanFormula memoryFairnessEncoding(SpinIteration loop, EncodingContext context) { final BooleanFormulaManager bmgr = context.getBooleanFormulaManager(); final RelationAnalysis ra = PropertyEncoder.this.ra; final Relation rf = memoryModel.getRelation(RelationNameRepository.RF); final EncodingContext.EdgeEncoder rfEncoder = context.edge(rf); final Map> rfMayIn = ra.getKnowledge(rf).getMaySet().getInMap(); - if (loops.isEmpty()) { - return bmgr.makeFalse(); - } + final List loads = loop.body.stream() + .filter(Load.class::isInstance) + .map(Load.class::cast) + .toList(); - BooleanFormula isStuck = bmgr.makeFalse(); - for (SpinIteration loop : loops) { - BooleanFormula allLoadsAreCoMaximal = bmgr.makeTrue(); - for (Load load : loop.containedLoads) { - final BooleanFormula readsCoMaximalStore = rfMayIn.getOrDefault(load, Set.of()).stream() - .map(store -> bmgr.and(rfEncoder.encode(store, load), lastCoVar(store))) - .reduce(bmgr.makeFalse(), bmgr::or); - final BooleanFormula isCoMaximalLoad = bmgr.implication(context.execution(load), readsCoMaximalStore); - allLoadsAreCoMaximal = bmgr.and(allLoadsAreCoMaximal, isCoMaximalLoad); - } - // Note that we assume (for now) that a SPINLOOP-tagged jump is executed only if the loop iteration - // was side-effect free. - final BooleanFormula isSideEffectFree = loop.spinningJumps.stream() - .map(j -> bmgr.and(context.execution(j), context.jumpCondition(j))) + BooleanFormula allLoadsAreCoMaximal = bmgr.makeTrue(); + for (Load load : loads) { + final BooleanFormula readsCoMaximalStore = rfMayIn.getOrDefault(load, Set.of()).stream() + .map(store -> bmgr.and(rfEncoder.encode(store, load), lastCoVar(store))) .reduce(bmgr.makeFalse(), bmgr::or); - isStuck = bmgr.or(isStuck, bmgr.and(isSideEffectFree, allLoadsAreCoMaximal)); + final BooleanFormula isCoMaximalLoad = bmgr.implication(context.execution(load), readsCoMaximalStore); + allLoadsAreCoMaximal = bmgr.and(allLoadsAreCoMaximal, isCoMaximalLoad); + } + + return allLoadsAreCoMaximal; + } + + private BooleanFormula exclStoreFairnessEncoding(SpinIteration loop, EncodingContext context) { + final BooleanFormulaManager bmgr = context.getBooleanFormulaManager(); + final List exclStores = loop.body.stream() + .filter(RMWStoreExclusive.class::isInstance) + .map(RMWStoreExclusive.class::cast) + .toList(); + BooleanFormula allExclStoresExecuted = bmgr.makeTrue(); + for (RMWStoreExclusive exclStore : exclStores) { + final BooleanFormula executedIfPossible = bmgr.implication(context.controlFlow(exclStore), context.execution(exclStore)); + allExclStoresExecuted = bmgr.and(allExclStoresExecuted, executedIfPossible); } - return isStuck; + + return allExclStoresExecuted; } private List findSpinLoopsInThread(Thread thread, LoopAnalysis loopAnalysis) { @@ -525,14 +572,7 @@ private List findSpinLoopsInThread(Thread thread, LoopAnalysis lo .toList(); if (!spinningJumps.isEmpty()) { - final List loads = iterBody.stream() - .filter(Load.class::isInstance) - .map(Load.class::cast) - .toList(); - - final SpinIteration spinIter = new SpinIteration(); - spinIter.spinningJumps.addAll(spinningJumps); - spinIter.containedLoads.addAll(loads); + final SpinIteration spinIter = new SpinIteration(iterBody, spinningJumps); spinIterations.add(spinIter); } } From b682775756f4ab0d533df9720a2b3739a964eb2b Mon Sep 17 00:00:00 2001 From: Thomas Haas Date: Fri, 2 Aug 2024 05:40:40 +0200 Subject: [PATCH 28/28] Split Tag.EARLYTERMINATION into EXCEPTITONAL_TERMINATION and NONTERMINATION --- .../com/dat3m/dartagnan/encoding/PropertyEncoder.java | 5 +++-- .../main/java/com/dat3m/dartagnan/program/event/Tag.java | 8 +++++--- .../program/processing/DynamicSpinLoopDetection.java | 2 +- .../com/dat3m/dartagnan/program/processing/Inlining.java | 2 +- .../dat3m/dartagnan/program/processing/Intrinsics.java | 2 +- .../dat3m/dartagnan/program/processing/LoopUnrolling.java | 2 +- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/PropertyEncoder.java b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/PropertyEncoder.java index 4bafd5518f..36427a5adf 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/PropertyEncoder.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/encoding/PropertyEncoder.java @@ -423,7 +423,8 @@ private TrackableFormula encodeDeadlocks() { NOTE: Here we assume strong progress. Under weak fairness, a loop with two exclusive stores that need to succeed in the same iteration could fail liveness if they succeed in alternation. - (**) A thread terminates normally IFF it does not terminate early (denoted by EARLYTERMINATION-tagged jumps) + (**) A thread terminates normally IFF it does terminate (no NONTERMINATION-tagged jumps) non-exceptionally + (no EXCEPTIONAL_TERMINATION-tagged jumps) due to e.g., - violating an assertion - reaching the loop unrolling bound @@ -447,7 +448,7 @@ public TrackableFormula encodeLivenessBugs() { final BooleanFormula isStuck = isStuckEncoding(thread, context); final BooleanFormula isTerminatingNormally = thread .getEvents().stream() - .filter(e -> e.hasTag(Tag.EARLYTERMINATION)) + .filter(e -> e.hasTag(Tag.EXCEPTIONAL_TERMINATION) || e.hasTag(Tag.NONTERMINATION)) .map(CondJump.class::cast) .map(j -> bmgr.not(bmgr.and(context.execution(j), context.jumpCondition(j)))) .reduce(bmgr.makeTrue(), bmgr::and); diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/Tag.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/Tag.java index b4cb282558..03cacda223 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/Tag.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/event/Tag.java @@ -27,9 +27,11 @@ private Tag() { } public static final String EXCL = "__EXCL"; // Marks the event that is reachable IFF a loop has not been fully unrolled. public static final String BOUND = "__BOUND"; - // Marks jumps that somehow terminate a thread earlier than "normally" - // This can be bound events, spinning events, assertion violations, etc. - public static final String EARLYTERMINATION = "__EARLYTERMINATION"; + // Marks jumps that designate an exceptional termination, typically due to assertion failures + public static final String EXCEPTIONAL_TERMINATION = "__EXCEPTIONAL_TERMINATION"; + // Marks jumps that designate non-termination, typically spinloops and bound events + // (and control barriers in the future) + public static final String NONTERMINATION = "__NONTERMINATION"; // Marks jumps that terminate a thread due to spinning behaviour, i.e. side-effect-free loop iterations public static final String SPINLOOP = "__SPINLOOP"; // Some events should not be optimized (e.g. fake dependencies) or deleted (e.g. bounds) diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/DynamicSpinLoopDetection.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/DynamicSpinLoopDetection.java index a7e9e2bc92..1a002d6b52 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/DynamicSpinLoopDetection.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/DynamicSpinLoopDetection.java @@ -208,7 +208,7 @@ private Event newSpinTerminator(Expression guard, Function func) { final Event terminator = func instanceof Thread thread ? EventFactory.newJump(guard, (Label) thread.getExit()) : EventFactory.newAbortIf(guard); - terminator.addTags(Tag.SPINLOOP, Tag.EARLYTERMINATION, Tag.NOOPT); + terminator.addTags(Tag.SPINLOOP, Tag.NONTERMINATION, Tag.NOOPT); return terminator; } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Inlining.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Inlining.java index 38b2e1814f..a755d09f1e 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Inlining.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Inlining.java @@ -88,7 +88,7 @@ private void inlineAllCalls(Function function, Map snapshots if (depth > bound) { final AbortIf boundEvent = newAbortIf(ExpressionFactory.getInstance().makeTrue()); boundEvent.copyAllMetadataFrom(call); - boundEvent.addTags(Tag.BOUND, Tag.EARLYTERMINATION, Tag.NOOPT); + boundEvent.addTags(Tag.BOUND, Tag.NONTERMINATION, Tag.NOOPT); call.replaceBy(boundEvent); event = boundEvent; } else { diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java index db2871e546..b81f2a43e5 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/Intrinsics.java @@ -901,7 +901,7 @@ private List inlineAssert(FunctionCall call, AssertionType skip, String e final Expression condition = expressions.makeFalse(); final Event assertion = EventFactory.newAssert(condition, errorMsg); final Event abort = EventFactory.newAbortIf(expressions.makeTrue()); - abort.addTags(Tag.EARLYTERMINATION); + abort.addTags(Tag.EXCEPTIONAL_TERMINATION); return List.of(assertion, abort); } diff --git a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/LoopUnrolling.java b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/LoopUnrolling.java index 7b6bca60a9..293f15f489 100644 --- a/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/LoopUnrolling.java +++ b/dartagnan/src/main/java/com/dat3m/dartagnan/program/processing/LoopUnrolling.java @@ -191,7 +191,7 @@ private Event newBoundEvent(Function func) { final Event boundEvent = func instanceof Thread thread ? EventFactory.newGoto((Label) thread.getExit()) : EventFactory.newAbortIf(ExpressionFactory.getInstance().makeTrue()); - boundEvent.addTags(Tag.BOUND, Tag.EARLYTERMINATION, Tag.NOOPT); + boundEvent.addTags(Tag.BOUND, Tag.NONTERMINATION, Tag.NOOPT); return boundEvent; }