Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
katre authored Dec 17, 2024
2 parents 7e7147e + 6b9de96 commit 8002b1e
Show file tree
Hide file tree
Showing 22 changed files with 69 additions and 1,157 deletions.
5 changes: 5 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
# Remove once #5066 is resolved.
common --enable_workspace
# Enable once #5066 is resolved.
common --noenable_bzlmod

build --action_env=BAZEL_CXXOPTS="-std=c++17"
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.4.0
7.4.1
4 changes: 2 additions & 2 deletions backends/tofino/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ set (BF_P4C_IR_SRCS
bf-p4c/parde/match_register.cpp
bf-p4c/parde/clot/clot.cpp
bf-p4c/phv/phv.cpp
bf-utils/src/dynamic_hash/dynamic_hash.cpp
bf-utils/src/dynamic_hash/bfn_hash_algorithm.cpp
bf-utils/dynamic_hash/dynamic_hash.cpp
bf-utils/dynamic_hash/bfn_hash_algorithm.cpp
)

set(QUAL_BF_P4C_IR_SRCS)
Expand Down
4 changes: 2 additions & 2 deletions backends/tofino/bf-p4c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ add_definitions("-DRESOURCES_SCHEMA_VERSION=\"${RESOURCES_SCHEMA_VERSION}\"")

set (HAVE_LIBBOOST_GRAPH 1)

set (P4C_LIB_DEPS "${P4C_LIB_DEPS};${Boost_GRAPH_LIBRARY};${LIBDYNHASH_LIBRARY};${Z3_LIB}")
set (P4C_LIB_DEPS "${P4C_LIB_DEPS};${Boost_GRAPH_LIBRARY};${Z3_LIB}")
set (P4C_LIB_DEPS ${P4C_LIB_DEPS} PARENT_SCOPE)

add_subdirectory(logging)
Expand Down Expand Up @@ -1038,7 +1038,7 @@ if (ENABLE_GTESTS)

set (GTEST_SOURCES ${GTEST_SOURCES} ${GTEST_BF_P4C_SOURCES} PARENT_SCOPE)
set (GTEST_LDADD ${GTEST_LDADD}
"bf_gtest_support;tofinobackend;${LIBDYNHASH_LIBRARY};bfn_p4runtime" PARENT_SCOPE)
"bf_gtest_support;tofinobackend;bfn_p4runtime" PARENT_SCOPE)

# TODO: re-enable this test once p4-test is added to the build system
# add_test(NAME test_p4c_driver
Expand Down
2 changes: 1 addition & 1 deletion backends/tofino/bf-p4c/control-plane/bfruntime_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "barefoot/p4info.pb.h"
#pragma GCC diagnostic pop
#include "backends/tofino/bf-p4c/device.h"
#include "backends/tofino/bf-utils/include/dynamic_hash/bfn_hash_algorithm.h"
#include "backends/tofino/bf-utils/dynamic_hash/bfn_hash_algorithm.h"
#include "bfruntime.h"

namespace BFN {
Expand Down
4 changes: 2 additions & 2 deletions backends/tofino/bf-p4c/driver/barefoot.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ def __init__(self, target, arch, argParser):
self.add_command('compiler', os.path.join(os.environ['P4C_BIN_DIR'], 'p4c-barefoot'))
if enable_bf_asm:
self.add_command('assembler', bfas)
self.add_command('bf-rt-verifier', bfrt_schema)
self.add_command('p4c-gen-conf', p4c_gen_conf)
self.add_command('bf-rt-verifier', bfrt_schema)
self.add_command('p4c-gen-conf', p4c_gen_conf)
self.add_command('cleaner', 'rm')

self.runVerifiers = False
Expand Down
2 changes: 1 addition & 1 deletion backends/tofino/bf-p4c/mau/hash_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "lib/hex.h"
#include "lib/big_int_util.h"
#include "backends/tofino/bf-p4c/mau/hash_function.h"
#include "backends/tofino/bf-utils/include/dynamic_hash/dynamic_hash.h"
#include "backends/tofino/bf-utils/dynamic_hash/dynamic_hash.h"

using namespace P4::literals;

Expand Down
2 changes: 1 addition & 1 deletion backends/tofino/bf-p4c/mau/input_xbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "backends/tofino/bf-p4c/mau/resource_estimate.h"
#include "backends/tofino/bf-p4c/mau/tofino/input_xbar.h"
#include "backends/tofino/bf-p4c/phv/phv_fields.h"
#include "backends/tofino/bf-utils/include/dynamic_hash/dynamic_hash.h"
#include "backends/tofino/bf-utils/dynamic_hash/dynamic_hash.h"
#include "lib/algorithm.h"
#include "lib/bitops.h"
#include "lib/bitrange.h"
Expand Down
2 changes: 1 addition & 1 deletion backends/tofino/bf-p4c/mau/tofino/input_xbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "backends/tofino/bf-p4c/mau/resource.h"
#include "backends/tofino/bf-p4c/mau/resource_estimate.h"
#include "backends/tofino/bf-p4c/phv/phv_fields.h"
#include "backends/tofino/bf-utils/include/dynamic_hash/dynamic_hash.h"
#include "backends/tofino/bf-utils/dynamic_hash/dynamic_hash.h"
#include "lib/algorithm.h"
#include "lib/bitvec.h"
#include "lib/bitops.h"
Expand Down
2 changes: 1 addition & 1 deletion backends/tofino/bf-p4c/midend/fold_constant_hashes.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "ir/ir.h"
#include "backends/tofino/bf-p4c/midend/type_checker.h"
#include "backends/tofino/bf-p4c/mau/hash_function.h"
#include "backends/tofino/bf-utils/include/dynamic_hash/dynamic_hash.h"
#include "backends/tofino/bf-utils/dynamic_hash/dynamic_hash.h"

namespace BFN {

Expand Down
13 changes: 13 additions & 0 deletions backends/tofino/bf-utils/dynamic_hash/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
project(libdynhash VERSION 0.1 LANGUAGES C)
add_library(dynhash_o OBJECT
dynamic_hash.cpp
bfn_hash_algorithm.cpp
)

add_library(dynhash SHARED EXCLUDE_FROM_ALL $<TARGET_OBJECTS:dynhash_o>)

# static lib for compiler with no syslibs
add_library(tofino_dynhash STATIC dynamic_hash.cpp bfn_hash_algorithm.cpp)
set_target_properties(tofino_dynhash PROPERTIES OUTPUT_NAME dynhash)
target_compile_definitions(tofino_dynhash PUBLIC NO_BFSYSLIBS)

Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#include "backends/tofino/bf-utils/include/dynamic_hash/bfn_hash_algorithm.h"
#include "backends/tofino/bf-utils/dynamic_hash/bfn_hash_algorithm.h"

#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <vector>

/**
* These values are based on the crc calculations provided at this url:
* http://reveng.sourceforge.net/crc-catalogue/all.htm
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef BACKENDS_TOFINO_BF_UTILS_INCLUDE_DYNAMIC_HASH_BFN_HASH_ALGORITHM_H_
#define BACKENDS_TOFINO_BF_UTILS_INCLUDE_DYNAMIC_HASH_BFN_HASH_ALGORITHM_H_
#ifndef BACKENDS_TOFINO_BF_UTILS_DYNAMIC_HASH_BFN_HASH_ALGORITHM_H_
#define BACKENDS_TOFINO_BF_UTILS_DYNAMIC_HASH_BFN_HASH_ALGORITHM_H_

#ifndef __KERNEL__
#include <stdbool.h>
Expand Down Expand Up @@ -419,4 +419,4 @@ void initialize_crc_matrix(bfn_hash_algorithm_t *alg);
void calculate_crc(bfn_hash_algorithm_t *alg, uint32_t hash_output_bits, uint8_t *stream,
uint32_t stream_len, uint8_t *crc);

#endif /* BACKENDS_TOFINO_BF_UTILS_INCLUDE_DYNAMIC_HASH_BFN_HASH_ALGORITHM_H_ */
#endif /* BACKENDS_TOFINO_BF_UTILS_DYNAMIC_HASH_BFN_HASH_ALGORITHM_H_ */
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "backends/tofino/bf-utils/include/dynamic_hash/dynamic_hash.h"
#include "backends/tofino/bf-utils/dynamic_hash/dynamic_hash.h"

#include <assert.h>
#include <inttypes.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef BACKENDS_TOFINO_BF_UTILS_INCLUDE_DYNAMIC_HASH_DYNAMIC_HASH_H_
#define BACKENDS_TOFINO_BF_UTILS_INCLUDE_DYNAMIC_HASH_DYNAMIC_HASH_H_
#ifndef BACKENDS_TOFINO_BF_UTILS_DYNAMIC_HASH_DYNAMIC_HASH_H_
#define BACKENDS_TOFINO_BF_UTILS_DYNAMIC_HASH_DYNAMIC_HASH_H_

#include <stdbool.h>
#include <stdint.h>

#include "backends/tofino/bf-utils/include/dynamic_hash/bfn_hash_algorithm.h"
#include "backends/tofino/bf-utils/dynamic_hash/bfn_hash_algorithm.h"

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -213,4 +213,4 @@ void determine_tofino_regs(const ixbar_init_t *ixbar_init, const ixbar_input_t *
}
#endif

#endif /* BACKENDS_TOFINO_BF_UTILS_INCLUDE_DYNAMIC_HASH_DYNAMIC_HASH_H_ */
#endif /* BACKENDS_TOFINO_BF_UTILS_DYNAMIC_HASH_DYNAMIC_HASH_H_ */
10 changes: 0 additions & 10 deletions backends/tofino/bf-utils/src/dynamic_hash/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit 8002b1e

Please sign in to comment.