-
Notifications
You must be signed in to change notification settings - Fork 1
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
Triton data converter (CMSSW_11_2_0_pre9) #2
base: master
Are you sure you want to change the base?
Triton data converter (CMSSW_11_2_0_pre9) #2
Conversation
HeterogeneousCore/SonicTriton/plugins/converters/FloatApFixed16Converter.cc
Outdated
Show resolved
Hide resolved
HeterogeneousCore/SonicTriton/plugins/converters/FloatStandardConverter.cc
Outdated
Show resolved
Hide resolved
All comments are now addressed, and I have tested with |
HeterogeneousCore/SonicTriton/plugins/converters/FloatApFixed16Converter.cc
Outdated
Show resolved
Hide resolved
HeterogeneousCore/SonicTriton/plugins/converters/FloatApFixed16Converter.cc
Outdated
Show resolved
Hide resolved
Ok, all the comments are now addressed, and I have changed things to allow for multiple separate converters. |
@@ -29,6 +29,40 @@ | |||
"TritonGraphProducer": "gat_test", | |||
} | |||
|
|||
inConvs = { | |||
"TritonImageProducer": cms.VPSet( |
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.
To simplify this for users, we might want to add some additional infrastructure:
- To handle default cases, we could map the standard converters to the appropriate Triton data type names/enums (see the TritonData constructor). Then these wouldn't need to be specified in the python config explicitly.
- We might want to investigate if there's a way to augment the model config and protocols so that, when a FaaST server is used, it could automatically specify (probably via some gRPC message) when an alternate converter needs to be used (and which one).
Item 2 assumes that there would not be a case where the client wants to use a different converter than specified by the model in the repository/on the server.
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.
One idea to avoid a) overloading the meaning of some existing protobuf field (potentially dangerous) or b) extending the proto definitions (maintenance burden):
we could come up with a policy whereby the input and output names in the config.pbtxt are extended to indicate which non-standard converter (if any) is needed. Then these extended names could be handled by the client.
We could try to have the FaaST server perform this extension automatically (in order to keep the same config.pbtxt files for GPU and FPGA versions of a model). But since other model files might need to be different for FPGA usage, changing the config.pbtxt might be okay.
Even with this, it could still be useful to have the option introduced here to specify a converter manually (for testing).
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 yeah, this is a good suggestion, Ill set this up.
-
Hmm, perhaps we could use something existing like the
platform
field inModelMetadataResponse
, and fill it with the server's desired converter. This seems simple enough for FaaST, but I'm not sure how easy this would be with a standard GPU Triton server.
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.
There's still only one platform
per model, so we would have to pack all the information for every input and output into that one string, which isn't ideal.
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.
Oh yeah, I keep forgetting that other models have multiple inputs/outputs.
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.
So this now uses defaults successfully when they are available, so 1) is addressed.
For 2), Ok, I missed your suggestion of the model name field. I think the version field might be even more accurate but it's a minor point. But can we enforce a policy whereby we use the field to encode the necessary converter? I'm wondering if you think this is actually feasible or if you were only thinking out loud a bit here.
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.
To be a bit more explicit, the most automatic implementation would be:
- config.pbtxt retains the normal input/output names (same for GPU and FPGA)
- FaaST appends information to the input/output names when returning the
ModelMetadataResponse
, e.g. "input1_FPGAConverter:foo" - TritonClient knows to check for the presence of "_FPGAConverter:foo"
The question here would be how "foo" is provided for each model input/output. Maybe there could be a separate section of the config.pbtxt; we have to learn more about how Triton parses it and what (if anything) it ignores.
The alternative would be a bit more manual on the user side:
- make a separate FPGA copy of the GPU config.pbtxt, and add "_FPGAConverter:foo" to the input/output names.
- FaaST uses the FPGA copy of the config.pbtxt (maybe this could also be automated...)
Ok, this got lost a bit during the holidays, just to refocus: @kpedro88 you had suggested modifying the name returned by FaaST to include the suggested data converter. Should that be added here before merging (also neglecting the necessary rebase presumably), or were you thinking that this feature would be included in a future PR? |
@drankincms I think we should strive to include any foreseen and achievable automation in PRs to the official CMSSW repository. Doing everything by hand is fine for expert testing, but it's not really usable for other users in that mode, let alone for production. It seems like the bulk of the changes will need to be made in the FaaST server code, with just some additional string parsing introduced in SonicTriton. I would definitely prefer to present a complete product for integration in CMSSW. |
Ok, sounds good, Ill get back to this and add the feature now then 👍 |
//setup input map | ||
std::stringstream io_msg; | ||
if (verbose_) | ||
io_msg << "Model inputs: " | ||
<< "\n"; | ||
inputsTriton_.reserve(nicInputs.size()); | ||
for (const auto& nicInput : nicInputs) { | ||
const auto& iname = nicInput.name(); | ||
const std::string iname_full = nicInput.name(); | ||
const auto& iname = iname_full.find("_DataConverter:") != std::string::npos ? iname_full.substr(0,iname_full.find("_DataConverter:")) : iname_full; |
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.
here's how I would reduce duplication:
- define a static function of TritonClient:
static std::pair<std::string, std::string> splitNameConverter(const std::string& fullname) { static const std::string indicator("_DataConverter:"); size_t dcpos = fullname.find(indicator); if (dcpos != std::string::npos) return {fullname.substr(0,dcpos), fullname.substr(dcpos+indicator.size())}; else return {fullname, ""}; }
- use the static function here:
const auto& [iname, iconverter] = TritonClient::splitNameConverter(iname_full);
- pass
iconverter
tocurr_input.defaultConverter()
below (& do the same for the outputs further down) defaultConverter()
just has to check if the input parameter is non-empty, otherwise it tries to get a standard converter (as currently implemented)inConvMap
can be removed entirely (maybe not right away if you still want to test things)
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, yes, this is cleaner, Ill make this change now, thanks. Regarding 5), I think we still want to let the user define their own converter. For example, in the case of FACILE the server would be configured to request FloatToApFixed16F6 as the converter, but if a dedicated FACILE for FPGA producer is written, it can use the same server and would need to use a different converter.
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 imagine there might be cases where the user wants to provide an alternate converter, but I'm confused about your example. Why would a dedicated producer need to use a different converter for the same server?
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.
Im envisioning a dedicated FPGA producer that is aware of the ap_fixed<16,6>
type that is needed by the server, so it places each input in the data vector already converted, so the converter is basically just a default UINT16
converter.
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.
Ah okay, I understand now.
@drankincms let me know when FaaST is updated accordingly (we should test this before we put it into CMSSW) |
Ok, just committed the changes for FaaST to work with v2 here: https://github.com/drankincms/FaaST/tree/v2 I have been testing this client code with this server, not sure if you're envisioning something more official before we put it in CMSSW. |
yes, let's discuss the FaaST changes more in a PR to that repo. it would be good if we had some recipe for other people (i.e. CMSSW PR reviewers) to test the code. I'm not sure if this is easy, though... Eventually, we might even want to distribute Docker and Singularity containers for FaaST, as we do with Triton. |
Sounds good. We can discuss ways we might be able to test, although it might be quite tricky, I don't know if there are many FPGA-connected resources available ATM. Regarding the PR, do we want to keep separate branches there for v1 and v2 FaaST? I can make a new branch if this is preferable. |
I don't see a reason to keep separate FaaST branches right now. The first version is tagged. If, for some reason, we need to go back and make a 1.x release, we can spin off a branch at that time. |
Ok, done. fastmachinelearning/FaaST#2 |
commit a7454c6 Author: noepalm <[email protected]> Date: Mon Feb 12 14:22:51 2024 +0100 Updated binning for sigma(TOF) validation histograms Updated binning for sigma(TOF) validation histograms Updated binning for sigma(TOF) validation histograms commit e0dc3be Author: noepalm <[email protected]> Date: Wed Feb 7 16:40:42 2024 +0100 Code checks && format (#2) commit 7c70ed8 Author: noepalm <[email protected]> Date: Wed Feb 7 15:57:59 2024 +0100 Removed debug ifdef condition on print to match previous implementation commit 2e40a9f Author: noepalm <[email protected]> Date: Wed Feb 7 15:54:41 2024 +0100 Removed useless comments, files + fixed input file path for standalone MTD validation cfg file commit 199ad72 Author: noepalm <[email protected]> Date: Wed Feb 7 14:41:57 2024 +0100 Code checks && code format commit 6ec3c46 Author: noepalm <[email protected]> Date: Tue Feb 6 09:56:49 2024 +0100 Changed SigmaTof fill location in validation commit 6a0525e Author: noepalm <[email protected]> Date: Mon Feb 5 18:11:27 2024 +0100 Change input file to validation commit cb7db5b Author: noepalm <[email protected]> Date: Mon Feb 5 18:07:19 2024 +0100 Saving sigmaTOF in ps commit 00230ac Author: noepalm <[email protected]> Date: Mon Feb 5 15:32:11 2024 +0100 Removed useless prints + created member vector in TrackSegments to allocate memory for sigmaTof once commit fdd6e31 Author: noepalm <[email protected]> Date: Tue Jan 9 16:08:46 2024 +0100 Added sigma(p) to TrackSegments; added sigma(TOF) computation, now saved to event commit 7d488e0 Author: noepalm <[email protected]> Date: Wed Dec 6 14:24:26 2023 +0100 testing files commit 88f9847 Author: noepalm <[email protected]> Date: Mon Feb 12 12:42:15 2024 +0100 Replaced isnan, isinf with edm::isNotFinite in MTD vertex validation
This is a first attempt at implementing a convertor factory for transforming inputs from one data type to another, useful for running on different servers with different precision without recompile the main producer.
Converters are located in
HeterogeneousCore/SonicTriton/plugins/converters/
, and currently two trivial converters are included (FloatStandardConverter.cc and Int64StandardConverter.cc) forfloat
andint64_t
in addition to an example converter forfloat
toap_fixed<16,6>
(FloatApFixed16Converter.cc).