Skip to content

Use Kokkos instead of OpenMP - #11440

Open
ArturBieniek4 wants to merge 22 commits into
The-OpenROAD-Project:masterfrom
antmicro:104235-kokkos
Open

ArturBieniek4 wants to merge 22 commits into
The-OpenROAD-Project:masterfrom
antmicro:104235-kokkos

Conversation

@ArturBieniek4

@ArturBieniek4 ArturBieniek4 commented Sep 17, 2026 •

Copy link
Copy Markdown

Summary

Enable Kokkos by default in Bazel and add CMake dependency installer support. Replace native GPL OpenMP loops with Kokkos parallelism, preserving configurable host backends and GPU support. Upgrade Kokkos to 5.2.2 and fix CUDA build compatibility.

Impact

I ran a benchmark on i7-7820X. SMT & boost disabled, governor set to performance, pinned cores. Run order was random, with 5 second cooldown between attempts. 2 warmup runs, then 10 measured runs, results are medians of those 10 measured runs. Process time plus cooldowns: 21.78 hours.

Benchmark results:

Test OMP 1 (s) Kokkos 1 (s) Change 1 OMP 6 (s) Kokkos 6 (s) Change 6
medium04 272.283 278.506 +2.29% 86.684 72.958 -15.83%
large02 262.545 264.065 +0.58% 103.624 97.839 -5.58%
medium03 228.505 233.786 +2.31% 66.010 61.161 -7.35%
large01 224.474 225.448 +0.43% 91.790 86.943 -5.28%
macro03 216.740 221.043 +1.99% 74.498 62.474 -16.14%
macro01 204.509 208.953 +2.17% 59.902 54.191 -9.54%
medium05 107.870 109.941 +1.92% 34.138 31.894 -6.57%
macro02 46.251 47.584 +2.88% 18.811 16.100 -14.41%
medium02 34.210 35.316 +3.23% 13.650 12.102 -11.34%
medium06 29.389 30.482 +3.72% 10.740 10.048 -6.44%
medium01 16.484 17.093 +3.69% 6.630 6.130 -7.54%
incremental02 6.386 6.507 +1.88% 2.301 2.436 +5.87%
simple10 5.347 5.450 +1.92% 2.454 2.499 +1.83%
simple01-td-tune 0.871807 0.874596 +0.32% 0.867579 0.894908 +3.15%
simple01-td-repair 0.430892 0.434184 +0.76% 0.438256 0.441963 +0.85%
simple01-vcts-clamp 0.363364 0.367532 +1.15% 0.349330 0.362589 +3.80%
nograd01 0.347423 0.359889 +3.59% 0.127962 0.132663 +3.67%
simple01-td-net-percentage 0.326724 0.326435 -0.09% 0.317671 0.331066 +4.22%
simple01-td 0.320298 0.324134 +1.20% 0.314752 0.326956 +3.88%
region01 0.313057 0.333890 +6.66% 0.207709 0.223561 +7.63%
simple01-vcts 0.304562 0.308337 +1.24% 0.295573 0.302688 +2.41%
simple01-vcts-userlat 0.303193 0.307330 +1.36% 0.296868 0.305508 +2.91%
simple01-vcts-noclk 0.179023 0.184895 +3.28% 0.169285 0.185482 +9.57%
simple01-rd 0.155046 0.156388 +0.87% 0.144394 0.155471 +7.67%
simple02-rd 0.153139 0.156525 +2.21% 0.144029 0.155935 +8.27%
simple03-rd 0.134827 0.137918 +2.29% 0.125111 0.136548 +9.14%
simple04-rd 0.134539 0.137604 +2.28% 0.125055 0.136410 +9.08%
convergence01 0.126646 0.129269 +2.07% 0.130024 0.137010 +5.37%
simple04 0.058582 0.061604 +5.16% 0.050348 0.062386 +23.91%
simple03 0.057823 0.061050 +5.58% 0.049454 0.061335 +24.02%
simple01-skip-io 0.055332 0.058975 +6.58% 0.050193 0.062164 +23.85%
place_ios_top_layer 0.055302 0.058323 +5.46% 0.044992 0.056286 +25.10%
simple01-ref 0.038690 0.040921 +5.77% 0.032965 0.041435 +25.69%
core01 0.038585 0.040772 +5.67% 0.032089 0.040398 +25.89%
mt_invariance01 0.038526 0.040749 +5.77% 0.031327 0.040015 +27.74%
ar02 0.037969 0.040088 +5.58% 0.031148 0.039808 +27.81%
simple01 0.037750 0.039921 +5.75% 0.032758 0.040386 +23.28%
ar01 0.037562 0.039776 +5.89% 0.031163 0.039321 +26.18%
simple01-uniform 0.037029 0.039127 +5.67% 0.031863 0.039804 +24.92%
density01 0.036754 0.039037 +6.21% 0.030442 0.038249 +25.64%
cluster_place01 0.036576 0.038776 +6.02% 0.031130 0.038824 +24.72%
simple02 0.036452 0.038555 +5.77% 0.031358 0.039300 +25.33%
error01 0.036435 0.038582 +5.89% 0.031461 0.039317 +24.97%
simple01-obs 0.036082 0.038081 +5.54% 0.031693 0.039262 +23.88%
diverge01 0.008668 0.009152 +5.59% 0.008595 0.010191 +18.57%
simple06 0.004983 0.004961 -0.44% 0.005394 0.005079 -5.83%
simple08 0.003375 0.003555 +5.33% 0.004305 0.004701 +9.21%
simple09 0.001423 0.001512 +6.25% 0.002184 0.002372 +8.59%
simple07 0.001406 0.001488 +5.87% 0.002188 0.002420 +10.63%
simple05 0.001075 0.001149 +6.88% 0.001816 0.002032 +11.86%
incremental01 0.000830 0.000805 -3.07% 0.000938 0.000932 -0.69%

My conclusion from the results is that it adds a bit of overhead which causes slowdowns on runs that are not taking long overall and when running on a single thread, whereas for larger designs and many threads there is relevant speedup.

Verification

  • [ x ] I have verified that the local build succeeds (./etc/Build.sh).
  • [ x ] I have run the relevant tests and they pass.
  • [ x ] My code follows the repository's formatting guidelines.
  • [ x ] I have signed my commits (DCO).

Build Kokkos 4.7.02 from source with a local Bazel integration and link
it into GPL by default. Use OpenMP for host execution by default while
allowing Threads and Serial backends.

Keep CUDA builds connected to the external GPU-enabled Kokkos installation.

Signed-off-by: Artur Bieniek <abieniek@antmicro.com>
Add Kokkos 4.7.02 to the dependency installer and export its installation
prefix for CMake package discovery. Support OpenMP, Threads, and Serial
through -kokkos-backend, preserving an existing Threads backend unless
explicitly overridden.

Reuse matching host installations and configure libomp discovery on macOS.

Signed-off-by: Artur Bieniek <abieniek@antmicro.com>
Move Kokkos initialization and finalization into a common GPL runtime
available to both host and GPU backends. Preserve externally managed
Kokkos initialization and finalize only when GPL initialized it.

Require Kokkos in CMake and link the runtime in both build systems.

Signed-off-by: Artur Bieniek <abieniek@antmicro.com>
Convert native GPL parallel loops to Kokkos::parallel_for using the
default host execution space and a shared HostRange policy alias. Remove
direct OpenMP API usage from the placement code.

Centralize execution-space creation in the Kokkos runtime. Honor requested
thread counts with the OpenMP backend while retaining initialization-time
pool sizing for Threads. Compile Kokkos consumers in CUDA mode when using
a CUDA-enabled Kokkos installation.

Signed-off-by: Artur Bieniek <abieniek@antmicro.com>
Compile MBFF for the host only under Clang CUDA to avoid unsupported
device-side Boost.Math operations. Enable Boost empty-base optimization
consistently across C++ and Clang CUDA translation units to prevent
container layout mismatches.

Use a supported string allocation label in the GPU wirelength test and
clarify comments about Kokkos host execution.

Signed-off-by: Artur Bieniek <abieniek@antmicro.com>
Pin the documented KokkosFFT checkout to v2.0.0. Use static-library CMake
compiler probes with the hermetic toolchain and correct the benchmark
option to KokkosFFT_ENABLE_BENCHMARK.

Signed-off-by: Artur Bieniek <abieniek@antmicro.com>
Update the Bazel dependency, CMake requirement, dependency installer, and
documented GPU build to Kokkos 5.2.2. Match the generated Bazel host
configuration to the new release while retaining OpenMP, Threads, and
Serial backend selection.

Replace View::HostMirror with host_mirror_type for Kokkos 5 compatibility
and remove the obsolete deprecated-code option from the build instructions.

Signed-off-by: Artur Bieniek <abieniek@antmicro.com>
Remove wrapper scopes introduced during the Kokkos loop conversion to reduce indentation and simplify the code. Reuse execution-space variables for loops in the same scope with matching thread counts.

Signed-off-by: Artur Bieniek <abieniek@antmicro.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Welcome to OpenROAD! Thanks for opening your first PR.
Before we review:

Please ensure:

  • CI passes
  • Code is properly formatted
  • Tests are included where applicable
    A maintainer will review shortly!

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request replaces OpenMP parallel loops and reductions with Kokkos-based implementations across the gpl tool, integrating Kokkos 5.2.2 into both the CMake and Bazel build configurations. It also updates the dependency installer script to automate Kokkos installation. The review feedback identifies several critical issues: a compilation error in kokkosRuntime.cpp because the OpenMP execution space constructor does not accept a thread count argument, a Bazel analysis error in bazel/kokkos/BUILD due to an undeclared @kokkos repository reference, a type mismatch compilation error in nesterovBase.cpp where a float reduction is bound to a double variable, and a potential failure in DependencyInstaller.sh if the kokkos directory already exists.

Comment thread src/gpl/src/kokkosRuntime.cpp Outdated
Comment on lines +30 to +39
Kokkos::DefaultHostExecutionSpace hostExecutionSpace(
[[maybe_unused]] int num_threads)
{
ensureKokkosInitialized();
#ifdef KOKKOS_ENABLE_OPENMP
return Kokkos::DefaultHostExecutionSpace(num_threads);
#else
return Kokkos::DefaultHostExecutionSpace();
#endif
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

Kokkos::OpenMP (and thus Kokkos::DefaultHostExecutionSpace when OpenMP is enabled) does not have a constructor that accepts an int for the number of threads. This will cause a compilation error when KOKKOS_ENABLE_OPENMP is defined.

In Kokkos, the number of threads for the OpenMP backend is configured globally at initialization time (via Kokkos::InitializationSettings::set_num_threads()) or via the OMP_NUM_THREADS environment variable. It cannot be set per execution space instance.

To fix this, the function should return Kokkos::DefaultHostExecutionSpace() without any arguments.

Kokkos::DefaultHostExecutionSpace hostExecutionSpace(
    [[maybe_unused]] int num_threads)
{
  ensureKokkosInitialized();
  return Kokkos::DefaultHostExecutionSpace();
}

Comment thread bazel/kokkos/BUILD
Comment on lines +13 to +19
alias(
name = "kokkos",
actual = select({
"//:gpu_cuda": "@kokkos",
"//conditions:default": "@kokkos_host//:kokkos",
}),
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

In MODULE.bazel, the kokkos dependency is declared with repo_name = "kokkos_host". This renames the repository to kokkos_host within the module's scope, meaning the name kokkos is no longer bound to any repository.

However, in bazel/kokkos/BUILD, the alias target references @kokkos for the GPU build:

alias(
    name = "kokkos",
    actual = select({
        "//:gpu_cuda": "@kokkos",
        "//conditions:default": "@kokkos_host//:kokkos",
    }),
)

This will result in a Bazel analysis error: Repository '@kokkos' is not visible from this module because @kokkos is not declared in MODULE.bazel.

If the GPU build of Kokkos is intended to be provided by a local/system installation or a separate module extension, it must be explicitly declared and imported in MODULE.bazel (e.g., via use_repo). Otherwise, this reference will break the build when //:gpu_cuda is enabled.

Comment on lines 3600 to +3618
sumPhi_ = 0;
#pragma omp parallel for num_threads(nbc_->getNumThreads()) \
reduction(+ : sumPhi_)
for (auto it = getBins().begin(); it < getBins().end(); ++it) {
auto& bin = *it; // old-style loop for old OpenMP
auto eFieldPair = fft_->getElectroField(bin.x(), bin.y());
bin.setElectroField(eFieldPair.first, eFieldPair.second);

float electroPhi = fft_->getElectroPhi(bin.x(), bin.y());
bin.setElectroPhi(electroPhi);

sumPhi_ += electroPhi
Kokkos::parallel_reduce(
"gpl::updateElectrostaticField",
HostRange(space, 0, getBins().size()),
[&](std::size_t index, float& phi_sum) {
auto it = getBins().begin() + index;
auto& bin = *it; // Host iteration over the placement data
auto eFieldPair = fft_->getElectroField(bin.x(), bin.y());
bin.setElectroField(eFieldPair.first, eFieldPair.second);

float electroPhi = fft_->getElectroPhi(bin.x(), bin.y());
bin.setElectroPhi(electroPhi);

phi_sum
+= electroPhi
* static_cast<float>(bin.getNonPlaceArea() + bin.instPlacedArea()
+ bin.getFillerArea());
}
},
Kokkos::Sum<float>(sumPhi_));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

In NesterovBase, sumPhi_ is typically declared as a double to maintain precision for the electrostatic potential sum.

Using float& phi_sum and Kokkos::Sum<float>(sumPhi_) will cause a compilation error due to type mismatch (binding a double variable to a float& reference). Even if it compiles, it introduces unnecessary precision loss by performing the reduction in single-precision float.

We should use double for the reduction to match the type of sumPhi_.

  sumPhi_ = 0;
  Kokkos::parallel_reduce(
      "gpl::updateElectrostaticField",
      HostRange(space, 0, getBins().size()),
      [&](std::size_t index, double& phi_sum) {
        auto it = getBins().begin() + index;
        auto& bin = *it;  // Host iteration over the placement data
        auto eFieldPair = fft_->getElectroField(bin.x(), bin.y());
        bin.setElectroField(eFieldPair.first, eFieldPair.second);

        float electroPhi = fft_->getElectroPhi(bin.x(), bin.y());
        bin.setElectroPhi(electroPhi);

        phi_sum
            += electroPhi
               * static_cast<double>(bin.getNonPlaceArea() + bin.instPlacedArea()
                                    + bin.getFillerArea());
      },
      Kokkos::Sum<double>(sumPhi_));

Comment on lines +607 to +609
(
cd "${BASE_DIR}"
_execute "Cloning Kokkos..." git clone --depth=1 -b "${KOKKOS_VERSION}" https://github.com/kokkos/kokkos.git

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

If the installer script is run multiple times, or if a previous run failed, the kokkos directory might already exist in ${BASE_DIR}. In this case, git clone will fail with fatal: destination path 'kokkos' already exists and is not an empty directory., causing the script to abort.

To make the installation idempotent and robust, we should remove any existing kokkos directory before cloning.

Suggested change
(
cd "${BASE_DIR}"
_execute "Cloning Kokkos..." git clone --depth=1 -b "${KOKKOS_VERSION}" https://github.com/kokkos/kokkos.git
(
cd "${BASE_DIR}"
rm -rf kokkos
_execute "Cloning Kokkos..." git clone --depth=1 -b "${KOKKOS_VERSION}" https://github.com/kokkos/kokkos.git

Default CC and CXX to the already installed GCC Toolset 13 when building
common dependencies on RHEL 8 and compatible distributions. Preserve
explicit compiler selections and cover both -all and -common invocations.

This avoids selecting the system GCC 8.5, which Kokkos 5.2.2 does not
support. Verified an OpenMP/Serial Kokkos build on Rocky Linux 8 with
GCC 13.3.1.

Signed-off-by: Artur Bieniek <abieniek@antmicro.com>
@QuantamHD

Copy link
Copy Markdown
Collaborator

This looks good to me. I think the config select for different backends makes sense to me. Is this how the cmake version works?

@ArturBieniek4

Copy link
Copy Markdown
Author

This looks good to me. I think the config select for different backends makes sense to me. Is this how the cmake version works?

Yes, it's the same idea - in CMake the backend is chosen when Kokkos itself is built and Kokkos generates its config headers from that. Bazel builds Kokkos from source with no CMake step, so it writes the same headers based on the flag. For GPU, both builds use a prebuilt Kokkos, so the backend is defined by how that prebuilt Kokkos was configured.

@calewis calewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I mainly wonder if we can take this opportunity to set threads once and stop caching and passing the thread count around in so many locations. I'm not just being pedantic and trying to tack on work to this PR, the strategy used in kokkosRuntime, doesn't work for the Thread backend and is inefficient for the OpenMP one. Also as proof that the current strategy is fragile, BinGrid doesn't seem to even cache the number of threads properly (an existing issue), unless I missed where it is being set.

}
Kokkos::InitializationSettings settings;
settings.set_disable_warnings(true);
Kokkos::initialize(settings);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we should be setting the number of threads here and not in hostExecutionSpace. I realize that turns off dynamic thread sizing from tcl, but doing it this way without hwloc makes it so Kokkos::Threads backend will always silently be 1 thread.

I'll talk to @maliberty about whether we can lock in the number of threads before the first call to Kokkos::initialize or not.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@maliberty and I discussed that the number of threads should be dynamic so setting it once here won't work.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm afraid that dynamic changing of thread count in case of Threads backed won't work. Looks like the only way to set it is during Kokkos initialization via Kokkos::InitializationSettings and Kokkos cannot be reinitialized (both according to the docs: https://kokkos.org/kokkos-core-wiki/API/core/initialize_finalize/initialize.html Kokkos can be initialized at most once; subsequent calls are erroneous. and by inspecting the sources - it just aborts upon second call. The Threads backed implementation also doesn't expose any way to change thread count after initialization)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think that is fine, I think we expect 99% of users to be on OpenMP that is the best supported CPU backend for Kokkos anyways and it use to be the fastest CPU one (might still be). @maliberty okay with users of a not default backend losing the ability to dynamically change the number of threads (can still dynamically set it once, just can't change it once set)?

{
ensureKokkosInitialized();
#ifdef KOKKOS_ENABLE_OPENMP
return Kokkos::DefaultHostExecutionSpace(num_threads);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is going to allocate new objects every time and be more expensive than strictly needed for small loops. I'm of the opinion we should be using return Kokkos::DefaultHostExecutionSpace(); every time, but we'll need to discuss with other maintainers first.

Comment thread src/gpl/src/nesterovBase.cpp Outdated
}
}
}
const auto space = hostExecutionSpace(num_threads_);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

BinGrid appears to never set this value (defaulting to 1), making all the code that uses it in BinGrid actually serial, this is an example of where I think each class tracking threads is leading to difficulty and a single set one global solves some problems. @maliberty WDYT?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sorry I forgot to leave this comment yesterday. I talked to @maliberty and @QuantamHD last night and we were in agreement that a better solution than reconstructing a host execution space via hostExecutionSpace(num_threads_); every single time you need a space would be to have GPL/nesterov construct a space once with the correct number of threads (ideally by reading the value that was most recently set from TCL) once and then reuse that space throughout.

AFAICT once global_placement has launched the user can no longer change the number of threads until after it returns so we shouldn't need to be reconstructing theses spaces or passing around num_threads_ as member variables at all. What do you think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I discussed this with @ArturBieniek4 and there wasn't any particular reason to create new execution space each time other than to keep it on par with OpenMP code this PR replaces that was setting number of threads for every loop

Will modify it to create execution space once and reuse it

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let me know when that goes in please.

@maliberty

Copy link
Copy Markdown
Member

Please resolve the merge conflicts

@jmichalski-ant
jmichalski-ant requested a review from a team as a code owner October 14, 2026 12:06

@vvbandeira vvbandeira left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Two build issues, both inline:

  1. MODULE.bazel: the kokkos archive_override only applies in the root module, so Bazel builds that depend on openroad (for example bazel-orfs) can no longer resolve it.
  2. etc/DependencyInstaller.sh: the Kokkos step runs cmake from PATH instead of the installed ${PREFIX:-/usr/local}/bin/cmake.

Comment thread MODULE.bazel Outdated
Comment on lines +33 to +41
bazel_dep(name = "kokkos", version = "5.2.2", repo_name = "kokkos_host")
archive_override(
module_name = "kokkos",
patch_strip = 1,
patches = ["//bazel/kokkos:0001-add-bazel-build.patch"],
sha256 = "491fe02cb127559dd3c996f6693686f1eab00a53fd5c184e18e663896884175e",
strip_prefix = "kokkos-5.2.2",
urls = ["https://github.com/kokkos/kokkos/archive/refs/tags/5.2.2.tar.gz"],
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This breaks Bazel builds that use openroad as a dependency instead of as the root module.

archive_override applies only in the root module (see the note near the freetype dep in this file). BCR has no kokkos module. So a downstream root such as bazel-orfs, which pulls openroad in through archive_override, now fails module resolution with kokkos@5.2.2 not found. To fix it there, every downstream root must repeat this override and copy the patch into its own repo, because patches must be labels in the root module. test/downstream/MODULE.bazel has the same problem, and no CI job builds it, so CI cannot catch this.

Suggestion: declare the host Kokkos the same way as the GPU @kokkos below, as an http_archive with a build_file. A repository rule also works when openroad is not the root module. The patch only adds MODULE.bazel and BUILD.bazel, so you can move its BUILD.bazel to something like //bazel/kokkos:BUILD.kokkos_host.bazel and remove the MODULE.bazel part. The root module already depends on bazel_skylib, rules_cc, and openmp, so the loads in that file still resolve, and the @kokkos_host//:backend / @kokkos_host//:openmp labels stay the same.

http_archive(
    name = "kokkos_host",
    build_file = "//bazel/kokkos:BUILD.kokkos_host.bazel",
    sha256 = "d6557aaef39302282a15f9c770433d1fcdf4e961dfd6d9ed726b9d0d0f546b9f",
    strip_prefix = "kokkos-5.2.2",
    urls = ["https://github.com/kokkos/kokkos/releases/download/5.2.2/kokkos-5.2.2.tar.gz"],
)

This example uses the same release asset and sha256 as the GPU @kokkos, so both paths fetch one tarball. Please check that the overlay builds against it; it only adds files, so I expect no difference.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I modified it to use http_archive and verified that test/downstream/MODULE.bazel no longer fails on kokkos

Comment thread etc/DependencyInstaller.sh Outdated
Comment on lines +610 to +613
local cmake_bin=cmake
if [[ -n "${PREFIX}" && -x "${PREFIX}/bin/cmake" ]]; then
cmake_bin="${PREFIX}/bin/cmake"
fi

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

When PREFIX is not set, this runs cmake from PATH. The other installers in this script use ${PREFIX:-/usr/local}/bin/cmake, which is where _install_cmake installs it just before this step.

The RHEL base package list does not install cmake. With sudo, RHEL's default secure_path usually does not include /usr/local/bin. So sudo ./etc/DependencyInstaller.sh -common can fail at "Configuring Kokkos" with cmake: command not found. Docker CI runs as root with /usr/local/bin in PATH, so CI does not show this.

Suggestion, matching the Yosys step:

Suggested change
local cmake_bin=cmake
if [[ -n "${PREFIX}" && -x "${PREFIX}/bin/cmake" ]]; then
cmake_bin="${PREFIX}/bin/cmake"
fi
local cmake_bin=${PREFIX:-/usr/local}/bin/cmake
if [[ ! -f "${cmake_bin}" ]]; then
cmake_bin="cmake"
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

applied the suggestion

Signed-off-by: Jakub Michalski <jmichalski@antmicro.com>
Signed-off-by: Jakub Michalski <jmichalski@antmicro.com>
Using more than 1 thread was giving different results due to different bin
ordering and loss of precision on int64_t += float operations

Signed-off-by: Jakub Michalski <jmichalski@antmicro.com>
Signed-off-by: Jakub Michalski <jmichalski@antmicro.com>
Signed-off-by: Jakub Michalski <jmichalski@antmicro.com>
Replace archive_override with http_archive to fix module resolution in
downstream roots

Signed-off-by: Jakub Michalski <jmichalski@antmicro.com>
Signed-off-by: Jakub Michalski <jmichalski@antmicro.com>
@jmichalski-ant

jmichalski-ant commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

@calewis I modified it to reuse execution space. Its created in two places (NesterovBaseCommon and MBFF) instead of one, because those can be called independently, and then passed to the rest of the functions that need it. In case of OpenMP thread count is set dynamically, in case of Threads its set once during initialization. The thread count is based on the one passed to classes' constructors as before - this value is taken from placementThreads() in the caller and this is already derived from TCL.
There was a bug in one of BinGrid's loops that before were always running with just one thread that caused one of the tests (//src/gpl/test:mt_invariance01-tcl_test) to fail due to different results when more than one thread was used - fixed that

@vvbandeira
vvbandeira self-requested a review October 23, 2026 16:22
Signed-off-by: Jakub Michalski <jmichalski@antmicro.com>
@calewis
calewis self-requested a review October 26, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants