P4C
The P4 Compiler
Loading...
Searching...
No Matches
LowerDeparserIR

Replace deparser IR with lowered version that references containers instead of fields. More...

Collaboration diagram for LowerDeparserIR:

Classes

class  CoalesceLearning
 Replaces consecutive extracts of the same container with a single extract. More...
 
struct  Parde::Lowered::ComputeLoweredDeparserIR
 Generates lowered deparser IR with container references. More...
 
struct  Parde::Lowered::ReplaceDeparserIR
 Replace deparser IR with lowered version. More...
 
struct  Parde::Lowered::RewriteEmitClot
 Replace Emits covered in a CLOT with EmitClot. More...
 

Detailed Description

Replace deparser IR with lowered version that references containers instead of fields.

Generate a lowered version of the parser IR in this program and swap it in in place of the existing representation.

The pass does this by:

  1. Replacing field/checksum emits that are covered by CLOTs with EmitClot objects.
  2. Generating lowered version of the deparser and swapping them in.
  3. Coalescing the learning digest to remove consecutive uses of the same container.

Class Documentation

◆ CoalesceLearning

class CoalesceLearning

Replaces consecutive extracts of the same container with a single extract.

Copyright (C) 2024 Intel Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Digests cannot extract from the same 16 or 32 bit PHV consecutively, but for learning digests, since we control the layout completely, we can set it up to just extract the container once, and use the data from that container more than once.

This pass detects consecutive extracts of the same container and replaces them with a single extract, rewriting the control-plane info to match. In theory we could combine any extracts from the same container (not just adjacent ones) to reduce the number of digest bytes needed

Inheritance diagram for CoalesceLearning:
[legend]

◆ Parde::Lowered::ComputeLoweredDeparserIR

struct Parde::Lowered::ComputeLoweredDeparserIR

Generates lowered deparser IR with container references.

Generate the lowered deparser IR by splitting references to fields in the high-level deparser IR into references to containers.

Inheritance diagram for Parde::Lowered::ComputeLoweredDeparserIR:
[legend]

Public Member Functions

 ComputeLoweredDeparserIR (const PhvInfo &phv, const ClotInfo &clotInfo)
 

Public Attributes

std::map< gress_t, std::map< const IR::BFN::EmitChecksum *, unsigned > > checksumInfo
 
IR::BFN::LoweredDeparser * egLoweredDeparser
 
IR::BFN::LoweredDeparser * igLoweredDeparser
 The lowered deparser IR generated by this pass.
 

◆ Parde::Lowered::ReplaceDeparserIR

struct Parde::Lowered::ReplaceDeparserIR

Replace deparser IR with lowered version.

Replace the high-level deparser IR version of each deparser with the lowered version generated by ComputeLoweredDeparserIR.

Inheritance diagram for Parde::Lowered::ReplaceDeparserIR:
[legend]

Public Member Functions

 ReplaceDeparserIR (const IR::BFN::LoweredDeparser *igLoweredDeparser, const IR::BFN::LoweredDeparser *egLoweredDeparser)
 

◆ Parde::Lowered::RewriteEmitClot

struct Parde::Lowered::RewriteEmitClot

Replace Emits covered in a CLOT with EmitClot.

This pass visits the deparsers, and for each deparser, it walks through the emits and identifies checksums/fields that are covered as part of a CLOT. Elements that are covered by a CLOT are removed from the emit list and are replace by EmitClot objects.

Inheritance diagram for Parde::Lowered::RewriteEmitClot:
[legend]

Public Member Functions

 RewriteEmitClot (const PhvInfo &phv, ClotInfo &clotInfo)