Created
January 24, 2018 18:16
-
-
Save lissyx/096d7cc4f79045fbbe60816a2f0f0a49 to your computer and use it in GitHub Desktop.
hacking weird cuda rebuilds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java | |
index 3559fffde..37c483ce9 100644 | |
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java | |
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java | |
@@ -1111,10 +1111,30 @@ public class CppCompileAction extends AbstractAction | |
@Override | |
public String computeKey() { | |
+ // ".ckd" Compute Key Debug | |
+ PrintWriter computeKeyDebugWriter = null; | |
+ String computeKeyDebugFile = getInternalOutputFile() + ".ckd"; | |
+ try { | |
+ computeKeyDebugWriter = new PrintWriter(computeKeyDebugFile, "UTF-8"); | |
+ } catch (java.io.FileNotFoundException ex) { | |
+ System.err.println("Unable to create " + computeKeyDebugFile); | |
+ } catch (java.io.UnsupportedEncodingException ex) { | |
+ System.err.println("Unsupported encoding"); | |
+ } | |
+ | |
Fingerprint f = new Fingerprint(); | |
f.addUUID(actionClassId); | |
+ computeKeyDebugWriter.println("UUID: " + actionClassId); | |
+ | |
f.addStringMap(getEnvironment()); | |
+ for (Map.Entry<String, String> entry : getEnvironment().entrySet()) { | |
+ computeKeyDebugWriter.println("ENV: " + entry.getKey() + "=" + entry.getValue()); | |
+ } | |
+ | |
f.addStringMap(executionInfo); | |
+ for (Map.Entry<String, String> entry : executionInfo.entrySet()) { | |
+ computeKeyDebugWriter.println("EXECINFO: " + entry.getKey() + "=" + entry.getValue()); | |
+ } | |
// For the argv part of the cache key, ignore all compiler flags that explicitly denote module | |
// file (.pcm) inputs. Depending on input discovery, some of the unused ones are removed from | |
@@ -1124,6 +1144,9 @@ public class CppCompileAction extends AbstractAction | |
// A better long-term solution would be to make the compiler to find them automatically and | |
// never hand in the .pcm files explicitly on the command line in the first place. | |
f.addStrings(compileCommandLine.getArgv(getInternalOutputFile(), null)); | |
+ for (String input : compileCommandLine.getArgv(getInternalOutputFile(), null)) { | |
+ computeKeyDebugWriter.println("COMMAND: " + input); | |
+ } | |
/* | |
* getArgv() above captures all changes which affect the compilation | |
@@ -1133,19 +1156,31 @@ public class CppCompileAction extends AbstractAction | |
* have changed, otherwise we might miss some errors. | |
*/ | |
f.addPaths(context.getDeclaredIncludeDirs()); | |
+ for (PathFragment path : context.getDeclaredIncludeDirs()) { | |
+ computeKeyDebugWriter.println("DECLAREDINCLUDEDIRS: " + path.getPathString()); | |
+ } | |
f.addPaths(context.getDeclaredIncludeWarnDirs()); | |
+ for (PathFragment path : context.getDeclaredIncludeWarnDirs()) { | |
+ computeKeyDebugWriter.println("DECLAREDINCLUDEWARNDIRS: " + path.getPathString()); | |
+ } | |
for (Artifact declaredIncludeSrc : context.getDeclaredIncludeSrcs()) { | |
f.addPath(declaredIncludeSrc.getExecPath()); | |
+ computeKeyDebugWriter.println("DECLAREDINCLUDESRCS: " + declaredIncludeSrc.getExecPath().getPathString()); | |
} | |
f.addInt(0); // mark the boundary between input types | |
for (Artifact input : getMandatoryInputs()) { | |
f.addPath(input.getExecPath()); | |
+ computeKeyDebugWriter.println("MANDATORYINPUTS: " + input.getExecPath().getPathString()); | |
} | |
f.addInt(0); | |
for (Artifact input : prunableInputs) { | |
f.addPath(input.getExecPath()); | |
+ computeKeyDebugWriter.println("PRUNABLEINPUTS: " + input.getExecPath().getPathString()); | |
} | |
- return f.hexDigestAndReset(); | |
+ String rv = f.hexDigestAndReset(); | |
+ computeKeyDebugWriter.println("KEY: " + rv); | |
+ computeKeyDebugWriter.close(); | |
+ return rv; | |
} | |
@Override |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment