CMPT 489 Project
Introduction
The project will be based on the IDISA library. This library is provides a model for SIMD focussed programming that is compatible with all platforms. The main objectives in this project are to Identify the overrides that have been implemented and what they solved in terms of pure IR solutions, Identify areas that require further development and for each case propose a modification.
Example
The esimd_mergeh and the esimd_mergel both have a version override. Below is the code snippets for the esimd_mergeh function on the avx builder and default builder.
idisa_avx_builder.cpp
Value * IDISA_AVX2_Builder::esimd_mergeh(unsigned fw, Value * a, Value * b) {
#if LLVM_VERSION_INTEGER < LLVM_VERSION_CODE(6, 0, 0)
if ((fw == 128) && (mBitBlockWidth == 256)) {
Value * vperm2i128func = Intrinsic::getDeclaration(getModule(), Intrinsic::x86_avx2_vperm2i128);
return CreateCall(vperm2i128func, {fwCast(64, a), fwCast(64, b), getInt8(0x31)});
}
#endif
// Otherwise use default SSE logic.
return IDISA_SSE_Builder::esimd_mergeh(fw, a, b);
}
idisa_builder.cpp
Value * IDISA_Builder::esimd_mergeh(unsigned fw, Value * a, Value * b) {
if (fw < 8) report_fatal_error("Unsupported field width: mergeh " + std::to_string(fw));
const auto field_count = mBitBlockWidth / fw;
Constant * Idxs[field_count];
for (unsigned i = 0; i < field_count / 2; i++) {
Idxs[2 * i] = getInt32(i + field_count / 2); // selects elements from first reg.
Idxs[2 * i + 1] = getInt32(i + field_count / 2 + field_count); // selects elements from second reg.
}
return CreateShuffleVector(fwCast(fw, a), fwCast(fw, b), ConstantVector::get({Idxs, field_count}));
}
From here we can see that a change was implemented in llvm 6.0.0 that requires to be addressed through the override. Removing the override and using the testRE option of icgrep we compare the difference in the IR code generated. In total there are 388 different lines of code generated between icgrep with and without the override.
This is the type of modification that I am looking for with this project. Modifications that address version changes in terms of efficiency and compatibility.
Refference
" IDISA Toolkit Project." IDISAproject - Parabix, parabix.costar.sfu.ca/wiki/IDISAproject.