Skip to content

Commit dfe887e

Browse files
denialhaagCopilot
andcommitted
Streamline the capitalization and stylization of jeff
Co-authored-by: Copilot <copilot@github.com>
1 parent b8ec0fa commit dfe887e

7 files changed

Lines changed: 44 additions & 43 deletions

File tree

docs/mlir/Conversions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
1111
```
1212

13-
## Jeff Conversions
13+
## `jeff` Conversions
1414

1515
```{include} Conversions/QCOToJeff.md
1616

mlir/include/mlir/Conversion/JeffToQCO/JeffToQCO.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
include "mlir/Pass/PassBase.td"
1010

1111
def JeffToQCO : Pass<"jeff-to-qco"> {
12-
let summary = "Convert Jeff operations to QCO operations";
12+
let summary = "Convert `jeff` operations to QCO operations";
1313

1414
let description = [{
15-
This pass converts all operations from the Jeff dialect to their equivalent operations in the QCO dialect.
15+
This pass converts all operations from the `jeff` dialect to their equivalent operations in the QCO dialect.
1616
It ensures that the returned module is a valid QCO module.
1717

18-
Note that this pass is still in development as QCO and Jeff do not have full feature parity yet.
18+
Note that this pass is still in development as QCO and `jeff` do not have full feature parity yet.
1919

2020
Known limitations:
2121

mlir/include/mlir/Conversion/QCOToJeff/QCOToJeff.td

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@
99
include "mlir/Pass/PassBase.td"
1010

1111
def QCOToJeff : Pass<"qco-to-jeff"> {
12-
let summary = "Convert QCO operations to Jeff operations";
12+
let summary = "Convert QCO operations to `jeff` operations";
1313

1414
let description = [{
15-
This pass converts all operations from the QCO dialect to their equivalent operations in the Jeff dialect.
16-
It ensures that the returned module is a valid Jeff module that can be serialized.
15+
This pass converts all operations from the QCO dialect to their equivalent operations in the `jeff` dialect.
16+
It ensures that the returned module is a valid `jeff` module that can be serialized.
1717

18-
Note that this pass is still in development as QCO and Jeff do not have full feature parity yet.
18+
Note that this pass is still in development as QCO and `jeff` do not have full feature parity yet.
1919

20-
`qco.static` is currently converted to `jeff.qubit_alloc` because Jeff does not yet represent static (index-based) qubits; the index is not preserved in Jeff IR. Round-tripping through Jeff therefore maps static qubits to dynamic allocation on the QCO side.
20+
`qco.static` is currently converted to `jeff.qubit_alloc` because `jeff` does not yet represent static (index-based) qubits; the index is not preserved in `jeff` IR.
21+
Round-tripping through `jeff` therefore maps static qubits to dynamic allocation on the QCO side.
2122
}];
2223

2324
let dependentDialects = ["mlir::jeff::JeffDialect"];

mlir/lib/Conversion/JeffToQCO/JeffToQCO.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ using namespace qco;
4848
#include "mlir/Conversion/JeffToQCO/JeffToQCO.h.inc"
4949

5050
/**
51-
* @brief Creates a modified QCO operation from a Jeff operation
51+
* @brief Creates a modified QCO operation from a jeff operation
5252
*
53-
* @tparam JeffOpType The operation type of the Jeff operation
54-
* @param op The Jeff operation instance to convert
53+
* @tparam JeffOpType The operation type of the jeff operation
54+
* @param op The jeff operation instance to convert
5555
* @param rewriter The pattern rewriter
5656
* @param controls The control qubits of the operation
5757
* @param targets The target qubits of the operation
@@ -87,19 +87,19 @@ createModified(JeffOpType& op, ConversionPatternRewriter& rewriter,
8787
}
8888

8989
/**
90-
* @brief Creates a (potentially modified) QCO operation from a Jeff operation.
90+
* @brief Creates a (potentially modified) QCO operation from a jeff operation.
9191
*
9292
* @details
9393
* This helper centralizes the "direct vs. ctrl/inv-wrapped" decision and uses
9494
* index sequences to forward the desired number of targets and parameters into
9595
* the QCO op builder.
9696
*
9797
* @tparam QCOOpType The QCO operation type to create
98-
* @tparam JeffOpType The Jeff operation type to convert from
98+
* @tparam JeffOpType The jeff operation type to convert from
9999
* @tparam TargetIndices Indices of target operands to forward
100100
* @tparam ParamIndices Indices of parameters to forward
101101
*
102-
* @param op The Jeff operation instance to convert
102+
* @param op The jeff operation instance to convert
103103
* @param rewriter The pattern rewriter
104104
* @param controls The control qubits (type-converted) of the operation
105105
* @param targets The target qubits (type-converted) of the operation
@@ -137,11 +137,11 @@ createGateFromJeffArity(JeffOpType& op, ConversionPatternRewriter& rewriter,
137137
ValueRange parameters = {}) {
138138
if (targets.size() != NumTargets) {
139139
return rewriter.notifyMatchFailure(
140-
op, "Unexpected number of target qubits for Jeff-to-QCO conversion");
140+
op, "Unexpected number of target qubits for jeff-to-QCO conversion");
141141
}
142142
if (parameters.size() != NumParams) {
143143
return rewriter.notifyMatchFailure(
144-
op, "Unexpected number of parameters for Jeff-to-QCO conversion");
144+
op, "Unexpected number of parameters for jeff-to-QCO conversion");
145145
}
146146

147147
return createGateFromJeff<QCOOpType, JeffOpType>(
@@ -532,10 +532,10 @@ struct ConvertJeffGPhaseOpToQCO final : OpConversionPattern<jeff::GPhaseOp> {
532532
};
533533

534534
/**
535-
* @brief Converts one-target, zero-parameter Jeff gate to QCO
535+
* @brief Converts one-target, zero-parameter jeff gate to QCO
536536
*
537537
* @tparam QCOOpType The operation type of the QCO operation
538-
* @tparam JeffOpType The operation type of the Jeff operation
538+
* @tparam JeffOpType The operation type of the jeff operation
539539
*
540540
* @par Example:
541541
* ```mlir
@@ -566,10 +566,10 @@ struct ConvertJeffOneTargetZeroParameterToQCO final
566566
};
567567

568568
/**
569-
* @brief Converts one-target, one-parameter Jeff gate to QCO
569+
* @brief Converts one-target, one-parameter jeff gate to QCO
570570
*
571571
* @tparam QCOOpType The operation type of the QCO operation
572-
* @tparam JeffOpType The operation type of the Jeff operation
572+
* @tparam JeffOpType The operation type of the jeff operation
573573
*
574574
* @par Example:
575575
* ```mlir
@@ -814,7 +814,7 @@ struct ConvertJeffPPROpToQCO final : OpConversionPattern<jeff::PPROp> {
814814
};
815815

816816
/**
817-
* @brief Converts the Jeff-style main function to a QCO-style main function
817+
* @brief Converts the jeff-style main function to a QCO-style main function
818818
*
819819
* @par Example:
820820
* ```mlir
@@ -873,7 +873,7 @@ struct ConvertJeffMainToQCO final : OpConversionPattern<func::FuncOp> {
873873
};
874874

875875
/**
876-
* @brief Type converter for Jeff-to-QCO conversion
876+
* @brief Type converter for jeff-to-QCO conversion
877877
*
878878
* @details
879879
* Converts `!jeff.qubit` to `!qco.qubit` and `!jeff.qureg` to
@@ -896,7 +896,7 @@ class JeffToQCOTypeConverter final : public TypeConverter {
896896
};
897897

898898
/**
899-
* @brief Pass for converting Jeff operations to QCO operations
899+
* @brief Pass for converting jeff operations to QCO operations
900900
*/
901901
struct JeffToQCO final : impl::JeffToQCOBase<JeffToQCO> {
902902
using JeffToQCOBase::JeffToQCOBase;

mlir/lib/Conversion/QCOToJeff/QCOToJeff.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,13 @@ template <size_t NumParams, typename OpAdaptor>
170170
}
171171

172172
/**
173-
* @brief Lowers QCO gates to matching Jeff ops.
173+
* @brief Lowers QCO gates to matching jeff ops.
174174
*
175175
* @details Uses `getEffectiveTargetOperands` and forwards target and parameter
176176
* indices into `JeffOpType::create`.
177177
*
178178
* @tparam QCOOpType The QCO gate op type
179-
* @tparam JeffOpType The Jeff op type
179+
* @tparam JeffOpType The jeff op type
180180
* @tparam ExtraAdjoint Whether to XOR the adjoint flag
181181
* @tparam TargetIndices QCO target indices to forward
182182
* @tparam ParamIndices QCO parameter indices to forward
@@ -201,7 +201,7 @@ convertJeffGate(QCOOpType op, typename QCOOpType::Adaptor adaptor,
201201
/*is_adjoint=*/state.inInvOp ^ ExtraAdjoint,
202202
/*power=*/1);
203203

204-
// Jeff well-known gates: leading results are transformed targets, then ctrl
204+
// jeff well-known gates: leading results are transformed targets, then ctrl
205205
// outs (same ordering as `getOutQubit` / `getOutCtrlQubits` accessors).
206206
constexpr std::size_t numTargets = sizeof...(TargetIndices);
207207
auto results = jeffOp->getResults();
@@ -490,10 +490,10 @@ struct ConvertQCOAllocOpToJeff final : StatefulOpConversionPattern<AllocOp> {
490490
* @brief Converts qco.static to jeff.qubit_alloc
491491
*
492492
* @details
493-
* The Jeff dialect does not model hardware-mapped or fixed-index static
493+
* The jeff dialect does not model hardware-mapped or fixed-index static
494494
* qubits yet. As a temporary workaround (see discussion on #1626), this
495495
* lowers `qco.static` to the same `jeff.qubit_alloc` operation used for
496-
* `qco.alloc`. The static index is not represented in Jeff IR; if Jeff gains
496+
* `qco.alloc`. The static index is not represented in jeff IR; if jeff gains
497497
* static qubit support, this conversion should be revisited.
498498
*
499499
* @par Example:
@@ -628,10 +628,10 @@ struct ConvertQCOGPhaseOpToJeff final : StatefulOpConversionPattern<GPhaseOp> {
628628
};
629629

630630
/**
631-
* @brief Converts a QCO gate that lowers to a well-known Jeff op.
631+
* @brief Converts a QCO gate that lowers to a well-known jeff op.
632632
*
633633
* @tparam QCOOpType QCO operation type.
634-
* @tparam JeffOpType Jeff op type passed to `convertJeffGate` /
634+
* @tparam JeffOpType jeff op type passed to `convertJeffGate` /
635635
* `JeffOpType::create`.
636636
* @tparam NumTargets Number of target operands (1 or 2 for supported gates).
637637
* @tparam NumParams Number of real parameters on the QCO op.
@@ -855,7 +855,7 @@ struct ConvertQCOBarrierOpToJeff final
855855
};
856856

857857
/**
858-
* @brief Converts qco.ctrl to Jeff by inlining the region
858+
* @brief Converts qco.ctrl to jeff by inlining the region
859859
*
860860
* @par Example:
861861
* ```mlir
@@ -905,7 +905,7 @@ struct ConvertQCOCtrlOpToJeff final : StatefulOpConversionPattern<CtrlOp> {
905905
};
906906

907907
/**
908-
* @brief Converts qco.inv to Jeff by inlining the region
908+
* @brief Converts qco.inv to jeff by inlining the region
909909
*
910910
* @par Example:
911911
* ```mlir
@@ -990,7 +990,7 @@ struct ConvertQCOYieldOpToJeff final : StatefulOpConversionPattern<YieldOp> {
990990
};
991991

992992
/**
993-
* @brief Converts the QCO-style main function to a Jeff-style main function
993+
* @brief Converts the QCO-style main function to a jeff-style main function
994994
*
995995
* @par Example:
996996
* ```mlir
@@ -1052,7 +1052,7 @@ struct ConvertQCOMainToJeff final : StatefulOpConversionPattern<func::FuncOp> {
10521052
};
10531053

10541054
/**
1055-
* @brief Type converter for QCO-to-Jeff conversion
1055+
* @brief Type converter for QCO-to-jeff conversion
10561056
*
10571057
* @details
10581058
* Converts `!qco.qubit` to `!jeff.qubit` and `tensor<?x!qco.qubit>` to
@@ -1088,7 +1088,7 @@ template <auto...> struct AlwaysFalse : std::false_type {};
10881088

10891089
/** @brief QCO→Jeff gate lowering category. */
10901090
enum class JeffKind : std::uint8_t {
1091-
/// Lower to a Jeff gate from the standard `WellKnownGate` set (Jeff spec:
1091+
/// Lower to a jeff gate from the standard `WellKnownGate` set (jeff spec:
10921092
/// `QubitGate.gate.wellKnown`).
10931093
WellKnown,
10941094
Custom, //!< Lower to jeff.custom with a name string.
@@ -1108,14 +1108,14 @@ struct PPRPaulis {
11081108
* @brief Registers one QCO→Jeff rewrite pattern for a gate described at compile
11091109
* time.
11101110
*
1111-
* @tparam Kind How to lower: well-known Jeff op, `jeff.custom`, `jeff.ppr`, or
1111+
* @tparam Kind How to lower: well-known jeff op, `jeff.custom`, `jeff.ppr`, or
11121112
* special-case `qco.u2` → `jeff.u`.
11131113
* @tparam Targets Number of target qubits for the QCO op.
11141114
* @tparam Params Number of real parameters on the QCO op.
11151115
* @tparam QCOOpType MLIR QCO operation type.
1116-
* @tparam JeffOpType Jeff operation type for `JeffKind::WellKnown` (or `void`
1116+
* @tparam JeffOpType jeff operation type for `JeffKind::WellKnown` (or `void`
11171117
* for custom/PPR paths that do not use it).
1118-
* @tparam JeffBaseAdjoint For well-known ops: whether the Jeff op represents
1118+
* @tparam JeffBaseAdjoint For well-known ops: whether the jeff op represents
11191119
* the adjoint of the QCO base gate (e.g. S† as `jeff.s` with adjoint set).
11201120
* @param patterns Pattern set to add to.
11211121
* @param typeConverter QCO→Jeff type converter passed to patterns.
@@ -1172,7 +1172,7 @@ static void addQCOToJeffGatePattern(RewritePatternSet& patterns,
11721172
namespace {
11731173

11741174
/**
1175-
* @brief Pass for converting QCO operations to Jeff operations
1175+
* @brief Pass for converting QCO operations to jeff operations
11761176
*/
11771177
struct QCOToJeff final : impl::QCOToJeffBase<QCOToJeff> {
11781178
using QCOToJeffBase::QCOToJeffBase;

mlir/lib/Conversion/QCToQCO/QCToQCO.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ struct QCToQCO final : impl::QCToQCOBase<QCToQCO> {
10331033
ConvertQCCtrlOp, ConvertQCInvOp, ConvertQCYieldOp>(
10341034
typeConverter, context, &state);
10351035

1036-
// Not part of the central gate table (no Jeff/QIR lowering).
1036+
// Not part of the central gate table.
10371037
patterns.add<ConvertQCGateToQCO<qc::GPhaseOp, qco::GPhaseOp, 0, 1>>(
10381038
typeConverter, context, &state);
10391039

mlir/unittests/Conversion/JeffRoundTrip/test_jeff_round_trip.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ TEST_P(JeffRoundTripTest, ProgramEquivalence) {
101101
EXPECT_TRUE(verify(*program).succeeded());
102102

103103
EXPECT_TRUE(succeeded(convertQCOToJeff(program.get())));
104-
printer.record(program.get(), "Converted Jeff IR" + name);
104+
printer.record(program.get(), "Converted jeff IR" + name);
105105
EXPECT_TRUE(verify(*program).succeeded());
106106

107107
PassManager pm(context.get());
@@ -110,7 +110,7 @@ TEST_P(JeffRoundTripTest, ProgramEquivalence) {
110110
pm.addPass(createRemoveDeadValuesPass());
111111
EXPECT_TRUE(pm.run(program.get()).succeeded());
112112

113-
printer.record(program.get(), "Canonicalized Converted Jeff IR" + name);
113+
printer.record(program.get(), "Canonicalized Converted jeff IR" + name);
114114
EXPECT_TRUE(verify(*program).succeeded());
115115

116116
// Serialize and deserialize to ensure the jeff program is valid

0 commit comments

Comments
 (0)