Skip to content

Commit

Permalink
fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
miles-six authored and BourgerieQuentin committed Apr 3, 2024
1 parent 9e82a04 commit 31f821b
Show file tree
Hide file tree
Showing 70 changed files with 100 additions and 100 deletions.
4 changes: 2 additions & 2 deletions backends/concrete-cpu/implementation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ In order to be integrated in a C-based project like the `concrete-compiler` runt

### Prerequisites

The `concrete-cpu` project is implemented thanks Rust, thus as the main prerequiste the rust toolchain must be installed. You can install from the official [Install Rust instructions](https://www.rust-lang.org/tools/install). Some of features like the use of avx512 instructions are available only with a nightly rust toolchain so if you want to use it you need to install it following those [instructions](https://rust-lang.github.io/rustup/concepts/channels.html).
The `concrete-cpu` project is implemented thanks Rust, thus as the main prerequisite the rust toolchain must be installed. You can install from the official [Install Rust instructions](https://www.rust-lang.org/tools/install). Some of features like the use of avx512 instructions are available only with a nightly rust toolchain so if you want to use it you need to install it following those [instructions](https://rust-lang.github.io/rustup/concepts/channels.html).

### Setting RUSTFLAGS

As mentionned before the `concrete-cpu` project aims to use moderns CPU features, to be sure to activate all that is available in your machine you can export the following rust flags:
As mentioned before the `concrete-cpu` project aims to use moderns CPU features, to be sure to activate all that is available in your machine you can export the following rust flags:

```
export RUSTFLAGS="-C target-cpu=native"
Expand Down
6 changes: 3 additions & 3 deletions backends/concrete-cuda/implementation/src/fft/bnsmfft.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ template <class params> __device__ void NSMFFT_direct(double2 *A) {
// from level 8, we need to check size of params degree, because we support
// minimum actual polynomial size = 256, when compressed size is halfed and
// minimum supported compressed size is 128, so we always need first 7
// levels of butterfy operation, since butterfly levels are hardcoded
// levels of butterfly operation, since butterfly levels are hardcoded
// we need to check if polynomial size is big enough to require specific level
// of butterfly.
if constexpr (params::degree >= 256) {
Expand Down Expand Up @@ -354,7 +354,7 @@ template <class params> __device__ void NSMFFT_inverse(double2 *A) {

// compressed size = 8192 is actual polynomial size = 16384.
// twiddles for this size can't fit in constant memory so
// butterfly operation for this level acess device memory to fetch
// butterfly operation for this level access device memory to fetch
// twiddles
if constexpr (params::degree >= 8192) {
// level 13
Expand Down Expand Up @@ -491,7 +491,7 @@ template <class params> __device__ void NSMFFT_inverse(double2 *A) {
// below level 8, we don't need to check size of params degree, because we
// support minimum actual polynomial size = 256, when compressed size is
// halfed and minimum supported compressed size is 128, so we always need
// last 7 levels of butterfy operation, since butterfly levels are hardcoded
// last 7 levels of butterfly operation, since butterfly levels are hardcoded
// we don't need to check if polynomial size is big enough to require
// specific level of butterfly.
// level 7
Expand Down
2 changes: 1 addition & 1 deletion backends/concrete-cuda/implementation/src/fft/twiddles.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/*
* 'negtwiddles' are stored in constant memory for faster access times
* because of it's limitied size, only twiddles for up to 2^12 polynomial size
* because of it's limited size, only twiddles for up to 2^12 polynomial size
* can be stored there, twiddles for 2^13 are stored in device memory
* 'negtwiddles13'
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@
// constraints (e.g., if two values must have the same type or the
// same element type). These exist both as static constraints and as
// dynamic constraints. Some pre-defined type constraints depend on a
// class that yields a pair of values for which the contraints shall
// class that yields a pair of values for which the constraints shall
// be applied (e.g., yielding two operands or an operand and a result,
// etc.).
//
// The global state of type inference after running the type inference
// analyses is contained in the `DataFlowSolver` to which the analyses
// where added. The local state of inference for an operation can be
// obtained at any stage of the anlysis via the helper methods of
// obtained at any stage of the analysis via the helper methods of
// `TypeInferenceUtils`.

#ifndef CONCRETELANG_ANALYSIS_TYPEINFERENCEANALYSIS_H
Expand Down Expand Up @@ -550,7 +550,7 @@ class SameTypeConstraintBase : public BaseConstraintT {
bool rightUnresolved = resolver.isUnresolvedType(rightType);

// Priority is given from left to right, i.e., the type of the
// first value yielded by `yield()` takes precendence over the
// first value yielded by `yield()` takes precedence over the
// type for the second value
if (!leftUnresolved && rightUnresolved) {
currState.set(leftValue, leftType);
Expand Down Expand Up @@ -615,7 +615,7 @@ class SameElementTypeConstraintBase : public BaseConstraintT {
bool rightUnresolved = resolver.isUnresolvedType(rightType);

// Priority is given from left to right, i.e., the type of the
// first value yielded by `yield()` takes precendence over the
// first value yielded by `yield()` takes precedence over the
// type for the second value
if (!leftUnresolved && rightUnresolved) {
currState.set(leftValue, leftType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "concretelang/Support/LibrarySupport.h"

/// Add a mechanism to go from Cpp objects to C-struct, with the ability to
/// represent errors. Also the other way arround.
/// represent errors. Also the other way around.
#define DEFINE_C_API_PTR_METHODS_WITH_ERROR(name, cpptype) \
static inline name wrap(cpptype *cpp) { return name{cpp, (char *)NULL}; } \
static inline name wrap(cpptype *cpp, std::string errorStr) { \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ bool verifyEncryptedIntegerInputsConsistency(mlir::Operation &op,
/// Shared error message for all ApplyLookupTable variant Op (several Dialect)
/// E.g. FHE.apply_lookup_table(input, lut)
/// Message when the lut tensor has an invalid size,
/// i.e. it cannot accomodate the input elements bitwidth
/// i.e. it cannot accommodate the input elements bitwidth
template <class Op>
void emitErrorBadLutSize(Op &op, std::string lutName, std::string inputName,
int expectedSize, int bitWidth) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ void memref_wop_pbs_crt_buffer(
uint32_t polynomial_size,
// Key indices
uint32_t ksk_index, uint32_t bsk_index, uint32_t pksk_index,
// runtime context that hold evluation keys
// runtime context that hold evaluation keys
mlir::concretelang::RuntimeContext *context);

void memref_copy_one_rank(uint64_t *src_allocated, uint64_t *src_aligned,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class TestProgram {
}
} else {
llvm::errs() << "TestProgram: directory(" << pathString
<< ") successfuly created\n";
<< ") successfully created\n";
return pathString;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class TypeInferenceRewriter {
// parent operation, which, at this point, has already been
// partially rewritten before recursing into this rewrite call.
//
// Functions are a bit diffent though, since the types of the
// Functions are a bit different though, since the types of the
// results are contained in a function type and not in the
// result types.
mlir::Operation *newParent = mapping.lookup(op->getParentOp());
Expand All @@ -187,7 +187,7 @@ class TypeInferenceRewriter {
llvm::to_vector(newParentFunc.getFunctionType().getResults());
} else {
// Look up new parent op and use the return types, since these
// are the authorative types obtained from the last invocation
// are the authoritative types obtained from the last invocation
// of the type resolver
resolvedOperandTypes = llvm::to_vector(newParent->getResultTypes());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include(AddMLIRPython)
add_compile_options(-fexceptions)

# ######################################################################################################################
# Decalare native Python extension
# Declare native Python extension
# ######################################################################################################################

declare_mlir_python_sources(ConcretelangBindingsPythonExtension)
Expand Down
2 changes: 1 addition & 1 deletion compilers/concrete-compiler/compiler/lib/Common/CRT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ uint64_t iCrt(std::vector<int64_t> moduli, std::vector<int64_t> remainders) {

uint64_t encode(int64_t plaintext, uint64_t modulus, uint64_t product) {
// values are represented on the interval [0; product[ so we represent
// plantext on this interval
// plaintext on this interval
if (plaintext < 0) {
plaintext = product + plaintext;
}
Expand Down
4 changes: 2 additions & 2 deletions compilers/concrete-compiler/compiler/lib/Common/Keys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ LweSecretKey::LweSecretKey(Message<concreteprotocol::LweSecretKeyInfo> info,
buffer = std::make_shared<std::vector<uint64_t>>(
info.asReader().getParams().getLweDimension());

// We copy the informations.
// We copy the information.
this->info = info;

#ifdef CONCRETELANG_GENERATE_UNSECURE_SECRET_KEYS
Expand Down Expand Up @@ -349,7 +349,7 @@ PackingKeyswitchKey::PackingKeyswitchKey(
buffer = std::make_shared<std::vector<uint64_t>>();
(*buffer).resize(bufferSize);

// We copy the informations.
// We copy the information.
this->info = info;

// Initialize the keyswitch key buffer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ mlir::LogicalResult insertForwardDeclarationOfTheCAPI(
rewriter.getI32Type(), rewriter.getI32Type()},
{});
} else {
op->emitError("unknwon external function") << funcName;
op->emitError("unknown external function") << funcName;
return mlir::failure();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1963,7 +1963,7 @@ struct TensorPartitionFrontierOpToLinalgGeneric
mlir::Value init = rewriter.create<mlir::tensor::EmptyOp>(
pfOp.getLoc(), resultTy, mlir::ValueRange{});

// Create affine maps and iterator types for an embarassingly
// Create affine maps and iterator types for an embarrassingly
// parallel op
llvm::SmallVector<mlir::AffineMap, 2> maps{
mlir::AffineMap::getMultiDimIdentityMap(tensorTy.getShape().size(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ std::vector<mlir::Value> extractBitWithClearedLowerBits(
rewriter.getIntegerType(64)),
rawLut));

//-------------------------------------------------- CIPHERTEXT ALIGNEMENT
//-------------------------------------------------- CIPHERTEXT ALIGNMENT
// In practice, TFHE ciphertexts are normally distributed around a value.
// That means that if the lookup is performed _as is_, we have almost .5
// probability to return the wrong value. Imagine a ciphertext centered
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ struct FunctionToDag {
mlir::SmallVector<int32_t, 3> operatorIndexes = {(int32_t)subNode.index,
(int32_t)tluNode.index,
(int32_t)resultNode.index};
// TODO : The substraction of the signed case is not given to the optimizer
// TODO : The subtraction of the signed case is not given to the optimizer
// which could lead to some issue with the dag partitioning of the
// optimizer.
// Note: Should not be an issue while the partition are computed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ static llvm::APInt APIntWidthExtendUMul(const llvm::APInt &lhs,
return lhs.zext(targetWidth) * rhs.zext(targetWidth);
}

/// Returns the maximum value beetwen `lhs` and `rhs`, where both values are
/// Returns the maximum value between `lhs` and `rhs`, where both values are
/// assumed to be positive. The bit width of the smaller `APInt` is extended
/// before comparison via `APInt::ult`.
static llvm::APInt APIntUMax(const llvm::APInt &lhs, const llvm::APInt &rhs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ void ApplyLookupTableEintOp::getCanonicalizationPatterns(
if (resultOfFirstLookup < 0) {
// e.g., imagine first table resulted in -100_000
// (which can exist in tables...)
// then we set it to the smalles possible value
// then we set it to the smallest possible value
// of the input to the table

// So if -100 is encountered on a signed 7-bit tlu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class AddEintPattern
unsigned int chunkSize, chunkWidth;
};

/// Perfoms the transformation of big integer operations
/// Performs the transformation of big integer operations
class FHEBigIntTransformPass
: public FHEBigIntTransformBase<FHEBigIntTransformPass> {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class MuxOpPattern
}
};

/// Perfoms the transformation of boolean operations
/// Performs the transformation of boolean operations
class FHEBooleanTransformPass
: public FHEBooleanTransformBase<FHEBooleanTransformPass> {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class GenericTilingPattern
}
};

/// Perfoms the actual tiling of `FHELinalg.matmul_eint_int`
/// Performs the actual tiling of `FHELinalg.matmul_eint_int`
/// operations that have been marked with a "tile-sizes" attribute.
class LinalgTilingPass : public LinalgTilingBase<LinalgTilingPass> {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void TFHEDialect::initialize() {
>();
}

/// Verify that GLWE parameter are consistant
/// Verify that GLWE parameter are consistent
::mlir::LogicalResult GLWECipherTextType::verify(
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError,
GLWESecretKey key) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ void _dfr_create_async_task(wfnptr wfn, void *ctx, size_t num_params,
param_types, outputs, output_sizes, output_types);
}

/// Runtime generic async_task with vector parametres. Each first
/// Runtime generic async_task with vector parameters. Each first
/// NUM_OUTPUTS quadruplets of arguments in the variadic list
/// corresponds to a size_t for the number of elements in the
/// following array, a void * pointer on an array of
/// hpx::future<void*> and two size_t parameters for the size and type
/// of each output. After that come NUM_PARAMS quadruplets of
/// arguments in the variadic list that correspond to a size_t for the
/// number of elements in the following array, a void* pointer on an
/// array of hpx::future<void*> and the same two size_t parametres
/// array of hpx::future<void*> and the same two size_t parameters
/// (size and type).
void _dfr_create_async_task_vec(wfnptr wfn, void *ctx, size_t num_params,
size_t num_outputs, ...) {
Expand Down Expand Up @@ -349,7 +349,7 @@ void _dfr_start(int64_t use_dfr_p, void *ctx) {
BEGIN_TIME(&whole_timer);
if (use_dfr_p) {
// The first invocation will initialise the runtime. As each call to
// _dfr_start is matched with _dfr_stop, if this is not hte first,
// _dfr_start is matched with _dfr_stop, if this is not the first,
// we need to resume the HPX runtime.
assert(init_guard != terminated &&
"DFR runtime: attempting to start runtime after it has been "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ void memref_wop_pbs_crt_buffer(
uint32_t polynomial_size,
// Key Indices,
uint32_t ksk_index, uint32_t bsk_index, uint32_t pksk_index,
// runtime context that hold evluation keys
// runtime context that hold evaluation keys
mlir::concretelang::RuntimeContext *context) {

// The compiler should only generates 2D memref<BxS>, where B is the number of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ llvm::Expected<std::string> CompilerEngine::Library::emitShared() {
// it during load time. To solve this, we change the dep in the generated
// library to be relative to the rpath which should be set correctly
// during linking. This shouldn't have an impact when
// /DLC/concrete/.dylibs/* isn't a dependecy in the first place (when not
// /DLC/concrete/.dylibs/* isn't a dependency in the first place (when not
// using python).
if (fixRuntimeDep) {
std::string fixRuntimeDepCmd = "install_name_tool -change "
Expand Down
12 changes: 6 additions & 6 deletions compilers/concrete-compiler/compiler/lib/Transforms/Batching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ unsigned getOperandIndexForValue(mlir::Operation *op, mlir::Value v) {
}

// Walks up the use-def-chain of of the value `v`, executing `cb`
// for any value not previsouly encountered un `visited`.
// for any value not previously encountered un `visited`.
static void walkUseDefChainRec(mlir::DenseSet<mlir::Value> &visited,
mlir::Value v,
llvm::function_ref<void(mlir::Value)> cb) {
Expand Down Expand Up @@ -473,7 +473,7 @@ static void rewritePerfectLoopNestWithReplacedNthResult(

rewriter.replaceOp(currFor, newResults);
} else {
// An inner loop has been rewriten -> remap uses of results of
// An inner loop has been rewritten -> remap uses of results of
// the old loop to the new loop
mlir::scf::ForOp parentFor =
llvm::dyn_cast<mlir::scf::ForOp>(currFor->getParentOp());
Expand All @@ -492,7 +492,7 @@ static void rewritePerfectLoopNestWithReplacedNthResult(
}

/// Checks if the value `v` is defined outside of the `loop` or a pure
/// operation that can be safely replicated ouside the loop (i.e., all
/// operation that can be safely replicated outside the loop (i.e., all
/// of its operands are also recursively either defined outside of the
/// loop or pure).
static bool isHoistable(mlir::Value v, mlir::scf::ForOp loop) {
Expand Down Expand Up @@ -1839,7 +1839,7 @@ class ConstantDenseFoldingPattern
mlir::Type currOrigElementType = currConstantType.getElementType();
mlir::Type currFoldedElementType = currOrigElementType;

// Walk down the def-use chain from the extract operaion until
// Walk down the def-use chain from the extract operation until
// an operation is found that is not foldable
while (true) {
if (!isFoldableOp(currOp))
Expand All @@ -1864,7 +1864,7 @@ class ConstantDenseFoldingPattern
return mlir::WalkResult::skip();

// Check constraints on the index space of the extract
// operation. I.e., if the type changes during teh folding,
// operation. I.e., if the type changes during the folding,
// ensure that the index space covers the entire tensor and that
// there are no out-of-bounds accesses.
for (auto it : llvm::enumerate(currExtractOp.getIndices())) {
Expand Down Expand Up @@ -1913,7 +1913,7 @@ class ConstantDenseFoldingPattern
.cast<mlir::DenseElementsAttr>()
.getValues<mlir::Attribute>();

// Updated tensor of constants intialized with original values
// Updated tensor of constants initialized with original values
SmallVector<mlir::Attribute> newDenseVals(denseVals.begin(),
denseVals.end());

Expand Down
2 changes: 1 addition & 1 deletion compilers/concrete-compiler/compiler/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ mlir::LogicalResult processInputBuffer(
}

if (retOrErr->llvmModule) {
// At least usefull for intermediate binary object files naming
// At least useful for intermediate binary object files naming
retOrErr->llvmModule->setSourceFileName(sourceFileName);
retOrErr->llvmModule->setModuleIdentifier(sourceFileName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ template <> struct llvm::yaml::MappingTraits<EndToEndDesc> {
io.mapOptional("v0-parameter", v0parameter);
if (!v0parameter.empty()) {
if (v0parameter.size() != 7) {
io.setError("v0-parameter expect to be a list 7 elemnts "
io.setError("v0-parameter expect to be a list 7 elements "
"[glweDimension, logPolynomialSize, nSmall, brLevel, "
"brLobBase, ksLevel, ksLogBase]");
}
Expand All @@ -226,7 +226,7 @@ template <> struct llvm::yaml::MappingTraits<EndToEndDesc> {
io.mapOptional("v0-constraint", v0constraint);
if (!v0constraint.empty()) {
if (v0constraint.size() != 2) {
io.setError("v0-constraint expect to be a list 2 elemnts "
io.setError("v0-constraint expect to be a list 2 elements "
"[p, norm2]");
}
desc.v0Constraint = mlir::concretelang::V0FHEConstraint();
Expand Down
Loading

0 comments on commit 31f821b

Please sign in to comment.