-
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
Optimize MP for CMSSW CPU resources #351
base: master
Are you sure you want to change the base?
Conversation
@@ -28,9 +28,28 @@ static bool nearFullUnitBool(ap_uint<kNBitsBuffer> rptr, ap_uint<kNBitsBuffer> w | |||
return wptr1==rptr || wptr2==rptr; | |||
} | |||
|
|||
template<int kNBitsBuffer> | |||
class nearFull3Class { |
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.
CMS coding rules state that class names should start with a capital letter, whereas variable and function names should start with a lower case letter.
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.
Sorry I didn't get to these sooner. I've changed the names. Let me know if I missed anything.
@@ -80,6 +99,22 @@ static bool nearFull4UnitBool(ap_uint<kNBitsBuffer> rptr, ap_uint<kNBitsBuffer> | |||
return wptr1==rptr || wptr2==rptr || wptr3==rptr || wptr4==rptr; | |||
} | |||
|
|||
template<int kNBitsBuffer> | |||
class emptyUnitClass { |
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.
CMS coding rules state that class names should start with a capital letter, whereas variable and function names should start with a lower case letter.
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.
Fixed
TrackletAlgorithm/MatchEngineUnit.h
Outdated
@@ -282,7 +282,9 @@ inline void step(const VMStub<VMSType> stubmem[4][1<<(kNbitsrzbinMP+kNbitsphibin | |||
#endif | |||
|
|||
inline void set_empty() { | |||
empty_ = emptyUnit<MatchEngineUnitBase<VMProjType>::kNBitsBuffer>()[(readindex_,writeindex_)]; | |||
static const emptyUnitClass<MatchEngineUnitBase<VMProjType>::kNBitsBuffer> EmptyUnitClass; |
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.
CMS coding rules state that class names should start with a capital letter, whereas variable and function names should start with a lower case letter.
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.
Fixed
TrackletAlgorithm/MatchEngineUnit.h
Outdated
@@ -291,7 +293,9 @@ inline void step(const VMStub<VMSType> stubmem[4][1<<(kNbitsrzbinMP+kNbitsphibin | |||
} | |||
|
|||
inline bool nearFull() { | |||
return nearFull3Unit<MatchEngineUnitBase<VMProjType>::kNBitsBuffer>()[(readindex_,writeindex_)]; | |||
static const nearFull3Class<MatchEngineUnitBase<VMProjType>::kNBitsBuffer> NearFull3Class; |
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.
CMS coding rules state that class names should start with a capital letter, whereas variable and function names should start with a lower case letter.
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.
Fixed
This looks good to me, aside from the minor style comments above. We've not been able to test the CPU performance, as recent changes to the HLS L1Trk repo broke the Future SW again, but logically it should fix the problem. |
This seems like an improvement, but is there a reason for not simply declaring the existing LUTs as
The only thing missing would be logic to prevent reinitializing the LUT after the first call. As it stands, multiple objects of these new wrapper classes can be declared, each of which will initialize the exact same LUT. In fact, I guess this happens, since objects of these classes are declared in |
@tomalin suggested the wrapper class to prevent CMSSW from recomputing the LUTs for every event. Things were set to static before and that didn't seem to be enough. |
I see that the existing LUT functions have |
Good point. I had tried so many variations that didn't compile. Let me double check if that works. |
This PR addresses an issue where CMSSW wastes CPU cycles for emptyUnit and nearFull3Unit. They are not loaded in static classes, and should only be initialized once.