<div dir="ltr">Thanks so much for the feedback Daniel!<br><br>In fact, I was not in the correct llvm branch. I changed it to the computer branch and also I cloned the <a href="https://github.com/thewilsonator/llvm-target-spirv.git">https://github.com/thewilsonator/llvm-target-spirv.git</a> into llvm/lib/target/SPIRV folder. Is that correct? I could not figure out which is the correct branch for your clang. So I kept the master branch, making sure that it is updated (via git pull) and I started the build process again. Now I have the error below. Do I still have sync issues between the tools? Thanks in advance.<br><br>Marcio<br><br><br>[ 78%] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/CGBuiltin.cpp.o<br>/Users/marcio/clang-spirv/llvm/tools/clang/lib/CodeGen/CGBuiltin.cpp:9769:37: error:<br> no member named 'nvvm_wmma_load_a_f16_col_stride' in namespace<br> 'llvm::Intrinsic'<br> IID = isColMajor ? Intrinsic::nvvm_wmma_load_a_f16_col_stride<br> ~~~~~~~~~~~^<br>/Users/marcio/clang-spirv/llvm/tools/clang/lib/CodeGen/CGBuiltin.cpp:9770:37: error:<br> no member named 'nvvm_wmma_load_a_f16_row_stride' in namespace<br> 'llvm::Intrinsic'<br> : Intrinsic::nvvm_wmma_load_a_f16_row_stride;<br> ~~~~~~~~~~~^<br>/Users/marcio/clang-spirv/llvm/tools/clang/lib/CodeGen/CGBuiltin.cpp:9774:37: error:<br> no member named 'nvvm_wmma_load_b_f16_col_stride' in namespace<br> 'llvm::Intrinsic'<br> IID = isColMajor ? Intrinsic::nvvm_wmma_load_b_f16_col_stride<br> ~~~~~~~~~~~^<br>...<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 1, 2017 at 2:19 PM, Schürmann, Daniel <span dir="ltr"><<a href="mailto:daniel.schuermann@campus.tu-berlin.de" target="_blank">daniel.schuermann@campus.tu-berlin.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div class="m_-5802647067743823055WordSection1">
<p class="MsoNormal">Hi Marcio,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">thanks for your interest!</p>
<p class="MsoNormal">The compilation errors you get seem to result from LLVM and Clang being out of sync.</p>
<p class="MsoNormal">Please stash your changes and<br>
make sure, you are on the llvm compute branch from thewilsonator,</p>
<p class="MsoNormal">(make sure, you also cloned the recursive subproject in target/spirv)</p>
<p class="MsoNormal">remote add and pull/merge upstream.</p>
<p class="MsoNormal">Do the same with my clang fork.<br>
Delete your build folder and try again <span style="font-family:"Segoe UI Emoji",sans-serif">
😊</span></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">If this still doesn’t work, please let me know and I will look tomorrow what is wrong.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Kind regards,</p>
<p class="MsoNormal">Daniel</p>
<p class="MsoNormal"> </p>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="border:none;padding:0cm"><b>Von: </b><a href="mailto:openmp-dev@lists.llvm.org" target="_blank">Marcio Machado Pereira via Openmp-dev</a><br>
<b>Gesendet: </b>Mittwoch, 1. November 2017 16:20<br>
<b>An: </b><a href="mailto:openmp-dev@lists.llvm.org" target="_blank">openmp-dev@lists.llvm.org</a><br>
<b>Betreff: </b>Re: [Openmp-dev] Experimental SPIR-V back-end using OpenCL 2.1</p>
</div>
<p class="MsoNormal"> </p>
</div><div><div class="h5">
<div>
<div dir="ltr">
<div>
<div>Dear Daniel,<br>
<br>
I was very interested in getting to know your work. I realized that a visual inspection is not enough, so I decided to build the tools to inspect how you are generating code for spir-v. I downloaded clang, llvm and openmp indicated by you in the email and start
the build process. It happened that in this process I encountered a series of inconsistencies, and differences in functions signature, etc. I tried to solve them by modifying some of the files I set out below. This allowed me to continue a little, but as the
changes started to require more meaningful changes, I decided to write to you counting with your help. I'm sorry if the email is large but I tried to describe the problems and solution alternatives I used. To facilitate your analysis, I used the git diff tool
that explains my modifications. At the end of the text, I put the final result of the make process in two situations (for 1 thread and 4 threads). I would greatly appreciate feedback from you to complete this build process.
<br>
<br>
Follow the informations:<br>
<br>
==============================<wbr>================<br>
file clang/utils/TableGen/<wbr>ClangAttrEmitter.cpp<br>
==============================<wbr>================<br>
<br>
$ git diff utils/TableGen/<wbr>ClangAttrEmitter.cpp<br>
diff --git a/utils/TableGen/<wbr>ClangAttrEmitter.cpp b/utils/TableGen/<wbr>ClangAttrEmitter.cpp<br>
index effabcc..39ae476 100644<br>
--- a/utils/TableGen/<wbr>ClangAttrEmitter.cpp<br>
+++ b/utils/TableGen/<wbr>ClangAttrEmitter.cpp<br>
@@ -41,6 +41,7 @@<br>
#include <vector><br>
<br>
using namespace llvm;<br>
+using namespace detail;<br>
<br>
namespace {<br>
<br>
@@ -733,20 +734,23 @@ namespace {<br>
};<br>
<br>
// Unique the enums, but maintain the original declaration ordering.<br>
- std::vector<StringRef><br>
- uniqueEnumsInOrder(const std::vector<StringRef> &enums) {<br>
- std::vector<StringRef> uniques;<br>
- SmallDenseSet<StringRef, 8> unique_set;<br>
+ std::vector<std::string><br>
+ uniqueEnumsInOrder(const std::vector<std::string> &enums) {<br>
+ std::vector<std::string> uniques;<br>
+ std::set<std::string> unique_set(enums.begin(), enums.end());<br>
for (const auto &i : enums) {<br>
- if (unique_set.insert(i).second)<br>
+ std::set<std::string>::<wbr>iterator set_i = unique_set.find(i);<br>
+ if (set_i != unique_set.end()) {<br>
uniques.push_back(i);<br>
+ unique_set.erase(set_i);<br>
+ }<br>
}<br>
return uniques;<br>
}<br>
<br>
class EnumArgument : public Argument {<br>
std::string type;<br>
- std::vector<StringRef> values, enums, uniques;<br>
+ std::vector<std::string> values, enums, uniques;<br>
<br>
public:<br>
EnumArgument(const Record &Arg, StringRef Attr)<br>
@@ -866,7 +870,7 @@ namespace {<br>
<br>
class VariadicEnumArgument: public VariadicArgument {<br>
std::string type, QualifiedTypeName;<br>
- std::vector<StringRef> values, enums, uniques;<br>
+ std::vector<std::string> values, enums, uniques;<br>
<br>
protected:<br>
void writeValueImpl(raw_ostream &OS) const override {<br>
@@ -2624,7 +2628,7 @@ void EmitClangAttrPCHWrite(<wbr>RecordKeeper &Records, raw_ostream &OS) {<br>
// append a unique suffix to distinguish this set of target checks from other<br>
// TargetSpecificAttr records.<br>
static void GenerateTargetSpecificAttrChec<wbr>ks(const Record *R,<br>
- <wbr> std::vector<StringRef> &Arches,<br>
+ <wbr> std::vector<std::string> &Arches,<br>
<wbr> std::string &Test,<br>
<wbr> std::string *FnName) {<br>
// It is assumed that there will be an llvm::Triple object<br>
@@ -2649,9 +2653,9 @@ static void GenerateTargetSpecificAttrChec<wbr>ks(const Record *R,<br>
// We know that there was at least one arch test, so we need to and in the<br>
// OS tests.<br>
Test += " && (";<br>
- std::vector<StringRef> OSes = R->getValueAsListOfStrings("<wbr>OSes");<br>
+ std::vector<std::string> OSes = R->getValueAsListOfStrings("<wbr>OSes");<br>
for (auto I = OSes.begin(), E = OSes.end(); I != E; ++I) {<br>
- StringRef Part = *I;<br>
+ std::string Part = *I;<br>
<br>
Test += "T.getOS() == llvm::Triple::";<br>
Test += Part;<br>
@@ -2666,9 +2670,9 @@ static void GenerateTargetSpecificAttrChec<wbr>ks(const Record *R,<br>
// If one or more CXX ABIs are specified, check those as well.<br>
if (!R->isValueUnset("CXXABIs")) {<br>
Test += " && (";<br>
- std::vector<StringRef> CXXABIs = R->getValueAsListOfStrings("<wbr>CXXABIs");<br>
+ std::vector<std::string> CXXABIs = R->getValueAsListOfStrings("<wbr>CXXABIs");<br>
for (auto I = CXXABIs.begin(), E = CXXABIs.end(); I != E; ++I) {<br>
- StringRef Part = *I;<br>
+ std::string Part = *I;<br>
Test += "Target.getCXXABI().getKind() == TargetCXXABI::";<br>
Test += Part;<br>
if (I + 1 != E)<br>
@@ -2708,7 +2712,7 @@ static void GenerateHasAttrSpellingStringS<wbr>witch(<br>
std::string Test;<br>
if (Attr->isSubClassOf("<wbr>TargetSpecificAttr")) {<br>
const Record *R = Attr->getValueAsDef("Target");<br>
- std::vector<StringRef> Arches = R->getValueAsListOfStrings("<wbr>Arches");<br>
+ std::vector<std::string> Arches = R->getValueAsListOfStrings("<wbr>Arches");<br>
GenerateTargetSpecificAttrChec<wbr>ks(R, Arches, Test, nullptr);<br>
<br>
// If this is the C++11 variety, also add in the LangOpts test.<br>
@@ -3360,7 +3364,7 @@ static std::string GenerateTargetRequirements(<wbr>const Record &Attr,<br>
<br>
// Get the list of architectures to be tested for.<br>
const Record *R = Attr.getValueAsDef("Target");<br>
- std::vector<StringRef> Arches = R->getValueAsListOfStrings("<wbr>Arches");<br>
+ std::vector<std::string> Arches = R->getValueAsListOfStrings("<wbr>Arches");<br>
if (Arches.empty()) {<br>
PrintError(Attr.getLoc(), "Empty list of target architectures for a "<br>
"target-specific attr");<br>
@@ -3377,7 +3381,7 @@ static std::string GenerateTargetRequirements(<wbr>const Record &Attr,<br>
const StringRef APK = Attr.getValueAsString("<wbr>ParseKind");<br>
for (const auto &I : Dupes) {<br>
if (I.first == APK) {<br>
- std::vector<StringRef> DA =<br>
+ std::vector<std::string> DA =<br>
I.second->getValueAsDef("<wbr>Target")-><wbr>getValueAsListOfStrings(<br>
"Arches");<br>
Arches.insert(Arches.end(), DA.begin(), DA.end());<br>
@@ -3899,20 +3903,20 @@ void EmitTestPragmaAttributeSupport<wbr>edAttributes(RecordKeeper &Records,<br>
std::vector<Record *> Subjects =<br>
SubjectObj-><wbr>getValueAsListOfDefs("<wbr>Subjects");<br>
OS << " (";<br>
- for (const auto &Subject : llvm::enumerate(Subjects)) {<br>
- if (Subject.index())<br>
+ for (auto Subject : enumerate(Subjects)) {<br>
+ if (Subject.Index)<br>
OS << ", ";<br>
PragmaClangAttributeSupport::<wbr>RuleOrAggregateRuleSet &RuleSet =<br>
- Support.SubjectsToRules.find(<wbr>Subject.value())->getSecond();<br>
+ Support.SubjectsToRules.find(<wbr>Subject.Value)->getSecond();<br>
if (RuleSet.isRule()) {<br>
OS << RuleSet.getRule().<wbr>getEnumValueName();<br>
continue;<br>
}<br>
OS << "(";<br>
- for (const auto &Rule : llvm::enumerate(RuleSet.<wbr>getAggregateRuleSet())) {<br>
- if (Rule.index())<br>
+ for (auto Rule : enumerate(RuleSet.<wbr>getAggregateRuleSet())) {<br>
+ if (Rule.Index)<br>
OS << ", ";<br>
- OS << Rule.value().getEnumValueName(<wbr>);<br>
+ OS << Rule.Value.getEnumValueName();<br>
}<br>
OS << ")";<br>
}<br>
<br>
==============================<wbr>=======================<br>
File clang/utils/TableGen/<wbr>ClangDiagnosticsEmitter.cpp<br>
==============================<wbr>=======================<br>
<br>
$ git diff utils/TableGen/<wbr>ClangDiagnosticsEmitter.cpp<br>
diff --git a/utils/TableGen/<wbr>ClangDiagnosticsEmitter.cpp b/utils/TableGen/<wbr>ClangDiagnosticsEmitter.cpp<br>
index d9d99e0..32f5317 100644<br>
--- a/utils/TableGen/<wbr>ClangDiagnosticsEmitter.cpp<br>
+++ b/utils/TableGen/<wbr>ClangDiagnosticsEmitter.cpp<br>
@@ -1278,7 +1278,7 @@ void EmitClangDiagDocs(RecordKeeper &Records, raw_ostream &OS) {<br>
GroupInfo.SubGroups.size() == 1;<br>
<br>
writeHeader(((IsRemarkGroup ? "-R" : "-W") +<br>
- G->getValueAsString("<wbr>GroupName")).str(),<br>
+ G->getValueAsString("<wbr>GroupName")),<br>
OS);<br>
<br>
if (!IsSynonym) {<br>
<br>
==============================<wbr>=====================<br>
File clang/utils/TableGen/<wbr>ClangOptionDocEmitter.cpp<br>
==============================<wbr>=====================<br>
<br>
$ git diff utils/TableGen/<wbr>ClangOptionDocEmitter.cpp<br>
diff --git a/utils/TableGen/<wbr>ClangOptionDocEmitter.cpp b/utils/TableGen/<wbr>ClangOptionDocEmitter.cpp<br>
index 5931451..7e6566c 100644<br>
--- a/utils/TableGen/<wbr>ClangOptionDocEmitter.cpp<br>
+++ b/utils/TableGen/<wbr>ClangOptionDocEmitter.cpp<br>
@@ -229,7 +229,7 @@ std::string getRSTStringWithTextFallback(<wbr>const Record *R, StringRef Primary,<br>
}<br>
<br>
void emitOptionWithArgs(StringRef Prefix, const Record *Option,<br>
- ArrayRef<StringRef> Args, raw_ostream &OS) {<br>
+ ArrayRef<std::string> Args, raw_ostream &OS) {<br>
OS << Prefix << escapeRST(Option-><wbr>getValueAsString("Name"));<br>
<br>
std::pair<StringRef, StringRef> Separators =<br>
@@ -261,7 +261,7 @@ void emitOptionName(StringRef Prefix, const Record *Option, raw_ostream &OS) {<br>
}<br>
}<br>
<br>
- emitOptionWithArgs(Prefix, Option, std::vector<StringRef>(Args.<wbr>begin(), Args.end()), OS);<br>
+ emitOptionWithArgs(Prefix, Option, std::vector<std::string>(Args.<wbr>begin(), Args.end()), OS);<br>
<br>
auto AliasArgs = Option-><wbr>getValueAsListOfStrings("<wbr>AliasArgs");<br>
if (!AliasArgs.empty()) {<br>
@@ -311,7 +311,7 @@ void emitOption(const DocumentedOption &Option, const Record *DocInfo,<br>
forEachOptionName(Option, DocInfo, [&](const Record *Option) {<br>
for (auto &Prefix : Option-><wbr>getValueAsListOfStrings("<wbr>Prefixes"))<br>
SphinxOptionIDs.push_back(<br>
- getSphinxOptionID((Prefix + Option->getValueAsString("<wbr>Name")).str()));<br>
+ getSphinxOptionID((Prefix + Option->getValueAsString("<wbr>Name"))));<br>
});<br>
assert(!SphinxOptionIDs.empty(<wbr>) && "no flags for option");<br>
static std::map<std::string, int> NextSuffix;<br>
<br>
==============================<wbr>===================<br>
file llvm/include/llvm/Support/<wbr>SpecialCaseList.h:<br>
==============================<wbr>===================<br>
<br>
$ git diff include/llvm/Support/<wbr>SpecialCaseList.h<br>
diff --git a/include/llvm/Support/<wbr>SpecialCaseList.h b/include/llvm/Support/<wbr>SpecialCaseList.h<br>
index ce693c5..dc8532c 100644<br>
--- a/include/llvm/Support/<wbr>SpecialCaseList.h<br>
+++ b/include/llvm/Support/<wbr>SpecialCaseList.h<br>
@@ -82,12 +82,14 @@ public:<br>
bool inSection(StringRef Section, StringRef Query,<br>
StringRef Category = StringRef()) const;<br>
<br>
-private:<br>
+<br>
+protected:<br>
SpecialCaseList(<wbr>SpecialCaseList const &) = delete;<br>
SpecialCaseList &operator=(SpecialCaseList const &) = delete;<br>
<br>
struct Entry;<br>
- StringMap<StringMap<Entry>> Entries;<br>
+ using SectionEntries = StringMap<StringMap<Entry>>;<br>
+ SectionEntries Entries;<br>
StringMap<StringMap<std::<wbr>string>> Regexps;<br>
bool IsCompiled;<br>
<br>
<br>
<br>
<br>
=================<br>
Last compilation:<br>
=================<br>
<br>
$make<br>
...<br>
Scanning dependencies of target clangBasic<br>
[ 68%] Building CXX object tools/clang/lib/Basic/<wbr>CMakeFiles/clangBasic.dir/<wbr>SanitizerBlacklist.cpp.o<br>
[ 68%] Building CXX object tools/clang/lib/Basic/<wbr>CMakeFiles/clangBasic.dir/<wbr>SanitizerSpecialCaseList.cpp.o<br>
/Users/marcio/clang-spirv/<wbr>llvm/tools/clang/lib/Basic/<wbr>SanitizerSpecialCaseList.cpp:<wbr>23:13: error:<br>
no member named 'createInternal' in 'clang::<wbr>SanitizerSpecialCaseList'<br>
if (SSCL->createInternal(Paths, Error)) {<br>
~~~~ ^<br>
/Users/marcio/clang-spirv/<wbr>llvm/tools/clang/lib/Basic/<wbr>SanitizerSpecialCaseList.cpp:<wbr>39:18: error:<br>
use of undeclared identifier 'Sections'; did you mean 'inSection'?<br>
for (auto &S : Sections) {<br>
^~~~~~~~<br>
inSection<br>
/Users/marcio/clang-spirv/<wbr>llvm/tools/clang/include/<wbr>clang/Basic/<wbr>SanitizerSpecialCaseList.h:34:<wbr>8: note:<br>
'inSection' declared here<br>
bool inSection(SanitizerMask Mask, StringRef Prefix, StringRef Query,<br>
^<br>
/Users/marcio/clang-spirv/<wbr>llvm/tools/clang/lib/Basic/<wbr>SanitizerSpecialCaseList.cpp:<wbr>39:18: error:<br>
reference to non-static member function must be called<br>
for (auto &S : Sections) {<br>
^~~~~~~~<br>
/Users/marcio/clang-spirv/<wbr>llvm/tools/clang/lib/Basic/<wbr>SanitizerSpecialCaseList.cpp:<wbr>60:62: error:<br>
too many arguments to function call, expected at most 3, have 4<br>
SpecialCaseList::inSection(S.<wbr>Entries, Prefix, Query, Category))<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~ <wbr> ^~~~~~~~<br>
/Users/marcio/clang-spirv/<wbr>llvm/include/llvm/Support/<wbr>SpecialCaseList.h:82:3: note:<br>
'inSection' declared here<br>
bool inSection(StringRef Section, StringRef Query,<br>
^<br>
4 errors generated.<br>
make[2]: *** [tools/clang/lib/Basic/<wbr>CMakeFiles/clangBasic.dir/<wbr>SanitizerSpecialCaseList.cpp.<wbr>o] Error 1<br>
make[1]: *** [tools/clang/lib/Basic/<wbr>CMakeFiles/clangBasic.dir/all] Error 2<br>
make: *** [all] Error 2<br>
<br>
<br>
$make -j4<br>
...<br>
[ 12%] Updating AttributesCompatFunc.inc...<br>
[ 12%] Built target AttributeCompatFuncTableGen<br>
/Users/marcio/clang-spirv/<wbr>llvm/tools/clang/include/<wbr>clang/Driver/Options.td:514:<wbr>57: [ 12%] Updating Attributes.gen...<br>
error: Couldn't find class 'Values'<br>
HelpText<"OpenCL language standard to compile for.">, Values<"cl,CL,cl1.1,CL1.1,cl1.<wbr>2,CL1.2,cl2.0,CL2.0">;<br>
<wbr> ^<br>
make[2]: *** [tools/clang/include/clang/<wbr>Driver/Options.inc.tmp] Error 1<br>
make[1]: *** [tools/clang/include/clang/<wbr>Driver/CMakeFiles/<wbr>ClangDriverOptions.dir/all] Error 2<br>
make[1]: *** Waiting for unfinished jobs....<br>
[ 12%] Updating Intrinsics.gen...<br>
[ 12%] Built target intrinsics_gen<br>
[ 12%] Built target llvm-mcmarkup<br>
[ 12%] Built target llvm-cxxfilt<br>
make: *** [all] Error 2<br>
<br>
</div>
Cheers,<br>
</div>
Marcio<br>
<br>
<div>
<div><br>
<br>
</div>
</div>
</div>
</div>
</div></div></div>
</blockquote></div><br></div>