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

PIMbench Min/max Reduce API #190

Open
wants to merge 47 commits into
base: main
Choose a base branch
from
Open

PIMbench Min/max Reduce API #190

wants to merge 47 commits into from

Conversation

yanhanBazoooka
Copy link
Collaborator

Implemented min/max reduce and added pimCmdReduction for sum min max all in one. (ideally).

libpimeval/src/pimCmd.h Outdated Show resolved Hide resolved
libpimeval/src/pimCmd.h Outdated Show resolved Hide resolved
libpimeval/src/pimCmd.cpp Outdated Show resolved Hide resolved
libpimeval/src/pimCmd.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@deyuan deyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code needs to be merged with the latest main branch

@yanhanBazoooka
Copy link
Collaborator Author

I tired to fix the unspecified error by casting float to pimRedMax/Min execution. (since we are using void* unlike specified types from redSum implementation.) Feels a bit dangerous. Also, the major blocker is that I can't figure out why I'm having error: ‘pimCmdRedSum’ was not declared in this scope; did you mean ‘pimRedSum’? This is from redSum but I didn't change the redSum implementation. As this is currently the only error that I'm having.

@fasiddique fasiddique changed the title [Draft] PIMbench Min/max Reduce API PIMbench Min/max Reduce API Dec 2, 2024
Copy link
Collaborator

@deyuan deyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the new code design. Thanks for the effort!
I haven't reviewed all details, but I left some comments for further improvements.

Comment on lines 756 to 757
if (idxBegin != idxEnd && idxBegin < idxEnd) pimPerfMon perfMon("pimRedMinRanged");
else pimPerfMon perfMon("pimRedMin");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (idxBegin != idxEnd && idxBegin < idxEnd) pimPerfMon perfMon("pimRedMinRanged");
else pimPerfMon perfMon("pimRedMin");
std::string tag = (idxBegin != idxEnd && idxBegin < idxEnd) ? "pimRedMinRanged" : "pimRedMin";
pimPerfMon perfMon(tag);

Please note that pimPerfMon is an on-stack object and its ctor-to-dtor lifetime needs to cover entire operation.

Comment on lines 805 to 806
if (idxBegin != idxEnd && idxBegin < idxEnd) pimPerfMon perfMon("pimRedMaxRanged");
else pimPerfMon perfMon("pimRedMax");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (idxBegin != idxEnd && idxBegin < idxEnd) pimPerfMon perfMon("pimRedMaxRanged");
else pimPerfMon perfMon("pimRedMax");
std::string tag = (idxBegin != idxEnd && idxBegin < idxEnd) ? "pimRedMaxRanged" : "pimRedMax";
pimPerfMon perfMon(tag);

Comment on lines 855 to 856
if (idxBegin != idxEnd && idxBegin < idxEnd) pimPerfMon perfMon("pimRedSumRanged");
else pimPerfMon perfMon("pimRedSum");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (idxBegin != idxEnd && idxBegin < idxEnd) pimPerfMon perfMon("pimRedSumRanged");
else pimPerfMon perfMon("pimRedSum");
std::string tag = (idxBegin != idxEnd && idxBegin < idxEnd) ? "pimRedSumRanged" : "pimRedSum";
pimPerfMon perfMon(tag);

Comment on lines +16 to +26
#include "pimCmd.h"
#include "pimSim.h"
#include "pimDevice.h"
#include "pimCore.h"
#include "pimResMgr.h"
#include <cstdio>
#include <cmath>
#include <unordered_map>
#include <unordered_set>
#include <climits>
#include <cmath>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#include "pimCmd.h"
#include "pimSim.h"
#include "pimDevice.h"
#include "pimCore.h"
#include "pimResMgr.h"
#include <cstdio>
#include <cmath>
#include <unordered_map>
#include <unordered_set>
#include <climits>
#include <cmath>
#include <cmath>
#include <climits>

}
}
currIdx += 1;
}
return true;
}

//! @brief PIM CMD: redsum non-ranged/ranged - update stats
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this deletion

libpimeval/src/pimCmd.h Show resolved Hide resolved
{
// Reduction tree approach for min/max
unsigned levels = static_cast<unsigned>(std::ceil(std::log2(numElements))); // Tree depth
pimeval::perfEnergy perfEnergyBS = getPerfEnergyBitSerial(m_simTarget, PimCmdEnum::MIN, dataType, bitsPerElement, numPass, obj);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add an entry for reduction Min/Max in the bitserial table and then cmdType should be passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants