-
Notifications
You must be signed in to change notification settings - Fork 24
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
Attempt to fix Future L1 Track SW + bugs in HLS memory classes. #347
Conversation
Strange. This fails git CI because of 2FA authentification issues https://github.com/cms-L1TK/firmware-hls/actions/runs/10853460640/job/30121761689?pr=347 . @aehart the L1Trk CMSSW code in our github cms-L1TK area runs CI in gitlab, and gitlab has a token (which I created) https://gitlab.cern.ch/cms-l1tk/cmssw_CI/-/settings/access_tokens so that it can access our github repo. Our github repo stores this at https://github.com/cms-L1TK/cmssw/settings/secrets/actions . The firmware-hls cms-L1TK github repo has no such tokens https://gitlab.cern.ch/cms-l1tk/firmware-hls/-/settings/access_tokens . But I'd have predicted that this would could 2FA failures for the HLS since Oct. 2023, not just now. |
QUESTIONS/ISSUES:
|
5f7f389
to
bdac786
Compare
Rebased to latest master |
nentries_[ibx*kNBinsRZ+ibin].range(ireg*4+3,ireg*4)=nentry+1; | ||
if (ibin!=0) { | ||
nentries_[ibx*kNBinsRZ+ibin-1].range((ireg+8)*4+3,(ireg+8)*4)=nentry+1; | ||
} | ||
binmask8_[ibx][ibin].set_bit(ireg,true); | ||
nentries_[ibx*kNBinsRZ+ibin].range(ireg*4+3,ireg*4)=nentry+1; | ||
if (ibin!=0) { | ||
nentries_[ibx*kNBinsRZ+ibin-1].range((ireg+8)*4+3,(ireg+8)*4)=nentry+1; | ||
} | ||
binmask8_[ibx][ibin].set_bit(ireg,true); | ||
|
||
//icopy comparison must be signed int or future SW fails | ||
writememloop:for (signed int icopy=0;icopy< (signed) NCP;icopy++) { | ||
//icopy comparison must be signed int or future SW fails | ||
writememloop:for (signed int icopy=0;icopy< (signed) NCP;icopy++) { | ||
#pragma HLS unroll | ||
dataarray_[icopy][ibx][getNEntryPerBin()*slot+nentry] = data; | ||
} | ||
dataarray_[icopy][ibx][getNEntryPerBin()*slot+nentry] = data; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tomalin These changes just seem to affect the indentation, which was already a bit off, and now looks even more off, at least in my text editor. Could you clean this up, perhaps removing tabs altogether and consistently using two spaces to indent lines inside brackets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that the spaces in the HLS code are often created with "tab", and the number of spaces that "tab" corresponds to is not well-defined. It differs on different computers and in different editors/viewing tools. To fix this, we'd really have to globally replace all tabs by spaces, and then run clang to enforce a sensible indentation. And ask people to stop using tabs when editing the HLS code. But this should wait until there are no outstanding PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I completely agree, but I also think we can clean things up as we change other things. Especially with this block of code in particular, where the only changes that have been made are to the indentation, unless I've missed something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do this, but it would mean replacing all tabs with spaces in every line of every file where you've queried my changes to the indentation. And this of course would make it harder during your PR review to spot what I've changed. I suggest I make this change at the end, after I've answered all your non-indentation related comments?
P.S. There are other changes in this file, such as the introduction of "static constexpr unsigned int DEPTH_BX = 1<<NBIT_BX;".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, these indentation comments are the only ones left. The block highlighted here is the most significant example, since the only changes you made, AFAICT, are to the indentation. Some of those changes also don't make sense, like lines 156 and 160 being in different columns now.
I included suggestions for the other blocks I highlighted that you can simply accept if you like, so I hope these comments are fairly trivial to address.
for (size_t icopy=0; icopy < NCP; icopy++) { | ||
for (size_t ibin=0; ibin < kNMemDepth; ibin++) { | ||
dataarray_[icopy][ibx][ibin] = data; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tomalin Same comment regarding indentation.
for (size_t icopy=0; icopy < NCP; icopy++) { | |
for (size_t ibin=0; ibin < kNMemDepth; ibin++) { | |
dataarray_[icopy][ibx][ibin] = data; | |
} | |
for (size_t icopy=0; icopy < NCP; icopy++) { | |
for (size_t ibin=0; ibin < kNMemDepth; ibin++) { | |
dataarray_[icopy][ibx][ibin] = data; | |
} |
//assert(page < NPAGE); | ||
// TODO: check if valid | ||
if(!NBIT_BX) ibx = 0; | ||
return dataarray_[ibx][DEPTH_ADDR*page+index]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tomalin Same comment regarding indentation.
//assert(page < NPAGE); | |
// TODO: check if valid | |
if(!NBIT_BX) ibx = 0; | |
return dataarray_[ibx][DEPTH_ADDR*page+index]; | |
//assert(page < NPAGE); | |
// TODO: check if valid | |
if(!NBIT_BX) ibx = 0; | |
return dataarray_[ibx][DEPTH_ADDR*page+index]; |
nentries_[ibx*NPAGE+page] = 0; | ||
for (size_t addr=0; addr<DEPTH_ADDR; ++addr) { | ||
dataarray_[ibx][DEPTH_ADDR*page+addr] = data; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tomalin Same comment regarding indentation.
nentries_[ibx*NPAGE+page] = 0; | |
for (size_t addr=0; addr<DEPTH_ADDR; ++addr) { | |
dataarray_[ibx][DEPTH_ADDR*page+addr] = data; | |
} | |
nentries_[ibx*NPAGE+page] = 0; | |
for (size_t addr=0; addr<DEPTH_ADDR; ++addr) { | |
dataarray_[ibx][DEPTH_ADDR*page+addr] = data; | |
} |
@@ -209,7 +210,7 @@ class MemoryTemplateTPROJ | |||
|
|||
void print_entry(BunchXingT bx, NEntryT index, unsigned int page = 0) const | |||
{ | |||
print_data(dataarray_[bx][(1<<NBIT_ADDR)*page+index]); | |||
print_data(dataarray_[bx][DEPTH_ADDR*page+index]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tomalin Same comment regarding indentation.
print_data(dataarray_[bx][DEPTH_ADDR*page+index]); | |
print_data(dataarray_[bx][DEPTH_ADDR*page+index]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've replaced all tabs by spaces in MemoryTemplate.h MemoryTemplateBinnedCM.h & MemoryTemplateTPROJ.h , and then adjusted the number of spaces, such that it increases by 2, whenever, there is an additional pair of curly brackets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look good to me. I'll go ahead and merge now, and we should discuss the remaining open questions, perhaps in the next TF FW meeting.
The Future L1Trk CMSSW SW has not yet migrated to the 2FPGA solution. I'm therefore trying to bodge it so it continues to work (for now) with the 1FPGA solution.
Howver, this code inside write_mem_new(), which should protect the memory against having too many entries does nothing, since addr_index is a 1 bit number. This is a BUG. I replaced it by a check that nentries_[ibx] is than than (1<<NBIT_ADDR). However, array access can be slow in FW, so one should check if this causes FW timing errors.
THIS PR NEEDS DISCUSSION WITH @aehart and @aryd BEFORE MERGING.