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

Upper-level task fails on tapa::ostreams #219

Closed
Blaok opened this issue Jan 13, 2025 · 1 comment
Closed

Upper-level task fails on tapa::ostreams #219

Blaok opened this issue Jan 13, 2025 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Blaok
Copy link
Collaborator

Blaok commented Jan 13, 2025

TAPA fails to compile the following program:

#include <tapa.h>

using Data = uint64_t;

void LowerLevelTask(tapa::istream<Data>& istream,
                    tapa::ostreams<Data, 1>& ostreams, int scalar) {
  for (int i = 0; i < scalar; ++i) {
    ostreams[0].write(istream.read());
  }
}
void UpperLevelTask(tapa::istream<Data>& istream,
                    tapa::ostreams<Data, 1>& ostreams, int scalar) {
  tapa::task().invoke(LowerLevelTask, istream, ostreams, scalar);
}

void Produce(tapa::mmap<Data> mmap, int scalar, tapa::ostream<Data>& ostream) {
produce:
  [[tapa::pipeline(1)]] for (int i = 0; i < scalar; ++i) {
    ostream.write(mmap[i]);
  }
}

void Consume(tapa::mmap<Data> mmap, int scalar, tapa::istream<Data> istream) {
consume:
  [[tapa::pipeline(1)]] for (int i = 0; i < scalar; ++i) {
    mmap[i] = istream.read();
  }
}

void Top(tapa::mmap<Data> mmap_in, tapa::mmap<Data> mmap_out, int scalar) {
  tapa::stream<Data> stream_in;
  tapa::streams<Data, 1> stream_out;
  tapa::task()
      .invoke(Produce, mmap_in, scalar, stream_in)
      .invoke(UpperLevelTask, stream_in, stream_out, scalar)
      .invoke(Consume, mmap_out, scalar, stream_out);
}

Error log:

I0112 19:04:58.861 tapa.util:258] logging level set to INFO
I0112 19:04:58.861 __main__:82] tapa version: 0.1.20250110
I0112 19:04:58.861 __main__:86] Python recursion limit set to 3000
I0112 19:04:58.892 tapa.steps.analyze:218] added vendor include path `/opt/tools/xilinx/Vitis_HLS/2024.1/include`
I0112 19:04:58.893 tapa.steps.analyze:218] added vendor include path `/opt/tools/xilinx/Vitis_HLS/2024.1/tps/lnx64/gcc-9.3.0/include/c++/9.3.0`
I0112 19:04:58.893 tapa.steps.analyze:218] added vendor include path `/opt/tools/xilinx/Vitis_HLS/2024.1/tps/lnx64/gcc-9.3.0/include/c++/9.3.0/x86_64-linux-gnu`
I0112 19:04:59.005 tapa.steps.analyze:370] Running tapacc command: /home/Blaok/.cache/bazel/_bazel_Blaok/45f21eed583a14e6d0512cfe17472d81/execroot/_main/bazel-out/k8-opt-exec-ST-d57f47055a04/bin/tapacc/tapacc ./work.out/flatten/flatten-cc0b7fee-testdata.cpp -top Top -vitis -- -Itapa/verilog/xilinx/testdata -std=c++14 -nostdinc++ -isystem /home/Blaok/.cache/bazel/_bazel_Blaok/45f21eed583a14e6d0512cfe17472d81/sandbox/linux-sandbox/2574/execroot/_main/bazel-out/k8-opt-exec-ST-d57f47055a04/bin/tapa/tapa.runfiles/_main/tapa-lib -isystem /home/Blaok/.cache/bazel/_bazel_Blaok/45f21eed583a14e6d0512cfe17472d81/sandbox/linux-sandbox/2574/execroot/_main/bazel-out/k8-opt-exec-ST-d57f47055a04/bin/tapa/tapa.runfiles/_main/tapa-system-include/tapa-extra-runtime-include -Wno-attributes -Wno-unknown-pragmas -Wno-unused-label -isystem /opt/tools/xilinx/Vitis_HLS/2024.1/include -isystem /opt/tools/xilinx/Vitis_HLS/2024.1/tps/lnx64/gcc-9.3.0/include/c++/9.3.0 -isystem /opt/tools/xilinx/Vitis_HLS/2024.1/tps/lnx64/gcc-9.3.0/include/c++/9.3.0/x86_64-linux-gnu -isystem /home/Blaok/.cache/bazel/_bazel_Blaok/45f21eed583a14e6d0512cfe17472d81/sandbox/linux-sandbox/2574/execroot/_main/bazel-out/k8-opt-exec-ST-d57f47055a04/bin/tapa/tapa.runfiles/_main/tapa-system-include/tapa-system-include -DTAPA_TARGET_DEVICE_ -DTAPA_TARGET_STUB_
I0112 19:04:59.316 tapa.steps.common:116] writing TAPA graph to json `./work.out/graph.json`.
I0112 19:04:59.316 tapa.steps.common:116] writing TAPA settings to json `./work.out/settings.json`.
I0112 19:04:59.316 tapa.steps.common:116] writing TAPA has_template to json `./work.out/has_template.json`.
I0112 19:04:59.317 tapa.steps.common:59] reusing TAPA settings from upstream flows.
I0112 19:04:59.339 tapa.core:526] extracting hls C++ files
I0112 19:04:59.497 tapa.core:596] running hls
I0112 19:04:59.497 tapa.core:677] spawn 2 workers for parallel hls synthesis of the tasks
I0112 19:05:53.096 tapa.core:687] extracting RTL files
I0112 19:05:53.121 tapa.core:719] parsing RTL files and populating tasks
I0112 19:05:54.534 tapa.core:736] instrumenting upper-level RTL
I0112 19:05:54.536 tapa.core:1381] split stream data ports to data and eot on UpperLevelTask
I0112 19:05:54.536 tapa.core:1411]   split istream._dout
I0112 19:05:54.536 tapa.core:1411]   split istream_peek._dout
W0112 19:05:54.537 tapa.verilog.xilinx.module:288] assuming ostreams is a singleton array
W0112 19:05:54.537 tapa.verilog.xilinx.module:288] assuming ostreams is a singleton array
W0112 19:05:54.537 tapa.verilog.xilinx.module:288] assuming ostreams is a singleton array
W0112 19:05:54.537 tapa.verilog.xilinx.module:288] assuming ostreams is a singleton array
W0112 19:05:54.537 tapa.verilog.xilinx.module:288] assuming ostreams is a singleton array
W0112 19:05:54.537 tapa.verilog.xilinx.module:288] assuming ostreams is a singleton array
Traceback (most recent call last):
  File "/home/Blaok/.cache/bazel/_bazel_Blaok/45f21eed583a14e6d0512cfe17472d81/sandbox/linux-sandbox/2574/execroot/_main/bazel-out/k8-opt-exec-ST-d57f47055a04/bin/tapa/tapa.runfiles/_main/tapa/__main__.py", line 98, in <module>
    entry_point()
  File "/home/Blaok/.cache/bazel/_bazel_Blaok/45f21eed583a14e6d0512cfe17472d81/sandbox/linux-sandbox/2574/execroot/_main/bazel-out/k8-opt-exec-ST-d57f47055a04/bin/tapa/tapa.runfiles/rules_python++pip+tapa_deps_311_click/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/Blaok/.cache/bazel/_bazel_Blaok/45f21eed583a14e6d0512cfe17472d81/sandbox/linux-sandbox/2574/execroot/_main/bazel-out/k8-opt-exec-ST-d57f47055a04/bin/tapa/tapa.runfiles/rules_python++pip+tapa_deps_311_click/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/Blaok/.cache/bazel/_bazel_Blaok/45f21eed583a14e6d0512cfe17472d81/sandbox/linux-sandbox/2574/execroot/_main/bazel-out/k8-opt-exec-ST-d57f47055a04/bin/tapa/tapa.runfiles/rules_python++pip+tapa_deps_311_click/site-packages/click/core.py", line 1728, in invoke
    rv.append(sub_ctx.command.invoke(sub_ctx))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/Blaok/.cache/bazel/_bazel_Blaok/45f21eed583a14e6d0512cfe17472d81/sandbox/linux-sandbox/2574/execroot/_main/bazel-out/k8-opt-exec-ST-d57f47055a04/bin/tapa/tapa.runfiles/rules_python++pip+tapa_deps_311_click/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/Blaok/.cache/bazel/_bazel_Blaok/45f21eed583a14e6d0512cfe17472d81/sandbox/linux-sandbox/2574/execroot/_main/bazel-out/k8-opt-exec-ST-d57f47055a04/bin/tapa/tapa.runfiles/rules_python++pip+tapa_deps_311_click/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/Blaok/.cache/bazel/_bazel_Blaok/45f21eed583a14e6d0512cfe17472d81/sandbox/linux-sandbox/2574/execroot/_main/bazel-out/k8-opt-exec-ST-d57f47055a04/bin/tapa/tapa.runfiles/_main/tapa/steps/synth.py", line 110, in synth
    program.generate_task_rtl(print_fifo_ops)
  File "/home/Blaok/.cache/bazel/_bazel_Blaok/45f21eed583a14e6d0512cfe17472d81/sandbox/linux-sandbox/2574/execroot/_main/bazel-out/k8-opt-exec-ST-d57f47055a04/bin/tapa/tapa.runfiles/_main/tapa/core.py", line 739, in generate_task_rtl
    self._instrument_upper_and_template_task(task, print_fifo_ops)
  File "/home/Blaok/.cache/bazel/_bazel_Blaok/45f21eed583a14e6d0512cfe17472d81/sandbox/linux-sandbox/2574/execroot/_main/bazel-out/k8-opt-exec-ST-d57f47055a04/bin/tapa/tapa.runfiles/_main/tapa/core.py", line 1445, in _instrument_upper_and_template_task
    self._connect_fifos(task)
  File "/home/Blaok/.cache/bazel/_bazel_Blaok/45f21eed583a14e6d0512cfe17472d81/sandbox/linux-sandbox/2574/execroot/_main/bazel-out/k8-opt-exec-ST-d57f47055a04/bin/tapa/tapa.runfiles/_main/tapa/core.py", line 875, in _connect_fifos
    task.connect_fifo_externally(
  File "/home/Blaok/.cache/bazel/_bazel_Blaok/45f21eed583a14e6d0512cfe17472d81/sandbox/linux-sandbox/2574/execroot/_main/bazel-out/k8-opt-exec-ST-d57f47055a04/bin/tapa/tapa.runfiles/_main/tapa/task.py", line 462, in connect_fifo_externally
    rhs = self.module.get_port_of(external_name, suffix).name
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/Blaok/.cache/bazel/_bazel_Blaok/45f21eed583a14e6d0512cfe17472d81/sandbox/linux-sandbox/2574/execroot/_main/bazel-out/k8-opt-exec-ST-d57f47055a04/bin/tapa/tapa.runfiles/_main/tapa/verilog/xilinx/module.py", line 291, in get_port_of
    raise ValueError(msg)
ValueError: module UpperLevelTask does not have port ostreams[0]._din_eot

@Ed-5100 Could you take a look?

@Blaok Blaok added the bug Something isn't working label Jan 13, 2025
@Blaok Blaok closed this as completed Feb 3, 2025
@Blaok
Copy link
Collaborator Author

Blaok commented Feb 3, 2025

Fixed by 7aaa571 (I think).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants