Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CXXFLAGS from CMSSW #304

Merged
merged 6 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions TestBenches/InputRouter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,11 @@ CablingMap getMap( std::string pInputWiresMap )
// read line
// and look for connections where
// VMR is the output
bool cFoundInputLink=false;

std::string cInputLink = "";
std::string cVMRMemory = "";
while (cStream >> cToken)
{
if( cPrevToken.find("input") != std::string::npos
&& cToken.find("output") != std::string::npos )
{
cFoundInputLink = true;
}

if( cPrevToken.find("output") != std::string::npos
&& cToken.find("VMR") != std::string::npos )
{
Expand Down Expand Up @@ -168,18 +161,11 @@ DtcMap getCablingMap( std::string pInputWiresMap )
// read line
// and look for connections where
// VMR is the output
bool cFoundInputLink=false;

std::string cInputLink = "";
std::string cVMRMemory = "";
while (cStream >> cToken)
{
if( cPrevToken.find("input") != std::string::npos
&& cToken.find("output") != std::string::npos )
{
cFoundInputLink = true;
}

if( cPrevToken.find("output") != std::string::npos
&& cToken.find("VMR") != std::string::npos )
{
Expand Down Expand Up @@ -454,8 +440,8 @@ ap_uint<kLINKMAPwidth> getLnkWrd(CablingMap pDtcMap
}
void decodeLnkWrd(ap_uint<kLINKMAPwidth> pLnkWrd)
{
int cNlyrs = pLnkWrd.range( kLINKMAPwidth-1, kLINKMAPwidth-1-(3-1));
int cIs2S = pLnkWrd.range(kLINKMAPwidth-4,kLINKMAPwidth-4);
unsigned int cNlyrs = pLnkWrd.range( kLINKMAPwidth-1, kLINKMAPwidth-1-(3-1));
unsigned int cIs2S = pLnkWrd.range(kLINKMAPwidth-4,kLINKMAPwidth-4);
std::cout << "LnkWrd 0x"
<< std::hex << int(pLnkWrd) << std::dec
<< "\t..."
Expand Down Expand Up @@ -497,7 +483,7 @@ void prepareInputStreams( ifstream * pInputStreams
auto hLinkWord = getLnkWrd(pDtcMap,pLinkId);
int cMemIndx=0;
std::vector<uint8_t> cLyrs = getLyrs( pDtcMap , pLinkId );
for(int cLyrIndx=0; cLyrIndx< cLyrs.size(); cLyrIndx++)
for(unsigned int cLyrIndx=0; cLyrIndx< cLyrs.size(); cLyrIndx++)
{
ap_uint<kSizeLinkWord> hWrd = hLinkWord.range(kSizeLinkWord*cLyrIndx+kSizeLinkWord-1,kSizeLinkWord*cLyrIndx);
//if( hWrd == 0) continue;
Expand Down
1 change: 0 additions & 1 deletion TestBenches/MatchCalculator_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ int main()

// compare the computed outputs with the expected ones
for (unsigned int i = 0; i < fullmatch_names.size(); i++) {
const auto &fullmatch_name = fullmatch_names.at(i);
auto &fout = fout_fullmatch.at(i);
string label = "FullMatch " + to_string(i);
err += compareMemWithFile<FullMatchMemory<fmProjMemType> >
Expand Down
3 changes: 0 additions & 3 deletions TestBenches/MatchEngine_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
#include "FileReadUtility.h"
#include "Macros.h"

// HLS Headers
#include "hls_math.h"

// STL Headers
#include <iostream>
#include <fstream>
Expand Down
1 change: 0 additions & 1 deletion TestBenches/MatchProcessor_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ int main()

// compare the computed outputs with the expected ones
for (unsigned int i = 0; i < fullmatch_names.size(); i++) {
const auto &fullmatch_name = fullmatch_names.at(i);
auto &fout = fout_fullmatch.at(i);
string label = "FullMatch " + to_string(i);
err += compareMemWithFile<FullMatchMemory<fmProjMemType> >
Expand Down
1 change: 0 additions & 1 deletion TestBenches/ProjectionRouter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ int main()
err += compareMemWithFile<AllProjectionMemory<projMemType> >(allproj, fout_aproj.at(0), ievt, "AllProjection", truncation);

for (unsigned int i = 0; i < vmproj_names.size(); i++) {
const auto &vmproj_name = vmproj_names.at(i);
auto &fout = fout_vmproj.at(i);
string label = "VMProjection " + to_string(i);
err += compareMemWithFile<VMProjectionMemory<vmProjMemType> >
Expand Down
36 changes: 18 additions & 18 deletions TestBenches/TrackBuilder_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,29 @@ using namespace std;
#endif

#if SEED_ == L1L2_
constexpr unsigned kNBarrelStubs = 4;
constexpr unsigned kNDiskStubs = 4;
constexpr int kNBarrelStubs = 4;
constexpr int kNDiskStubs = 4;
#elif SEED_ == L2L3_
constexpr unsigned kNBarrelStubs = 3;
constexpr unsigned kNDiskStubs = 4;
constexpr int kNBarrelStubs = 3;
constexpr int kNDiskStubs = 4;
#elif SEED_ == L3L4_
constexpr unsigned kNBarrelStubs = 4;
constexpr unsigned kNDiskStubs = 2;
constexpr int kNBarrelStubs = 4;
constexpr int kNDiskStubs = 2;
#elif SEED_ == L5L6_
constexpr unsigned kNBarrelStubs = 4;
constexpr unsigned kNDiskStubs = 0;
constexpr int kNBarrelStubs = 4;
constexpr int kNDiskStubs = 0;
#elif SEED_ == D1D2_
constexpr unsigned kNBarrelStubs = 2;
constexpr unsigned kNDiskStubs = 3;
constexpr int kNBarrelStubs = 2;
constexpr int kNDiskStubs = 3;
#elif SEED_ == D3D4_
constexpr unsigned kNBarrelStubs = 1;
constexpr unsigned kNDiskStubs = 3;
constexpr int kNBarrelStubs = 1;
constexpr int kNDiskStubs = 3;
#elif SEED_ == L1D1_
constexpr unsigned kNBarrelStubs = 0;
constexpr unsigned kNDiskStubs = 4;
constexpr int kNBarrelStubs = 0;
constexpr int kNDiskStubs = 4;
#elif SEED_ == L2D1_
constexpr unsigned kNBarrelStubs = 1;
constexpr unsigned kNDiskStubs = 3;
constexpr int kNBarrelStubs = 1;
constexpr int kNDiskStubs = 3;
#else
# error "Undefined seed"
#endif
Expand Down Expand Up @@ -138,9 +138,9 @@ int main()
// Clear all output memories before starting.
for (unsigned short i = 0; i < kMaxProc; i++) {
trackWord[i] = TrackFit_t::TrackWord(0);
for (unsigned short j = 0; j < kNBarrelStubs; j++)
for (short j = 0; j < kNBarrelStubs; j++)
barrelStubWords[j][i] = TrackFit_t::BarrelStubWord(0);
for (unsigned short j = 0; j < kNDiskStubs; j++)
for (short j = 0; j < kNDiskStubs; j++)
diskStubWords[j][i] = TrackFit_t::DiskStubWord(0);
}
tracksMem.clear();
Expand Down
13 changes: 5 additions & 8 deletions TestBenches/VMRouterCM_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ const int nEvents = 100; //number of events to run

int main() {

constexpr int sector = 4; // Specifies the sector/nonant

////////////////////////////////////////////////////////////////
// Get the test vectors

Expand All @@ -49,7 +47,6 @@ int main() {

const auto nASCopies = tb.nFiles(allStubPattern);
const auto nASInnerCopies = tb.nFiles(allStubInnerPattern);
const auto nVMSME = tb.nFiles(mePattern);
const auto nVMSTE = tb.nFiles(tePattern);

// Make sure that the number of input and output memories are correct
Expand Down Expand Up @@ -93,25 +90,25 @@ int main() {
cout << "Event: " << dec << ievt << endl;

// Clear output memories
for (int i=0; i<nASCopies; ++i) {
for (unsigned int i=0; i<nASCopies; ++i) {
memoriesAS[i].clear();
}
for (int i=0; i<nASInnerCopies; ++i) {
for (unsigned int i=0; i<nASInnerCopies; ++i) {
memoriesASInner[i].clear();
}
memoryME.clear();
if (nVMSTE) {
for (int i=0; i<nVMSTE; ++i) {
for (unsigned int i=0; i<nVMSTE; ++i) {
memoriesTEO[i].clear();
}

}

// Read event and write to memories
for (unsigned int i = 0; i < numInputs; i++) {
for (int i = 0; i < numInputs; i++) {
writeMemFromFile<InputStubMemory<inputType>>(inputStubs[i], fin_inputstubs[i], ievt);
}
for (unsigned int i = 0; i < numInputsDisk2S; i++) {
for (int i = 0; i < numInputsDisk2S; i++) {
writeMemFromFile<InputStubMemory<DISK2S>>(inputStubsDisk2S[i], fin_inputstubs_disk2s[i], ievt);
}

Expand Down
15 changes: 7 additions & 8 deletions TestBenches/VMRouter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ using namespace std;
const int nEvents = 100; //number of events to run

// Count the number of copies of each memory in a file name vector
vector<int> countCopies(const vector<string> &fileNames) {
vector<int> numCopies; // Each element in vector corresponds to one memory, i.e. L1PHIE17
vector<unsigned> countCopies(const vector<string> &fileNames) {
vector<unsigned> numCopies; // Each element in vector corresponds to one memory, i.e. L1PHIE17
string fileName = "temporary file name";
// Loop over all file names
for (auto f = fileNames.begin(); f != fileNames.end(); ++f) {
Expand All @@ -42,7 +42,6 @@ vector<int> countCopies(const vector<string> &fileNames) {

int main() {

constexpr int sector = 4; // Specifies the sector
constexpr char phi = 'A' + phiRegion; // Converts phiRegion to char

char overlapPhiRegion[] = {'X', 'Y', 'Z', 'W', 'Q', 'R', 'S', 'T'}; // Special naming for the TE overlap memories, and outer memories in Disk 1
Expand Down Expand Up @@ -89,7 +88,7 @@ int main() {
auto &fout_vmstubteo = tb.files(teoPattern);

// Get the number of copies for each TE memory
vector<int> zero = {0};
vector<unsigned> zero = {0};
auto numCopiesTEI = (nTotVMSTEI) ? countCopies(tb.fileNames(teiPattern)) : zero;
auto numCopiesOL = (nTotVMSTEOL) ? countCopies(tb.fileNames(teolPattern)) : zero;
auto numCopiesTEO = (nTotVMSTEO) ? countCopies(tb.fileNames(teoPattern)) : zero;
Expand Down Expand Up @@ -148,7 +147,7 @@ int main() {
for (unsigned int i = 0; i < numInputs; i++) {
writeMemFromFile<InputStubMemory<inputType>>(inputStubs[i], fin_inputstubs[i], ievt);
}
for (unsigned int i = 0; i < numInputsDisk2S; i++) {
for (int i = 0; i < numInputsDisk2S; i++) {
writeMemFromFile<InputStubMemory<DISK2S>>(inputStubsDisk2S[i], fin_inputstubs_disk2s[i], ievt);
}

Expand Down Expand Up @@ -194,7 +193,7 @@ int main() {

// TE Inner Memories
if (nTotVMSTEI) {
int k = 0;
unsigned int k = 0;
for (unsigned int i = 0; i < nvmTEI; i++) {
for (unsigned int j = 0; j < numCopiesTEI[i]; j++) {
if (k >= nTotVMSTEI) break;
Expand All @@ -206,7 +205,7 @@ int main() {

// TE Inner Overlap memories
if (nTotVMSTEOL) {
int k = 0;
unsigned int k = 0;
for (unsigned int i = 0; i < nvmOL; i++) {
for (unsigned int j = 0; j < numCopiesOL[i]; j++) {
if (k >= nTotVMSTEOL) break;
Expand All @@ -218,7 +217,7 @@ int main() {

// TE Outer memories
if (nTotVMSTEO) {
int k = 0;
unsigned int k = 0;
for (unsigned int i = 0; i < nvmTEO; i++) {
for (unsigned int j = 0; j < numCopiesTEO[i]; j++) {
if (k >= nTotVMSTEO) break;
Expand Down
4 changes: 2 additions & 2 deletions TrackletAlgorithm/InputRouter.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ void ClearCounters(unsigned int nMemories
#pragma HLS inline
#pragma HLS array_partition variable = nEntries complete
LOOP_ClearCounters:
for (int cIndx = 0; cIndx < nEntriesSize ; cIndx++)
for (unsigned int cIndx = 0; cIndx < nEntriesSize ; cIndx++)
{
#pragma HLS unroll
nEntries[cIndx]=0;
Expand All @@ -225,7 +225,7 @@ void CountMemories(const ap_uint<kBINMAPwidth> hPhBnWord
#pragma HLS array_partition variable = nMemsPerLyr complete
int cPrevSize=0;
LOOP_CountOutputMemories:
for (int cLyr = 0; cLyr < kMaxLyrsPerDTC ; cLyr++)
for (unsigned int cLyr = 0; cLyr < kMaxLyrsPerDTC ; cLyr++)
{
#pragma HLS unroll
//auto hBnWrd = hPhBnWord.range(kSizeBinWord * cLyr + (kSizeBinWord-1), kSizeBinWord * cLyr);
Expand Down
11 changes: 0 additions & 11 deletions TrackletAlgorithm/MatchCalculator.h
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,6 @@ void MatchCalculator(BXType bx,
// Full match shift register to store best match
typename AllProjection<APTYPE>::AProjTCSEED projseed;
FullMatch<FMTYPE> bestmatch;
bool goodmatch = false;

ap_uint<1> inc_fm = 1;

Expand Down Expand Up @@ -846,14 +845,6 @@ void MatchCalculator(BXType bx,
bool vB_L3_next = false;
bool sA_L3_next = false;
bool sB_L3_next = false;
bool read1_next = false;
bool read2_next = false;
bool read3_next = false;
bool read4_next = false;
bool read5_next = false;
bool read6_next = false;
bool read7_next = false;
bool read8_next = false;
bool read_next[8];
read_next_loop: for(int i = 0; i < totalMatchCopies; ++i) { // priority encoder ALWAYS expects 8
#pragma HLS unroll
Expand Down Expand Up @@ -1104,7 +1095,6 @@ void MatchCalculator(BXType bx,
typename AllProjection<APTYPE>::AProjRZ proj_z = proj.getRZ();
typename AllProjection<APTYPE>::AProjPHIDER proj_phid = proj.getPhiDer();
typename AllProjection<APTYPE>::AProjRZDER proj_zd = proj.getRZDer();
bool isProjDisk = proj_seed >= TF::D1;


// Calculate residuals
Expand Down Expand Up @@ -1270,7 +1260,6 @@ void MatchCalculator(BXType bx,

// pipeline the bestmatch registers
bestmatch = bestmatch_next;
goodmatch = goodmatch_next;
projseed = projseed_next;

}// end MC_LOOP
Expand Down
4 changes: 2 additions & 2 deletions TrackletAlgorithm/MatchProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ void MatchProcessor(BXType bx,
ap_uint<1> table[kNMatchEngines][LAYER<TF::D1 ? (LAYER<TF::L4 ? 256 : 512) : 768]; //FIXME Need to figure out how to replace 256 with meaningful const.
//Use of dim=0 seems to have small improvement on timing - not sure why
#pragma HLS ARRAY_PARTITION variable=table dim=0 complete
readtable: for(int iMEU = 0; iMEU < kNMatchEngines; ++iMEU) {
readtable: for(unsigned int iMEU = 0; iMEU < kNMatchEngines; ++iMEU) {
#pragma HLS unroll
readTable<LAYER>(table[iMEU]);
}
Expand Down Expand Up @@ -1318,7 +1318,7 @@ void MatchProcessor(BXType bx,

bool anyidle = false;

MEU_get_trkids: for(int iMEU = 0; iMEU < kNMatchEngines; ++iMEU) {
MEU_get_trkids: for(unsigned int iMEU = 0; iMEU < kNMatchEngines; ++iMEU) {
#pragma HLS unroll
matchengine[iMEU].set_empty();
idles[iMEU] = matchengine[iMEU].idle();
Expand Down
6 changes: 3 additions & 3 deletions TrackletAlgorithm/ProjectionRouter.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ void ProjectionRouter(BXType bx,
ap_uint<kNBits_MemAddr> numbersin[nINMEM];
ap_uint<kNBits_MemAddr> mem_read_addr;

PROC_LOOP: for (int istep = 0; istep < kMaxProc - kMaxProcOffset(module::PR); ++istep) {
PROC_LOOP: for (unsigned int istep = 0; istep < kMaxProc - kMaxProcOffset(module::PR); ++istep) {
#pragma HLS PIPELINE II=1 rewind
if (istep == 0) {

// reset output memories & counters
nallproj = 0;
#pragma HLS ARRAY_PARTITION variable=nvmprojout complete dim=0
for (int i=0; i<nOUTMEM; i++) {
for (unsigned int i=0; i<nOUTMEM; i++) {
#pragma HLS unroll
nvmprojout[i] = 0;
}
Expand All @@ -98,7 +98,7 @@ void ProjectionRouter(BXType bx,
// fill the bit mask indicating if memories are empty or not
mem_hasdata = 0;
#pragma HLS ARRAY_PARTITION variable=numbersin complete dim=0
for (int i=0; i<nINMEM; i++) {
for (unsigned int i=0; i<nINMEM; i++) {
#pragma HLS unroll
numbersin[i] = projin[i].getEntries(bx);
if (numbersin[i] > 0) mem_hasdata.set(i);
Expand Down
Loading