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

BMV2 multi-architecture support #544

Closed
wants to merge 3 commits into from
Closed

BMV2 multi-architecture support #544

wants to merge 3 commits into from

Conversation

hanw
Copy link
Contributor

@hanw hanw commented May 1, 2017

[do NOT merge yet]
Bmv2 multi-architecture support

This commit refactors bmv2 backend to support multiple pipeline
architectures. JsonConverter is refactored into a pass manager
to conform to the rest of the compiler design.

Added files:
backend.cpp       - the new backend pass manager
convert*.cpp      - compiler passes for control, parser, deparser,
                    externs and headers
inferArchitecture - a new frontend pass to parse the architecture p4
                    into a data object which is then used by json
                    generator
model.cpp         - a v2model that oriented for p4-16 IR

Calin Cascaval and others added 2 commits April 22, 2017 12:07
  - Comments on how to handle the semantics of multiple PRE invocations
  - and design option of splitting the PRE into PRE and BQE (Buffering
  and Queueing Engine)
  - added PRE as argument to Ingress and Egress
  - added missing 'in' qualifiers and random distribution
  - add size types instead of indefinite int
  - update with @mbudiu-vmw comments to pass through compiler
  - ActionProfile and ActionSelector externs
This commit refactors bmv2 backend to support multiple pipelien
architectures. JsonConverter is refactored into a pass manager
which is more conformed to the rest of the compiler design.

Added files:
backend.cpp       - the new backend pass manager
convert*.cpp      - compiler passes for control, parser, deparser,
                    externs and headers
inferArchitecture - a new frontend pass to parse the architecture p4
                    into a data object which is then used by json
                    generator
model.cpp         - a v2model that oriented for p4-16 IR

TODO:
tov1model         - a pass to convert v2model to v1model to execute
                    on simple-switch
@hanw hanw requested a review from cc10512 May 1, 2017 02:39
Copy link
Contributor

@cc10512 cc10512 left a comment

Choose a reason for hiding this comment

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

@hanw This is a monster of a commit! I've tried to go through it and I kind of got the gist. However, there are several issues that will be much easier to sort out if we sit together, and will really help focus the review. It is also difficult to track new changes from the old jsonConverter since the code is now in different files.

I have to say that I'm happy you were able to get it here, we'll wrap it up in the next few days. THANKS!


namespace BMV2 {

class DirectMeterMap final {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this class needed for DirectMeters from all the externs?

Copy link
Contributor

Choose a reason for hiding this comment

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

That does seem odd -- this class seems to be tracking the (color) output, but that should also be needed for meters and registers, which also have destination fields that are written by the extern.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, this is odd. This is the last piece that needs to be taken out of jsonconverter.cpp (which is now backend.cpp). Will separate it to its own file.

void setSize(const IR::IDeclaration* meter, unsigned size);
};

class Backend {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a PassManager?

};

/// Method_Model : Block_Model<Param_Model> : Type_Model
struct Method_Model : public Block_Model<Param_Model> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Are the parameters to the method defined as the elems in Block_Model? Is there ever the case that we need to distinguish between constructor params and data plane params?

};

/// Extern_Model : Block_Model<Method_Model> : Type_Model
struct Extern_Model : public Block_Model<Method_Model> {
Copy link
Contributor

Choose a reason for hiding this comment

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

How do you distinguish between decls and methods in an extern? Can externs have only Methods?

std::vector<Control_Model*> controls;
std::vector<Extern_Model*> externs;
std::vector<Type_Model*> match_kinds;
::Model::Elem action_profile;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not externs?

@@ -114,7 +116,8 @@ common_frontend_UNIFIED = \
frontends/common/resolveReferences/referenceMap.cpp \
frontends/common/resolveReferences/resolveReferences.cpp \
frontends/common/parseInput.cpp \
frontends/common/constantParsing.cpp
frontends/common/constantParsing.cpp \
Copy link
Contributor

Choose a reason for hiding this comment

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

we should really keep these files in alphabetical order to reduce merge conflicts.


#include "frontends/common/model.h"

/// take v2model and turn it into v1model
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need to convert the model? I would have thought that we can serialize v2 to the json from the v1model.

@hanw
Copy link
Contributor Author

hanw commented May 1, 2017

Close temporarily for now to reducing spam to people. Will reopen later.

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