Skip to content

Commit 02823af

Browse files
authored
Bump LLVM to 3cc852ece438a63e7b09d1c84a81d21598454e1a. (#7847)
This was needed when llvm/llvm-project@3494ee9 landed. Similar changes were made upstream here: https://github.com/llvm/llvm-project/pull/80309/files. Basically, we now expect the width and value arguments to the APInt constructor to be consistent. There is some implicit extension or truncation depending on the signedness of the value, and now a flag to opt into it. With this change I've simply opted into the flag where necessary, rather than thinking hard about how to compute the correct width given the value. In places where the `isSigned` flag took the default value of false, I kept that when I had to explicitly set that flag. There was exactly one place (CalyxHelpers.cpp), where I actually flipped the value of `isSigned`. The comment in the code made me think this erroneously thought the flag was "isUnsigned". Also updated pybind11 version requirement to avoid this: llvm/llvm-project#115307 (comment) Finally, updated a couple handshake cocotb tests to convert to float for comparison to avoid type mismatches.
1 parent c493b8f commit 02823af

File tree

14 files changed

+25
-19
lines changed

14 files changed

+25
-19
lines changed

.github/workflows/nightlyIntegrationTests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
# John and re-run the job.
2020
runs-on: ["self-hosted", "1ES.Pool=1ES-CIRCT-builds", "linux"]
2121
container:
22-
image: ghcr.io/circt/images/circt-integration-test:v13.1
22+
image: ghcr.io/circt/images/circt-integration-test:v17.0
2323
volumes:
2424
- /mnt:/__w/circt
2525
strategy:

.github/workflows/shortIntegrationTests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
# John and re-run the job.
3030
runs-on: ["self-hosted", "1ES.Pool=1ES-CIRCT-builds", "linux"]
3131
container:
32-
image: ghcr.io/circt/images/circt-integration-test:v13.1
32+
image: ghcr.io/circt/images/circt-integration-test:v17.0
3333
volumes:
3434
- /mnt:/__w/circt
3535
strategy:

integration_test/Dialect/Handshake/multiple_loops/multiple_loops.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ async def sendMultiple(dut):
2929
res0 = [i * (i + 1) / 2 for i in range(N)]
3030
res1 = [math.factorial(i) for i in range(N)]
3131

32-
out0Check = cocotb.start_soon(out0.checkOutputs(res0))
33-
out1Check = cocotb.start_soon(out1.checkOutputs(res1))
32+
out0Check = cocotb.start_soon(out0.checkOutputs(res0, converter=float))
33+
out1Check = cocotb.start_soon(out1.checkOutputs(res1, converter=float))
3434

3535
for i in range(N):
3636
in0Send = cocotb.start_soon(in0.send(i))

integration_test/Dialect/Handshake/nested_loops/nested_loops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async def sendMultiple(dut):
2626
# sum_{i = 0}^n (sum_{j=0}^i i) = 1/6 * (n^3 + 3n^2 + 2n)
2727
res = [(1 / 6) * (n**3 + 3 * n**2 + 2 * n) for n in range(N)]
2828

29-
out0Check = cocotb.start_soon(out0.checkOutputs(res))
29+
out0Check = cocotb.start_soon(out0.checkOutputs(res, converter=float))
3030

3131
for i in range(N):
3232
in0Send = cocotb.start_soon(in0.send(i))

lib/Bindings/Python/pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ requires = [
66
"cmake>=3.12",
77
# MLIR build depends.
88
"numpy",
9-
# Pybind11 2.10 has a bug relating to binding enums.
10-
"pybind11>=2.9,!=2.10",
9+
"pybind11>=2.11,<=2.12",
1110
"PyYAML",
1211
]
1312
build-backend = "setuptools.build_meta"

lib/Conversion/DCToHW/DCToHW.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ struct RTLBuilder {
237237
}
238238

239239
Value constant(unsigned width, int64_t value, StringRef name = {}) {
240-
return constant(APInt(width, value));
240+
return constant(
241+
APInt(width, value, /*isSigned=*/false, /*implicitTrunc=*/true));
241242
}
242243
std::pair<Value, Value> wrap(Value data, Value valid, StringRef name = {}) {
243244
auto wrapOp = b.create<esi::WrapValidReadyOp>(loc, data, valid);

lib/Conversion/HandshakeToHW/HandshakeToHW.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,8 @@ struct RTLBuilder {
484484

485485
Value constant(unsigned width, int64_t value,
486486
std::optional<StringRef> name = {}) {
487-
return constant(APInt(width, value));
487+
return constant(
488+
APInt(width, value, /*isSigned=*/false, /*implicitTrunc=*/true));
488489
}
489490
std::pair<Value, Value> wrap(Value data, Value valid,
490491
std::optional<StringRef> name = {}) {

lib/Dialect/Arc/Transforms/ArcCanonicalizer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,8 @@ ICMPCanonicalizer::matchAndRewrite(comb::ICmpOp op,
446446
}
447447
rewriter.replaceOpWithNewOp<comb::ICmpOp>(
448448
op, op.getPredicate(), andOp,
449-
getConstant(APInt(*optionalWidth, rhs.getZExtValue())),
449+
getConstant(APInt(*optionalWidth, rhs.getZExtValue(),
450+
/*isSigned=*/false, /*implicitTrunc=*/true)),
450451
op.getTwoState());
451452
return success();
452453
}
@@ -464,7 +465,8 @@ ICMPCanonicalizer::matchAndRewrite(comb::ICmpOp op,
464465
}
465466
rewriter.replaceOpWithNewOp<comb::ICmpOp>(
466467
op, op.getPredicate(), orOp,
467-
getConstant(APInt(*optionalWidth, rhs.getZExtValue())),
468+
getConstant(APInt(*optionalWidth, rhs.getZExtValue(),
469+
/*isSigned=*/false, /*implicitTrunc=*/true)),
468470
op.getTwoState());
469471
return success();
470472
}

lib/Dialect/Calyx/Transforms/CalyxHelpers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ hw::ConstantOp createConstant(Location loc, OpBuilder &builder,
3232
size_t value) {
3333
OpBuilder::InsertionGuard g(builder);
3434
builder.setInsertionPointToStart(component.getBodyBlock());
35-
return builder.create<hw::ConstantOp>(loc,
36-
APInt(width, value, /*unsigned=*/true));
35+
return builder.create<hw::ConstantOp>(
36+
loc, APInt(width, value, /*isSigned=*/false));
3737
}
3838

3939
calyx::InstanceOp createInstance(Location loc, OpBuilder &builder,

lib/Dialect/Calyx/Transforms/RemoveCombGroups.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ struct RemoveCombGroupsPattern : public OpRewritePattern<calyx::CombGroupOp> {
140140

141141
rewriter.setInsertionPointToStart(group.getBodyBlock());
142142
auto oneConstant = rewriter.create<hw::ConstantOp>(
143-
group.getLoc(), APInt(1, 1, /*isSigned=*/true));
143+
group.getLoc(), APInt(1, 1, /*isSigned=*/true, /*implicitTrunc=*/true));
144144

145145
// Maintain the set of cell results which have already been assigned to
146146
// its register within this group.

0 commit comments

Comments
 (0)