Skip to content

Commit

Permalink
chore(compiler): please clang-format 18.1.3 formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
aPere3 committed Jan 20, 2025
1 parent 934d659 commit 8ead057
Show file tree
Hide file tree
Showing 24 changed files with 69 additions and 77 deletions.
4 changes: 2 additions & 2 deletions compilers/concrete-compiler/compiler/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,11 @@ LIBTOOL_EXTRA_ARGS=--tag=CXX --mode=link cc
else
LIBTOOL_EXTRA_ARGS=
endif
LIBCONCRETE_CPU=../../../../../backends/concrete-cpu/implementation/target/release/libconcrete_cpu.a
fatlib: concretecompiler
cmake --build $(BUILD_DIR) --target ConcretelangRuntimeStatic
cd $(BUILD_DIR)/lib && \
libtool $(LIBTOOL_EXTRA_ARGS) -static -o libConcretelangFat.a lib*.a \
../../../../../backends/concrete-cpu/implementation/target/release/libconcrete_cpu.a
libtool $(LIBTOOL_EXTRA_ARGS) -static -o libConcretelangFat.a lib*.a $(LIBCONCRETE_CPU)

GITHUB_URL=https://api.github.com/repos/zama-ai/concrete-compiler-internal
GITHUB_URL_LIST_ARTIFACTS="${GITHUB_URL}/actions/artifacts?name=${KEYSETCACHENAME}&per_page=1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class ClientCircuit {
std::vector<OutputTransformer> outputTransformers,
bool simulated)
: circuitInfo(circuitInfo), inputTransformers(inputTransformers),
outputTransformers(outputTransformers), simulated(simulated) {};
outputTransformers(outputTransformers), simulated(simulated){};
static Result<ClientCircuit>
create(const Message<concreteprotocol::CircuitInfo> &info,
const ClientKeyset &keyset,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ template <typename Csprng> class CSPRNG {
other.ptr = nullptr;
};

CSPRNG(Csprng *ptr) : ptr(ptr) {};
CSPRNG(Csprng *ptr) : ptr(ptr){};
};

class SoftCSPRNG : public CSPRNG<Csprng> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace error {
/// The type of error used throughout the client/server libs.
class StringError {
public:
StringError(std::string mesg) : mesg(mesg) {};
StringError(std::string mesg) : mesg(mesg){};

std::string mesg;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class LweSecretKey {
LweSecretKey() = delete;
LweSecretKey(std::shared_ptr<std::vector<uint64_t>> buffer,
Message<concreteprotocol::LweSecretKeyInfo> info)
: buffer(buffer), info(info) {};
: buffer(buffer), info(info){};

static LweSecretKey
fromProto(const Message<concreteprotocol::LweSecretKey> &proto);
Expand Down Expand Up @@ -91,7 +91,7 @@ class LweBootstrapKey {
Message<concreteprotocol::LweBootstrapKeyInfo> info)
: seededBuffer(std::make_shared<std::vector<uint64_t>>()), buffer(buffer),
info(info), decompress_mutext(std::make_shared<std::mutex>()),
decompressed(std::make_shared<bool>(false)) {};
decompressed(std::make_shared<bool>(false)){};

/// @brief Initialize the key from the protocol message.
static LweBootstrapKey
Expand All @@ -117,7 +117,7 @@ class LweBootstrapKey {
: seededBuffer(std::make_shared<std::vector<uint64_t>>()),
buffer(std::make_shared<std::vector<uint64_t>>()), info(info),
decompress_mutext(std::make_shared<std::mutex>()),
decompressed(std::make_shared<bool>(false)) {};
decompressed(std::make_shared<bool>(false)){};
LweBootstrapKey() = delete;

/// @brief The buffer of the seeded key if needed.
Expand Down Expand Up @@ -147,7 +147,7 @@ class LweKeyswitchKey {
Message<concreteprotocol::LweKeyswitchKeyInfo> info)
: seededBuffer(std::make_shared<std::vector<uint64_t>>()), buffer(buffer),
info(info), decompress_mutext(std::make_shared<std::mutex>()),
decompressed(std::make_shared<bool>(false)) {};
decompressed(std::make_shared<bool>(false)){};

/// @brief Initialize the key from the protocol message.
static LweKeyswitchKey
Expand All @@ -173,7 +173,7 @@ class LweKeyswitchKey {
: seededBuffer(std::make_shared<std::vector<uint64_t>>()),
buffer(std::make_shared<std::vector<uint64_t>>()), info(info),
decompress_mutext(std::make_shared<std::mutex>()),
decompressed(std::make_shared<bool>(false)) {};
decompressed(std::make_shared<bool>(false)){};

/// @brief The buffer of the seeded key if needed.
std::shared_ptr<std::vector<uint64_t>> seededBuffer;
Expand Down Expand Up @@ -204,7 +204,7 @@ class PackingKeyswitchKey {
PackingKeyswitchKey() = delete;
PackingKeyswitchKey(std::shared_ptr<std::vector<uint64_t>> buffer,
Message<concreteprotocol::PackingKeyswitchKeyInfo> info)
: buffer(buffer), info(info) {};
: buffer(buffer), info(info){};

static PackingKeyswitchKey
fromProto(const Message<concreteprotocol::PackingKeyswitchKey> &proto);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct Keyset {
ServerKeyset server;
ClientKeyset client;

Keyset() {};
Keyset(){};

/// @brief Generates a keyset from infos.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ struct Value {
Tensor<uint64_t>, Tensor<int64_t>>
inner;
Value() = default;
Value(Tensor<uint8_t> inner) : inner(inner) {};
Value(Tensor<uint16_t> inner) : inner(inner) {};
Value(Tensor<uint32_t> inner) : inner(inner) {};
Value(Tensor<uint64_t> inner) : inner(inner) {};
Value(Tensor<int8_t> inner) : inner(inner) {};
Value(Tensor<int16_t> inner) : inner(inner) {};
Value(Tensor<int32_t> inner) : inner(inner) {};
Value(Tensor<int64_t> inner) : inner(inner) {};
Value(Tensor<uint8_t> inner) : inner(inner){};
Value(Tensor<uint16_t> inner) : inner(inner){};
Value(Tensor<uint32_t> inner) : inner(inner){};
Value(Tensor<uint64_t> inner) : inner(inner){};
Value(Tensor<int8_t> inner) : inner(inner){};
Value(Tensor<int16_t> inner) : inner(inner){};
Value(Tensor<int32_t> inner) : inner(inner){};
Value(Tensor<int64_t> inner) : inner(inner){};

/// Turns a server value to a client value, without interpreting the kind of
/// value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace concretelang {

struct ScalarLoweringParameters {
size_t polynomialSize;
ScalarLoweringParameters(size_t polySize) : polynomialSize(polySize) {};
ScalarLoweringParameters(size_t polySize) : polynomialSize(polySize){};
};

/// Create a pass to convert `FHE` dialect to `TFHE` dialect with the scalar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ void emitErrorBadLutSize(Op &op, std::string lutName, std::string inputName,
auto s = op.emitOpError();
s << ": `" << lutName << "` (operand #2)"
<< " inner dimension should have size " << expectedSize << "(=2^"
<< bitWidth << ") to match "
<< "`" << inputName << "` (operand #1)"
<< bitWidth << ") to match " << "`" << inputName << "` (operand #1)"
<< " elements bitwidth (" << bitWidth << ")";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ struct CompilationOptions {
batchTFHEOps(false), maxBatchSize(std::numeric_limits<int64_t>::max()),
emitSDFGOps(false), unrollLoopsWithSDFGConvertibleOps(false),
optimizeTFHE(true), chunkIntegers(false), chunkSize(4), chunkWidth(2),
encodings(std::nullopt), enableTluFusing(true),
printTluFusing(false) {};
encodings(std::nullopt), enableTluFusing(true), printTluFusing(false){};

/// @brief Constructor for CompilationOptions with default parameters for a
/// specific backend.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ namespace concretelang {
/// }
class StreamStringError {
public:
StreamStringError(const llvm::StringRef &s) : buffer(s.str()), os(buffer) {};
StreamStringError() : buffer(""), os(buffer) {};
StreamStringError(const llvm::StringRef &s) : buffer(s.str()), os(buffer){};
StreamStringError() : buffer(""), os(buffer){};

template <typename T> StreamStringError &operator<<(const T &v) {
this->os << v;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
black==24.4.0
pylint==2.11.1
pylint==3.3.3
mypy==1.11.2
numpy>=1.23,<2.0
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ struct FHEToTFHEScalarPass : public FHEToTFHEScalarBase<FHEToTFHEScalarPass> {

FHEToTFHEScalarPass(
mlir::concretelang::ScalarLoweringParameters loweringParams)
: loweringParameters(loweringParams) {};
: loweringParameters(loweringParams){};

void runOnOperation() override {
auto op = this->getOperation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct LinalgGenericOpWithTensorsToLoopsPass
LinalgGenericOpWithTensorsToLoopsPass> {
LinalgGenericOpWithTensorsToLoopsPass() = delete;
LinalgGenericOpWithTensorsToLoopsPass(bool parallelizeLoops)
: parallelizeLoops(parallelizeLoops) {};
: parallelizeLoops(parallelizeLoops){};
void runOnOperation() final;

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct TFHEGlobalParametrizationPass
: public TFHEGlobalParametrizationBase<TFHEGlobalParametrizationPass> {
TFHEGlobalParametrizationPass(
const mlir::concretelang::V0Parameter cryptoParameters)
: cryptoParameters(cryptoParameters) {};
: cryptoParameters(cryptoParameters){};
void runOnOperation() final;
const mlir::concretelang::V0Parameter cryptoParameters;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class KeyConverter {

public:
KeyConverter(mlir::concretelang::TFHE::TFHECircuitKeys &circuitKeys)
: circuitKeys(circuitKeys) {};
: circuitKeys(circuitKeys){};

TFHE::GLWESecretKey convertSecretKey(TFHE::GLWESecretKey sk) {
auto parameterizedKey = sk.getParameterized().value();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ struct MANPPass : public MANPBase<MANPPass> {
return signalPassFailure();
}
MANPPass() = delete;
MANPPass(bool debug) : debug(debug) {};
MANPPass(bool debug) : debug(debug){};

protected:
bool debug;
Expand All @@ -1358,7 +1358,7 @@ struct MaxMANPPass : public MaxMANPBase<MaxMANPPass> {
}
MaxMANPPass() = delete;
MaxMANPPass(std::function<void(const uint64_t, unsigned)> updateMax)
: updateMax(updateMax) {};
: updateMax(updateMax){};

protected:
void processOperation(mlir::Operation *op) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class FHEBigIntTransformPass
: public FHEBigIntTransformBase<FHEBigIntTransformPass> {
public:
FHEBigIntTransformPass(unsigned int chunkSize, unsigned int chunkWidth)
: chunkSize(chunkSize), chunkWidth(chunkWidth) {};
: chunkSize(chunkSize), chunkWidth(chunkWidth){};

void runOnOperation() override {
mlir::Operation *op = getOperation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ LogicalResult verifyTensorBroadcastingRules(
op->emitOpError() << "has the dimension #"
<< (operandsShapes[j].size() - k)
<< " of the operand #" << j
<< " incompatible with other operands"
<< ", got " << operandDim << " expect 1 or "
<< expectedResultDim;
<< " incompatible with other operands" << ", got "
<< operandDim << " expect 1 or " << expectedResultDim;
return mlir::failure();
}

Expand Down Expand Up @@ -706,9 +705,9 @@ template <typename MatMulOp> mlir::LogicalResult verifyMatmul(MatMulOp &op) {
// 1xMxN @ KxLxNxP -> KxLxMxP

if (lhsShape[lhsDims - 1] != rhsShape[rhsDims - 2]) {
op.emitOpError() << "should have the same size "
<< "on dimension #" << lhsDims - 1 << " of operand #0 "
<< "and dimension #" << rhsDims - 2 << " of operand #1";
op.emitOpError() << "should have the same size " << "on dimension #"
<< lhsDims - 1 << " of operand #0 " << "and dimension #"
<< rhsDims - 2 << " of operand #1";
return mlir::failure();
}

Expand Down Expand Up @@ -759,8 +758,8 @@ template <typename MatMulOp> mlir::LogicalResult verifyMatmul(MatMulOp &op) {

if (rhsShape[rhsDims - 2] != lhsShape[0]) {
op.emitOpError() << "should have the same size "
<< "on dimension #0 of operand #0 "
<< "and dimension #" << rhsDims - 2 << " of operand #1";
<< "on dimension #0 of operand #0 " << "and dimension #"
<< rhsDims - 2 << " of operand #1";
return mlir::failure();
}

Expand All @@ -777,8 +776,8 @@ template <typename MatMulOp> mlir::LogicalResult verifyMatmul(MatMulOp &op) {
// KxLxMxN @ N -> KxLxM

if (lhsShape[lhsDims - 1] != rhsShape[0]) {
op.emitOpError() << "should have the same size "
<< "on dimension #" << lhsDims - 1 << " of operand #0 "
op.emitOpError() << "should have the same size " << "on dimension #"
<< lhsDims - 1 << " of operand #0 "
<< "and dimension #0 of operand #1";
return mlir::failure();
}
Expand Down Expand Up @@ -1091,11 +1090,10 @@ mlir::LogicalResult Maxpool2dOp::verify() {
const FHE::FheIntegerInterface outputElementTy = outputTy.getElementType();

if (inputElementTy != outputElementTy) {
this->emitOpError() << "expected output element type "
<< "(" << outputElementTy << ") "
<< "to be the same with input element type "
<< "(" << inputElementTy << ") "
<< "but it is not";
this->emitOpError() << "expected output element type " << "("
<< outputElementTy << ") "
<< "to be the same with input element type " << "("
<< inputElementTy << ") " << "but it is not";
return mlir::failure();
}

Expand Down Expand Up @@ -1125,10 +1123,9 @@ mlir::LogicalResult Maxpool2dOp::verify() {
kernelShapeAttrTy.getShape();

if (kernelShapeAttrShape.size() != 1 || kernelShapeAttrShape[0] != 2) {
this->emitOpError() << "expected kernel shape to be of shape "
<< "(2) "
<< "but it is of shape "
<< "(" << kernelShapeAttrShape << ")";
this->emitOpError() << "expected kernel shape to be of shape " << "(2) "
<< "but it is of shape " << "(" << kernelShapeAttrShape
<< ")";
return mlir::failure();
}

Expand All @@ -1149,10 +1146,9 @@ mlir::LogicalResult Maxpool2dOp::verify() {
const llvm::ArrayRef<int64_t> stridesAttrShape = stridesAttrTy.getShape();

if (stridesAttrShape.size() != 1 || stridesAttrShape[0] != 2) {
this->emitOpError() << "expected strides to be of shape "
<< "(2) "
<< "but it is of shape "
<< "(" << stridesAttrShape << ")";
this->emitOpError() << "expected strides to be of shape " << "(2) "
<< "but it is of shape " << "(" << stridesAttrShape
<< ")";
return mlir::failure();
}

Expand Down Expand Up @@ -1183,10 +1179,9 @@ mlir::LogicalResult Maxpool2dOp::verify() {
dilationsAttrTy.getShape();

if (dilationsAttrShape.size() != 1 || dilationsAttrShape[0] != 2) {
this->emitOpError() << "expected dilations to be of shape "
<< "(2) "
<< "but it is of shape "
<< "(" << dilationsAttrShape << ")";
this->emitOpError() << "expected dilations to be of shape " << "(2) "
<< "but it is of shape " << "(" << dilationsAttrShape
<< ")";
return mlir::failure();
}

Expand Down Expand Up @@ -1218,9 +1213,8 @@ mlir::LogicalResult Maxpool2dOp::verify() {
};

if (outputShape != llvm::ArrayRef(expectedOutputShape)) {
this->emitOpError() << "expected output to be of shape "
<< "(" << expectedOutputShape << ") "
<< "but it is of shape "
this->emitOpError() << "expected output to be of shape " << "("
<< expectedOutputShape << ") " << "but it is of shape "
<< "(" << outputShape << ")";
return mlir::failure();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ struct BufferizeDataflowTaskOpsPass
signalPassFailure();
}

BufferizeDataflowTaskOpsPass(bool debug) : debug(debug) {};
BufferizeDataflowTaskOpsPass(bool debug) : debug(debug){};

protected:
bool debug;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ struct BuildDataflowTaskGraphPass
(void)mlir::simplifyRegions(rewriter, func->getRegions());
});
}
BuildDataflowTaskGraphPass(bool debug) : debug(debug) {};
BuildDataflowTaskGraphPass(bool debug) : debug(debug){};

protected:
mlir::WalkResult processOperation(mlir::Operation *op) {
Expand Down
Loading

0 comments on commit 8ead057

Please sign in to comment.