p4lang / p4app-switchML

Switch ML Application
https://switchml.readthedocs.io/
Apache License 2.0
168 stars 46 forks source link

Help with compiling switchml P4 code:internal compile error #38

Open YUANCHUANYING opened 1 year ago

YUANCHUANYING commented 1 year ago

I am currently compiling switchml.p4 on a programmable switch using the command "p4_build-9.x.y.sh switchml.p4". However, I encountered some issues while compiling the code. The console printed the following messages: The number of P4 compiler-proper Errors is 0, and the number of P4 compiler-proper WARNINGs is 28. The crucial part is that it shows "Internal compiler error. Please submit a bug with your code."

I searched online and found that this could be due to insufficient memory. However, I did not observe any lack of available memory during the actual compilation (e.g., available memory less than 1G). I would like to know how to resolve this issue. Could you please provide some assistance? I sincerely hope to receive your reply. Thanks in advance!@AmedeoSapio

屏幕截图 2023-06-02 205327 屏幕截图 2023-06-02 205356 My environment is:

Platform:X308P-T

Switch Unit: intel Tofino 1 BFN-T10-032D

SDE:9.7.4

GCC:debian 6.3.0-18+deb9u1

hiyouqian commented 1 year ago

Hello, is this problem solved? I also encountered this problem.

fengkeyleaf commented 6 months ago

Hi all, I have the same problem when compiling the program with bf-sde-9.12.0. It seems that only the sde, which is 9.9.0, they're using can properly compile their program without errors, but I haven't tried running it on a real hardware switch unit. I don't know why, it's very strange.

And here is my error message using bf-sde-9.12.0:

$ make SwitchML Scanning dependencies of target bf-p4c [ 0%] Built target bf-p4c Scanning dependencies of target driver [ 0%] Built target driver Scanning dependencies of target SwitchML-tofino [100%] Generating SwitchML/tofino/bf-rt.json /home/p4app-switchML/dev_root/p4/build/../rdma_sender.p4(37): [--Wwarn=unused] warning: 'message_length' is unused bit<31> message_length, ^^^^^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../rdma_sender.p4(38): [--Wwarn=unused] warning: 'first_last_mask' is unused pool_index_t first_last_mask) { ^^^^^^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../parsers.p4(26): [--Wwarn=uninitialized_out_param] warning: out parameter 'ig_md' may be uninitialized when 'IngressParser' terminates out ingress_metadata_t ig_md, ^^^^^ /home/p4app-switchML/dev_root/p4/build/../parsers.p4(23) parser IngressParser( ^^^^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../parsers.p4(245): [--Wwarn=uninitialized_out_param] warning: out parameter 'eg_md' may be uninitialized when 'EgressParser' terminates out egress_metadata_t eg_md, ^^^^^ /home/p4app-switchML/dev_root/p4/build/../parsers.p4(242) parser EgressParser( ^^^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../rdma_receiver.p4(179): [--Wwarn=invalid_header] warning: accessing a field of an invalid header hdr.ib_bth return_t result = receiver_reset_action.execute((hdr.ib_bth.dst_qp[16+max_num_workers_log2-1:16] ++ hdr.ib_bth.dst_qp[max_num_queue_pairs_per_worker_log2-1:0])); ^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../rdma_receiver.p4(179): [--Wwarn=invalid_header] warning: accessing a field of an invalid header hdr.ib_bth return_t result = receiver_reset_action.execute((hdr.ib_bth.dst_qp[16+max_num_workers_log2-1:16] ++ hdr.ib_bth.dst_qp[max_num_queue_pairs_per_worker_log2-1:0])); ^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../rdma_receiver.p4(64): [--Wwarn=invalid_header] warning: accessing a field of an invalid header hdr.ib_bth if ((bit<32>) hdr.ib_bth.psn == 0x00ffffff) { // PSNs are 24 bits. Do we need to wrap around? ^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../rdma_receiver.p4(69): [--Wwarn=invalid_header] warning: accessing a field of an invalid header hdr.ib_bth value.next_sequence_number = (bit<32>) hdr.ib_bth.psn + 1; ^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../rdma_receiver.p4(73): [--Wwarn=invalid_header] warning: accessing a field of an invalid header hdr.ib_reth value.pool_index = (bit<32>) (hdr.ib_reth.r_key); ^^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../rdma_receiver.p4(217): [--Wwarn=invalid_header] warning: accessing a field of an invalid header hdr.ib_bth return_t result = receiver_reset_action.execute((hdr.ib_bth.dst_qp[16+max_num_workers_log2-1:16] ++ hdr.ib_bth.dst_qp[max_num_queue_pairs_per_worker_log2-1:0])); ^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../rdma_receiver.p4(217): [--Wwarn=invalid_header] warning: accessing a field of an invalid header hdr.ib_bth return_t result = receiver_reset_action.execute((hdr.ib_bth.dst_qp[16+max_num_workers_log2-1:16] ++ hdr.ib_bth.dst_qp[max_num_queue_pairs_per_worker_log2-1:0])); ^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../rdma_receiver.p4(243): [--Wwarn=invalid_header] warning: accessing a field of an invalid header hdr.ib_bth return_t result = receiver_increment_action.execute((hdr.ib_bth.dst_qp[16+max_num_workers_log2-1:16] ++ hdr.ib_bth.dst_qp[max_num_queue_pairs_per_worker_log2-1:0])); ^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../rdma_receiver.p4(243): [--Wwarn=invalid_header] warning: accessing a field of an invalid header hdr.ib_bth return_t result = receiver_increment_action.execute((hdr.ib_bth.dst_qp[16+max_num_workers_log2-1:16] ++ hdr.ib_bth.dst_qp[max_num_queue_pairs_per_worker_log2-1:0])); ^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../rdma_receiver.p4(84): [--Wwarn=invalid_header] warning: accessing a field of an invalid header hdr.ib_bth if ((bit<32>) hdr.ib_bth.psn == value.next_sequence_number) { ^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../rdma_receiver.p4(269): [--Wwarn=invalid_header] warning: accessing a field of an invalid header hdr.ib_bth return_t result = receiver_increment_action.execute((hdr.ib_bth.dst_qp[16+max_num_workers_log2-1:16] ++ hdr.ib_bth.dst_qp[max_num_queue_pairs_per_worker_log2-1:0])); ^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../rdma_receiver.p4(269): [--Wwarn=invalid_header] warning: accessing a field of an invalid header hdr.ib_bth return_t result = receiver_increment_action.execute((hdr.ib_bth.dst_qp[16+max_num_workers_log2-1:16] ++ hdr.ib_bth.dst_qp[max_num_queue_pairs_per_worker_log2-1:0])); ^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../rdma_receiver.p4(343): [--Wwarn=uninitialized_use] warning: sequence_violation may be uninitialized if (sequence_violation) { ^^^^^^^^^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../rdma_receiver.p4(347): [--Wwarn=uninitialized_use] warning: message_possibly_received may be uninitialized } else if (message_possibly_received) { ^^^^^^^^^^^^^^^^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../rdma_sender.p4(59): [--Wwarn=uninitialized_use] warning: rdma_switch_mac may be uninitialized hdr.ethernet.src_addr = rdma_switch_mac; ^^^^^^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../rdma_sender.p4(72): [--Wwarn=uninitialized_use] warning: rdma_switch_ip may be uninitialized hdr.ipv4.src_addr = rdma_switch_ip; ^^^^^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../rdma_sender.p4(186): [--Wwarn=uninitialized_use] warning: rdma_rkey may be uninitialized hdr.ib_reth.r_key = rdma_rkey; ^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../exponents.p4(28): [--Wwarn=uninitialized_out_param] warning: out parameter 'max_exponent0' may be uninitialized when 'Exponents' terminates out exponent_t max_exponent0, ^^^^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../exponents.p4(25) control Exponents( ^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../exponents.p4(29): [--Wwarn=uninitialized_out_param] warning: out parameter 'max_exponent1' may be uninitialized when 'Exponents' terminates out exponent_t max_exponent1, ^^^^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../exponents.p4(25) control Exponents( ^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../processor.p4(28): [--Wwarn=uninitialized_out_param] warning: out parameter 'value0_out' may be uninitialized when 'Processor' terminates out value_t value0_out, ^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../processor.p4(25) control Processor( ^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../processor.p4(29): [--Wwarn=uninitialized_out_param] warning: out parameter 'value1_out' may be uninitialized when 'Processor' terminates out value_t value1_out, ^^^^^^^^^^ /home/p4app-switchML/dev_root/p4/build/../processor.p4(25) control Processor( ^^^^^^^^^ warning: No size defined for table 'workers_counter_count_workers', setting default size to 512 warning: No size defined for table 'reconstruct_worker_bitmap_reconstruct_worker_bitmap', setting default size to 512 warning: No size defined for table 'update_and_check_worker_bitmap_update_and_check_worker_bitmap', setting default size to 512

1 error, 28 warnings generated.

Internal compiler error. Please submit a bug report with your code. make[3]: [CMakeFiles/SwitchML-tofino.dir/build.make:61: SwitchML/tofino/bf-rt.json] Error 4 make[3]: Deleting file 'SwitchML/tofino/bf-rt.json' make[2]: [CMakeFiles/Makefile2:81: CMakeFiles/SwitchML-tofino.dir/all] Error 2 make[1]: [CMakeFiles/Makefile2:142: CMakeFiles/SwitchML.dir/rule] Error 2 make: *** [Makefile:190: SwitchML] Error 2