id stringlengths 27 29 | content stringlengths 226 3.24k |
|---|---|
codereview_new_cpp_data_9325 | set_attribute_error_context(PyObject* v, PyObject* name)
}
// Intercept AttributeError exceptions and augment them to offer suggestions later.
PyObject *exc = PyErr_GetRaisedException();
- // Check if the exception is indeed an AttributeError
if (!PyErr_GivenExceptionMatches(exc, PyExc_Attribute... |
codereview_new_cpp_data_9329 | py_get_system_clock(_PyTime_t *tp, _Py_clock_info_t *info, int raise)
info->monotonic = 0;
info->adjustable = 1;
if (clock_getres(CLOCK_REALTIME, &res) == 0) {
info->resolution = (double)res.tv_sec + (double)res.tv_nsec * 1e-9;
}
else {
It is not obvious why i... |
codereview_new_cpp_data_9330 | random_seed_time_pid(RandomObject *self)
key[0] = (uint32_t)(now & 0xffffffffU);
key[1] = (uint32_t)(now >> 32);
-#ifdef HAVE_GETPID
- key[2] = (uint32_t)getpid();
-#elif defined(MS_WINDOWS_NON_DESKTOP)
key[2] = (uint32_t)GetCurrentProcessId();
#else
key[2] = 0;
#endif
This case will need t... |
codereview_new_cpp_data_9332 | instructions_to_cfg(PyObject *instructions, cfg_builder *g)
}
}
- for (Py_ssize_t i = 0; i < num_insts; i++) {
if (is_target[i]) {
jump_target_label lbl = {i};
RETURN_IF_ERROR(cfg_builder_use_label(g, lbl));
```suggestion
for (int i = 0; i < num_insts; i++) {... |
codereview_new_cpp_data_9333 | instructions_to_cfg(PyObject *instructions, cfg_builder *g)
assert(PyList_Check(instructions));
Py_ssize_t num_insts = PyList_GET_SIZE(instructions);
- bool *is_target = PyMem_Malloc(num_insts * sizeof(bool));
- for (Py_ssize_t i = 0; i < num_insts; i++) {
- is_target[i] = false;
}
f... |
codereview_new_cpp_data_9335 | positional_only_passed_as_keyword(PyThreadState *tstate, PyCodeObject *co,
{
int posonly_conflicts = 0;
PyObject* posonly_names = PyList_New(0);
- if (posonly_names == NULL)
- goto fail;
for(int k=0; k < co->co_posonlyargcount; k++){
PyObject* posonly_name = PyTuple_GET_ITEM(co->co_... |
codereview_new_cpp_data_9337 | corresponding Unix manual entries for more information on calls.");
#if defined(HAVE_SYS_XATTR_H) && defined(__linux__) && !defined(__FreeBSD_kernel__) && !defined(__GNU__)
# define USE_XATTRS
-# include <linux/limits.h>
#endif
#ifdef USE_XATTRS
is this specific direct linux kernel include required (it _sho... |
codereview_new_cpp_data_9338 | int_bit_count_impl(PyObject *self)
/*[clinic input]
int.as_integer_ratio
-Given an integer x, return the tuple (int(x), 1).
[clinic start generated code]*/
static PyObject *
int_as_integer_ratio_impl(PyObject *self)
-/*[clinic end generated code: output=e60803ae1cc8621a input=258f5b08307e7dcd]*/
{
PyObj... |
codereview_new_cpp_data_9340 | add_features(PyObject *mod)
static void
pyexpat_capsule_destructor(PyObject *capsule)
{
- PyMem_Free(PyCapsule_GetPointer(capsule, PyExpat_CAPSULE_NAME));
}
If `PyCapsule_GetPointer` fails it will set an exception. We should check that, and `PyErr_WriteUnraisable` on error.
add_features(PyObject *mod)
s... |
codereview_new_cpp_data_9343 | static PyObject *
unicodeiter_reduce(unicodeiterobject *it, PyObject *Py_UNUSED(ignored))
{
PyObject *iter = _PyEval_GetBuiltin(&_Py_ID(iter));
if (it->it_seq != NULL) {
return Py_BuildValue("N(O)n", iter, it->it_seq, it->it_index);
Any reason not to include the same comment here as in the othe... |
codereview_new_cpp_data_9344 | bytearrayiter_reduce(bytesiterobject *it, PyObject *Py_UNUSED(ignored))
{
PyObject *iter = _PyEval_GetBuiltin(&_Py_ID(iter));
- /* _PyEval_GetBuiltin can invoke arbitrary code.
- * calls must be *before* access of `it` pointers,
- * since C parameter eval order is undefined.
* see issue #10176... |
codereview_new_cpp_data_9351 | basicblock_next_instr(basicblock *b)
static int
stack_effect(int opcode, int oparg, int jump)
{
- if (0 <= opcode && opcode < 256) {
if (_PyOpcode_Deopt[opcode] != opcode) {
// Specialized instructions are not supported.
return PY_INVALID_STACK_EFFECT;
We have these:
```
#... |
codereview_new_cpp_data_9352 | basicblock_next_instr(basicblock *b)
static int
stack_effect(int opcode, int oparg, int jump)
{
- if (0 <= opcode && opcode < 256) {
if (_PyOpcode_Deopt[opcode] != opcode) {
// Specialized instructions are not supported.
return PY_INVALID_STACK_EFFECT;
Wouldn't it be correct t... |
codereview_new_cpp_data_9353 | m_sinpi(double x)
return copysign(1.0, x)*r;
}
-/* Implementation of the real gamma function. Kept here to workaround
issues (see e.g. #70309) with quality of libm's tgamma/lgamma implementations
on various platforms (Windows, MacOS). In extensive but non-exhaustive
random tests, this function pr... |
codereview_new_cpp_data_9355 | dummy_func(
STAT_INC(FOR_ITER, deferred);
DECREMENT_ADAPTIVE_COUNTER(cache->counter);
#endif /* ENABLE_SPECIALIZATION */
- /* before: [iter]; after: [iter, iter()] *or* [] (and jump an extra instr.) */
next = (*Py_TYPE(iter)->tp_iternext)(iter);
... |
codereview_new_cpp_data_9356 | dummy_func(
else {
/* `iterable` is not a generator. */
iter = PyObject_GetIter(iterable);
- Py_DECREF(iterable);
if (iter == NULL) {
goto error;
}
}
PREDICT(LOAD_CONST);
... |
codereview_new_cpp_data_9357 | dummy_func(
prev_exc = Py_NewRef(Py_None);
}
assert(PyExceptionInstance_Check(new_exc));
- Py_INCREF(new_exc);
- exc_info->exc_value = new_exc;
}
// error: LOAD_ATTR has irregular stack effect
Nit: This could be combined into
```sug... |
codereview_new_cpp_data_9360 | os__isfile_impl(PyObject *module, PyObject *path)
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
}
if (hfile != INVALID_HANDLE_VALUE) {
- GetFileInformationByHandleEx(hfile, FileBasicInfo, &info, sizeof(info));
- result = !(info.FileAttributes & FILE_ATTRIBUTE_DI... |
codereview_new_cpp_data_9365 | dummy_func(
exc = args[0];
/* fall through */
case 0:
- if (do_raise(tstate, exc, cause)) {
- ERROR_IF(true, exception_unwind);
- }
break;
default:
_PyErr_SetString(tstate, PyE... |
codereview_new_cpp_data_9366 | get_module_state(PyObject *mod)
}
static struct PyModuleDef itertoolsmodule;
static inline itertools_state *
find_state_by_type(PyTypeObject *tp)
{
```suggestion
static struct PyModuleDef itertoolsmodule;
```
nit
get_module_state(PyObject *mod)
}
static struct PyModuleDef itertoolsmodule;
+
static ... |
codereview_new_cpp_data_9367 | dummy_func(
// Success!
assert(PyTuple_CheckExact(attrs));
}
- else if (_PyErr_Occurred(tstate)) {
- // Error!
- ERROR_IF(true, error);
- }
else {
// Failure!
attrs = Py_New... |
codereview_new_cpp_data_9370 | elementiter_next(ElementIterObject *it)
continue;
}
elementtreestate *st = ET_STATE_GLOBAL;
assert(Element_Check(st, extra->children[child_index]));
elem = (ElementObject *)Py_NewRef(extra->children[child_index]);
item->child_index++;
... |
codereview_new_cpp_data_9379 | dummy_func(
_Py_DECREF_SPECIALIZED(left, _PyUnicode_ExactDealloc);
_Py_DECREF_SPECIALIZED(right, _PyUnicode_ExactDealloc);
assert(res == 0 || res == 1);
- assert((oparg & 15) == 7 || (oparg & 15) == 8);
- jump = (res + 7) & oparg;
}
super... |
codereview_new_cpp_data_9380 | static int compiler_addcompare(struct compiler *c, location loc,
default:
Py_UNREACHABLE();
}
- /* cmp goes in top bits of the oparg, low bits are for the mask. */
ADDOP_I(c, loc, COMPARE_OP, cmp << 4);
return SUCCESS;
}
```suggestion
/* cmp goes in top bits of the oparg, while t... |
codereview_new_cpp_data_9381 | static int compiler_addcompare(struct compiler *c, location loc,
default:
Py_UNREACHABLE();
}
- /* cmp goes in top bits of the oparg, while the low bits are used by specialized
* versions of this opcode to store the comparison mask. */
ADDOP_I(c, loc, COMPARE_OP, cmp << 4);
return... |
codereview_new_cpp_data_9382 | dummy_func(
ERROR_IF(list == NULL, error);
}
- // 'stuff' is a list object followed by (oparg - 1) unused values
- inst(LIST_EXTEND, (stuff[oparg], iterable -- stuff[oparg])) {
- PyObject *none_val = _PyList_Extend((PyListObject *)stuff[0], iterable);
if (n... |
codereview_new_cpp_data_9390 | dummy_func(
}
inst(CALL_INTRINSIC_1, (value -- res)) {
res = _PyIntrinsics_UnaryFunctions[oparg](tstate, value);
Py_DECREF(value);
ERROR_IF(res == NULL, error);
If the arg is corrupted here then it will just crash. Shall we have an assertion that oparg is in ... |
codereview_new_cpp_data_9391 | dummy_func(
DEOPT_IF(argcount < minargs, CALL);
DEOPT_IF(!_PyThreadState_HasStackSpace(tstate, code->co_framesize), CALL);
STAT_INC(CALL, hit);
- _PyInterpreterFrame *new_frame = _PyFrame_PushUnchecked(tstate, func, argcount);
STACK_SHRINK(argcount);
... |
codereview_new_cpp_data_9395 | PyCode_GetFreevars(PyCodeObject *code)
return _PyCode_GetFreevars(code);
}
-int
-_PyCode_GetNumFrameSlots(PyCodeObject *code)
-{
- /* This function needs to remain in sync with the calculation of
- * co_framesize in Tools/build/deepfreeze.py */
- assert(code->co_framesize >= FRAME_SPECIALS_SIZE);
- ... |
codereview_new_cpp_data_9397 | symtable_extend_namedexpr_scope(struct symtable *st, expr_ty e)
if (ste->ste_comprehension) {
long target_in_scope = _PyST_GetSymbol(ste, target_name);
if ((target_in_scope & DEF_COMP_ITER) &&
- (target_in_scope & (DEF_LOCAL | DEF_GLOBAL))) {
PyErr_For... |
codereview_new_cpp_data_9398 | long_long_meth(PyObject *self, PyObject *Py_UNUSED(ignored))
/*[clinic input]
int.is_integer
-Returns True.
[clinic start generated code]*/
static PyObject *
int_is_integer_impl(PyObject *self)
-/*[clinic end generated code: output=90f8e794ce5430ef input=5987f0abb5d0e177]*/
{
Py_RETURN_TRUE;
}
```sugg... |
codereview_new_cpp_data_9404 | dummy_func(
assert(self_cls->tp_flags & Py_TPFLAGS_MANAGED_DICT);
PyDictOrValues dorv = *_PyObject_DictOrValuesPointer(self);
DEOPT_IF(_PyDictOrValues_IsValues(dorv), LOAD_ATTR);
- PyDictKeysObject *keys = ((PyHeapTypeObject *)self_cls)->ht_cached_keys;
- DE... |
codereview_new_cpp_data_9420 | void addDoubleTilingPadExpertPassPipeline(OpPassManager &passManager,
{
LinalgSingleTilingExpertPassOptions options;
options.vectorize = true;
- options.enableVectorMasking = true;
options.vectorizePadding = true;
nestedModulePM.addNestedPass<func::FuncOp>(
createLinalgSingleTilingEx... |
codereview_new_cpp_data_9421 | DiagnosedSilenceableFailure transform_dialect::ApplyPatternsOp::applyToOne(
// upstream moveLoopInvariantCode if necessary.
funcOp->walk(
[](LoopLikeOpInterface loopLike) { moveLoopInvariantCode(loopLike); });
- // For now, put single loop promotion as part of licm.
- // TODO: This i... |
codereview_new_cpp_data_9422 | void LLVMGPULowerExecutableTargetPass::runOnOperation() {
case IREE::Codegen::DispatchLoweringPassPipeline::LLVMGPUWarpReduction:
addGPUWarpReductionPassPipeline(executableLoweringPipeline);
break;
- case IREE::Codegen::DispatchLoweringPassPipeline::LLVMGPUDataTiling:
addGPUDataT... |
codereview_new_cpp_data_9423 | void addGPUTransposePassPipeline(OpPassManager &pm) {
addBufferizePasses(nestedModulePM);
// distribute foreach threads
- addBufferizePasses(nestedModulePM);
nestedModulePM.addNestedPass<func::FuncOp>(createLLVMGPUDistribute());
nestedModulePM.addNestedPass<func::FuncOp>(createMemrefCopyToLinalgPass()... |
codereview_new_cpp_data_9424 | struct ScatterInt64Indices : public OpRewritePattern<mhlo::ScatterOp> {
return rewriter.notifyMatchFailure(op, "cannot validate legal size");
uint64_t maxSize = std::numeric_limits<int32_t>::max();
- if (indicesETy.getIntOrFloatBitWidth() > 32)
- for (int i = 0, s = indicesTy.getRank(); i < s; ++... |
codereview_new_cpp_data_9425 | static LogicalResult setMaliMatmulConfig(linalg::LinalgOp op,
const int subgroupSize = limits.getSubgroupSize();
const std::array<int64_t, 2> workgroupXY = {subgroupSize / 2, 2};
std::array<int64_t, 3> threadMNK;
- Type elementType = op.getDpsInputOperand(0)
- ->get()
- ... |
codereview_new_cpp_data_9428 | FailureOr<TileAndFuseResult> tileAndFuseDispatchUsingSCFForOp(
return rewriter.notifyMatchFailure(sliceOp,
"fusion along slice op failed");
}
- Operation *tiledProducer = tiledProducerVal->getDefiningOp();
- if (!llvm::dyn_cast_or_null<TilingInterface>(tiledP... |
codereview_new_cpp_data_9429 | struct LinalgExtOpInterface
}
};
template <typename OpTy>
static FailureOr<std::pair<Value, Value>> getSourceAndDestFromPackUnPackOp(
RewriterBase &rewriter, OpTy op, const BufferizationOptions &options) {
Value source;
auto maybeBuffer = getBuffer(rewriter, op.getSource(), options);
if (failed(m... |
codereview_new_cpp_data_9430 | transform_ext::StructuredOpMatcher::StructuredOpMatcher(
StructuredOpMatcher &A, StructuredOpMatcher &B) {
predicates.push_back([&A, &B](linalg::LinalgOp linalgOp) -> bool {
- LLVM_DEBUG(DBGS() << "start recursive match {\n");
{
auto debugRAII = llvm::make_scope_exit(
[] { LLVM_DEBU... |
codereview_new_cpp_data_9431 | transform_ext::StructuredOpMatcher::StructuredOpMatcher(
StructuredOpMatcher &A, StructuredOpMatcher &B) {
predicates.push_back([&A, &B](linalg::LinalgOp linalgOp) -> bool {
- LLVM_DEBUG(DBGS() << "start recursive match {\n");
{
auto debugRAII = llvm::make_scope_exit(
[] { LLVM_DEBU... |
codereview_new_cpp_data_9432 | static FailureOr<Operation *> getRootOp(Operation *op) {
funcOp = op->getParentOfType<func::FuncOp>();
}
Operation *rootOp = nullptr;
mlir::iree_compiler::IREE::Codegen::LoweringConfigAttr rootLoweringConfig;
auto result = funcOp.walk([&](Operation *op) -> WalkResult {
maybe we should check if func... |
codereview_new_cpp_data_9433 | struct ConvertMHLOToLinalgOnTensorsPass
context);
patterns.insert<GenericTypeConvert>(
ml_program::GlobalStoreOp::getOperationName(), *typeConverter, context);
- // needed to convert mhlo::ReplicaIDOp
patterns.insert<GenericTypeConvert>(
tensor::FromElementsOp::getOperationName(... |
codereview_new_cpp_data_9434 | static iree_status_t iree_hal_cuda_device_create_channel(
// We could multiplex channels but it'd be better to surface that to the
// compiler so that it can emit the right rank math.
int requested_count = iree_math_count_ones_u64(queue_affinity);
- // FIXME: queue affinity is not set yet correctly, so we ha... |
codereview_new_cpp_data_9435 | static void buildStagedReductionStrategyThreadLevel(
Value root = blockCombinerOpH;
SmallVector<Value> opsToFuse = {gridFillH};
// If we have a unit dim after the reduction that doesn't broadcast fuse it
- // wuth the reduction.
if (strategy.captures.maybeTrailingRank ==
strategy.captures.reduction... |
codereview_new_cpp_data_9436 | static FailureOr<IREE::Codegen::LoweringConfigAttr> collectComputeOps(
// discover such computation ops so that we can tile and fuse both regions.
SmallVector<scf::IfOp, 1> ifOps;
funcOp.walk<WalkOrder::PreOrder>([&ifOps](Operation *op) -> WalkResult {
- if (isa<linalg::LinalgOp, TilingInterface>(op)) {
... |
codereview_new_cpp_data_9437 | static void addTileAndDistributePasses(
pm.addPass(createTileAndDistributeToWorkgroupsPass());
auto &nestedModulePM = pm.nest<ModuleOp>();
nestedModulePM.addNestedPass<func::FuncOp>(
- IREE::LinalgExt::createDecomposeAttentionPass());
nestedModulePM.addNestedPass<func::FuncOp>(
IREE::LinalgExt:... |
codereview_new_cpp_data_9438 | LogicalResult WinogradOutputTransformOp::reifyResultShapes(
LogicalResult SoftmaxOp::verify() {
Operation *op = getOperation();
- if (getNumInputs() != 1) {
- return op->emitOpError("expected one input operand");
- }
- if (getNumOutputs() != 1) {
- return op->emitOpError("expected one output operand");
... |
codereview_new_cpp_data_9439 | struct LinalgStrategyDecomposePass
if (!anchorFuncName.empty() && funcOp.getName() != anchorFuncName)
return;
RewritePatternSet decompositionPattern(funcOp.getContext());
decompositionPattern.add<
DownscaleSizeOneWindowed2DConvolution<linalg::Conv2DNhwcHwcfOp,
... |
codereview_new_cpp_data_9441 | std::pair<Value, Value> mlir::iree_compiler::cpu::buildCommonTrailingStrategy(
static FailureOr<ReductionConfig> applyKnownGoodReductionConfigurations(
const transform_ext::MatchedReductionCaptures &captures,
const CPUModel &cpuModel) {
int64_t reductionSize = captures.reductionOpSizes.back();
if (cpu... |
codereview_new_cpp_data_9449 | static SmallVector<int64_t> getPackOpResultTypeShape(
return resultShape;
}
-// Converts OpFoldResults to int64_t shape entries, unconditionally mapping all
-// Value's to kDynamic, even if they are arith.constant values.
-static SmallVector<int64_t>
-asShapeWithAnyValueAsDynamic(ArrayRef<OpFoldResult> ofrs) {
-... |
codereview_new_cpp_data_9452 | class FPToUIOpConversion : public OpConversionPattern<arith::FPToUIOp> {
ConversionPatternRewriter &rewriter) const override {
auto srcType = srcOp.getIn().getType();
auto dstType = srcOp.getResult().getType();
- dstType.dump();
auto resultType = getTypeConverter()->convertType(dstType);
... |
codereview_new_cpp_data_9453 | class FPToUIOpConversion : public OpConversionPattern<arith::FPToUIOp> {
ConversionPatternRewriter &rewriter) const override {
auto srcType = srcOp.getIn().getType();
auto dstType = srcOp.getResult().getType();
- dstType.dump();
auto resultType = getTypeConverter()->convertType(dstType);
... |
codereview_new_cpp_data_9454 | static void createTransformRegion(func::FuncOp entryPoint,
MLIRContext *ctx = entryPoint.getContext();
Location loc = entryPoint.getLoc();
OpBuilder b(ctx);
- auto mod = entryPoint->getParentOfType<ModuleOp>();
- b.setInsertionPointAfter(mod);
auto topLevelTransformModule = b.create<ModuleOp>(loc);
Re... |
codereview_new_cpp_data_9455 | class SPIRVTileAndPromotePass final
void runOnOperation() override;
private:
- /// Prmotes C matrix to shared memory when necessary and returns success if no
/// error happens.
LogicalResult doPromoteCMatrix(func::FuncOp funcOp) const;
```suggestion
/// Promotes C matrix to shared memory when neces... |
codereview_new_cpp_data_9456 | void buildGlobalOptimizationPassPipeline(
/// uses case.
static void buildOptionalPreprocessingPassPipeline(OpPassManager &passManager) {
FunctionLikeNest(passManager)
- .addPredicatedPass(clEnableConvToImg2Col,
- IREE::Flow::createConvertConv2DToImg2ColPass)
.addPredicatedPass... |
codereview_new_cpp_data_9457 | class WGSLReplacePushConstantsPass
// We could store into a tensor<Nxi32>, but vec4s are better supported, so
// we'll use tensor<Nxvector<4xi32>> instead.
uint64_t numberOfVec4s = maxConstantIndex / 4 + 1;
// hal.interface.binding.subspan ->
llvm has `llvm::divideCeil` for it. So if it's a pe... |
codereview_new_cpp_data_9458 | linalg::LinalgLoopDistributionOptions getIREELinalgLoopDistributionOptions(
SmallVector<linalg::ProcInfo, 3> procInfo(numParallelDims);
Value splitDim;
for (size_t dim = 0; dim < numParallelDims; ++dim) {
- if (numParallelDims > 3 && dim >= 2) {
if (!splitDim) {
... |
codereview_new_cpp_data_9459 | void addSPIRVWinogradVectorizePassPipeline(OpPassManager &pm) {
nestedModulePM.addPass(createCSEPass());
// Tile to GPU invocations and vectorize.
- nestedModulePM.addNestedPass<func::FuncOp>(
- createSPIRVCreateFastSlowPathPass());
nestedModulePM.addNestedPass<func::FuncOp>(createSPIRVAnnotateLoopsPa... |
codereview_new_cpp_data_9460 | class SPIRVAnnotateLoopsPass final
void runOnOperation() override {
func::FuncOp funcOp = getOperation();
SmallVector<scf::ForOp, 4> forOps;
- bool afterWorkgroupLoops{false};
- funcOp.walk([&](Operation *op) {
- if (isa<IREE::Flow::DispatchTensorLoadOp>(op)) {
- afterWorkgroupLoops = tr... |
codereview_new_cpp_data_9461 | static LogicalResult setWinogradOpConfig(
spirv::ResourceLimitsAttr limits,
IREE::LinalgExt::WinogradInputTransformOp op) {
// Tiling is already done by tile and decompose, so we only set pipeline and
- // workgroup size
auto pipeline = CodeGenPipeline::SPIRVWinogradVectorize;
std::array<int64_t, 3... |
codereview_new_cpp_data_9462 | static LogicalResult setWinogradOpConfig(
spirv::ResourceLimitsAttr limits,
IREE::LinalgExt::WinogradInputTransformOp op) {
// Tiling is already done by tile and decompose, so we only set pipeline and
- // workgroup size
auto pipeline = CodeGenPipeline::SPIRVWinogradVectorize;
std::array<int64_t, 3... |
codereview_new_cpp_data_9463 | static void addTileAndDistributePasses(
nestedModulePM.addPass(createCanonicalizerPass());
nestedModulePM.addPass(createCSEPass());
nestedModulePM.addNestedPass<func::FuncOp>(
- IREE::LinalgExt::createTileAndDecomposeWinogradInputTransformPass());
- nestedModulePM.addNestedPass<func::FuncOp>(
- IRE... |
codereview_new_cpp_data_9464 | struct SetMatmulEncoding : public OpRewritePattern<linalg::MatmulOp> {
Type rhsElemType = getElemType(origRhs);
Type outElemType = getElemType(origOut);
TensorEncoding lhsEncoding;
TensorEncoding rhsEncoding;
TensorEncoding outEncoding;
to be safe you probably need
```
if (!lhsElemType ||... |
codereview_new_cpp_data_9466 | Session::Session(GlobalInit &globalInit) : globalInit(globalInit) {
bindingOptions = *globalInit.clBindingOptions;
inputOptions = *globalInit.clInputOptions;
highLevelOptimizationOptions = *globalInit.clHighLevelOptimizationOptions;
halTargetOptions = *globalInit.clHalTargetOptions;
vmTargetOp... |
codereview_new_cpp_data_9467 | static FailureOr<Operation *> getRootOp(func::FuncOp funcOp) {
/// method returns a proper tile sizes vector for each op during tiling.
static SmallVector<Value> buildTileSizesForOp(OpBuilder &b, Operation *op,
SmallVector<int64_t> tileSizes) {
- auto linalgOp = dyn_ca... |
codereview_new_cpp_data_9468 | struct LinalgStrategyTilePass
filter);
else
tilingPattern.add<LinalgSCFTilingPattern>(ctx, options, filter);
- if (anchorOpName == tensor::PadOp::getOperationName()) {
- linalg::LinalgTilingOptions legacyTilingOptions;
- legacyTilingOptions.setT... |
codereview_new_cpp_data_9472 | static SmallVector<int64_t> getLinalgExtDefaultWorkgroupTileSizes(
}
}
- OpBuilder builder(op.getContext());
- builder.setInsertionPoint(op);
- SmallVector<Range> iterationDomain = op.getIterationDomain(builder);
- for (int i = 0, e = std::min<int64_t>(numLoops, workgroupTileSizes.size());
- i < e;... |
codereview_new_cpp_data_9473 | SmallVector<int64_t> computeInterchangeFromDimPos(ArrayRef<int64_t> dimsPos,
}
Value createValueFrom2DConstant(const float *val, int64_t rows, int64_t cols,
- bool transpose, Location loc,
- PatternRewriter &rewriter) {
- SmallVector<float> vector(rows... |
codereview_new_cpp_data_9474 | MaterializeEncodingConversionTarget::MaterializeEncodingConversionTarget(
// Mark any operation that has operands/results with encoding as
// illegal.
markUnknownOpDynamicallyLegal([=](Operation *op) {
- for (auto v : op->getOperands()) {
- if (typeHasEncoding(v.getType()))
- return false;
- ... |
codereview_new_cpp_data_9475 | static LogicalResult setReductionConfig(const spirv::TargetEnv &targetEnv,
if (bitWidth != 32) return failure();
// Let each thread handle `vectorSize` elements.
- const unsigned largestLoadSizeInBits = 128;
- unsigned vectorSize = largestLoadSizeInBits / bitWidth;
while ((*dimSize / vectorSize) % subgrou... |
codereview_new_cpp_data_9482 | float loss[] = {1.0f};
void print_state() {
fprintf(stdout, "Weights:");
for (iree_host_size_t i = 0; i < IREE_ARRAYSIZE(w); ++i) {
- printf(" %f", w[i]);
}
fprintf(stdout, ", Bias: %f", b[0]);
fprintf(stdout, ", Loss: %f\n", loss[0]);
nit: one more `printf` to change to `fprintf`
``... |
codereview_new_cpp_data_9485 | void setTranslationInfo(IREE::HAL::ExecutableExportOp exportOp,
// operations.
// ===----------------------------------------------------------------------===//
-Operation *getLoweringConfigCarryingOp(ArrayRef<Operation *> computeOps) {
for (Operation *op : computeOps) {
if (getLoweringConfig(op)) return o... |
codereview_new_cpp_data_9486 | void setTranslationInfo(IREE::HAL::ExecutableExportOp exportOp,
// operations.
// ===----------------------------------------------------------------------===//
-Operation *getLoweringConfigCarryingOp(ArrayRef<Operation *> computeOps) {
for (Operation *op : computeOps) {
if (getLoweringConfig(op)) return o... |
codereview_new_cpp_data_9489 | static iree_status_t print_buffer_view(iree_hal_device_t* device,
if (iree_status_is_ok(status)) {
status = iree_hal_semaphore_create(device, 0ull, &fence_semaphore);
}
- uint64_t wait_value = 0ull;
uint64_t signal_value = 1ull;
if (iree_status_is_ok(status)) {
- iree_hal_semaphore_list_t wait_sem... |
codereview_new_cpp_data_9490 | static bool isFusableWithProducer(OpOperand &operand, bool aggressiveFusion) {
Operation *producer = operand.get().getDefiningOp();
Operation *consumer = operand.getOwner();
- // Fuse linalg ops with set encoding op if the operand is an `outs` value.
- if (isa<linalg::LinalgOp>(consumer) &&
- isa<IREE::... |
codereview_new_cpp_data_9491 | SmallVector<Operation *>
UnPackOp::getTiledImplementation(OpBuilder &builder,
ArrayRef<OpFoldResult> offsets,
ArrayRef<OpFoldResult> sizes) {
if (!hasTensorSemantics())
return {};
Location loc = getLoc();
auto ctx = builder.getContext... |
codereview_new_cpp_data_9493 | struct DetachElementwisePattern
if (!linalgOp.hasTensorSemantics()) return failure();
// Nothing to do if the output tensor operand is already a fill op.
- linalg::OpOperandVector outputOperands = linalgOp.hasBufferSemantics()
- ? linalg::OpOperandVector()... |
codereview_new_cpp_data_9494 | static LogicalResult setContractConfig(func::FuncOp entryPoint,
const int64_t tileX = config.tileSize[0];
const int64_t tileY = config.tileSize[1];
const int64_t tileK = config.tileSize[2];
- const int64_t workgroupSize[] = {config.workgroupSize[0],
- config.workgroupSize[1]... |
codereview_new_cpp_data_9495 | static SmallVector<Value> buildTileSizesForOp(OpBuilder &b, Operation *op,
ArrayRef<int64_t> tileSizes) {
auto tilingOp = cast<TilingInterface>(op);
- SmallVector<int64_t> newTileSizes = llvm::to_vector(tileSizes);
newTileSizes.resize(tilingOp.getLoopIteratorType... |
codereview_new_cpp_data_9497 | static LogicalResult duplicateInitTensorOps(OpBuilder &b,
return success();
}
-static SmallVector<NamedAttribute> PruneAttributeList(
- linalg::GenericOp op, bool useWARForCooperativeMatrixCodegen = false) {
auto opAttributes = op.getAttributeNames();
llvm::StringSet<> elidedAttrs;
elidedAttrs.insert... |
codereview_new_cpp_data_9498 | static void tileAndDistributeToWorkgroup(
}
static void tileAndBufferize(OpPassManager &pm) {
- tileAndDistributeToWorkgroup(pm, /*useWARForCooperativeMatrixCodegen =*/true);
auto &nestedModulePM = pm.nest<ModuleOp>();
addBufferizePasses(nestedModulePM);
style nit: we don't need braces before and after `... |
codereview_new_cpp_data_9499 |
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#define DEBUG_TYPE "kernel-dispatch"
-#define DBGS() (llvm::dbgs())
-#define KD_DBGS() (DBGS() << '[' << DEBUG_TYPE << "] ")
namespace mlir {
namespace iree_compiler {
The `DBGS` is not used by others. Maybe combine two macro and use `DBGS`?
```sugges... |
codereview_new_cpp_data_9500 | PackOp::getTiledImplementation(OpBuilder &builder,
// Take the minimum of two integers.
auto idMap = AffineMap::getMultiDimIdentityMap(2, ctx);
auto min = [&](OpFoldResult v1, OpFoldResult v2) -> OpFoldResult {
- return builder.createOrFold<AffineMinOp>(
- loc, idMap,
- ValueRange{getValueOrC... |
codereview_new_cpp_data_9501 | LogicalResult detail::verifyGlobalAddressOp(
GlobalAddressOpInterface addressOp, SymbolTableCollection &symbolTable) {
if (!isa_and_nonnull<IREE::Util::GlobalOpInterface>(
symbolTable.lookupNearestSymbolFrom(addressOp.getOperation(),
- addressOp.getGlobal... |
codereview_new_cpp_data_9503 | static LogicalResult setWarpReductionConfig(func::FuncOp entryPoint,
return success();
}
static LogicalResult setTransposeConfig(func::FuncOp entryPoint,
linalg::LinalgOp linalgOp) {
LinalgOpInfo opInfo(linalgOp, sharedMemTransposeFilter);
// Checks preconditions... |
codereview_new_cpp_data_9504 | void addGPUMatmulTensorCorePassPipeline(OpPassManager &pm,
}
void addGPUTransposePassPipeline(OpPassManager &pm) {
- // tileAndBufferize(pm);
tileAndDistributeToWorkgroup(pm);
-
auto &nestedModulePM = pm.nest<ModuleOp>();
- // Distribute linalg onto threads within the workgroup.
- // nestedModulePM.ad... |
codereview_new_cpp_data_9505 | static LogicalResult setSPIRVOpConfig(const spirv::TargetEnv &targetEnv,
Operation *rootOp) {
if (IREE::Codegen::CompilationInfoAttr compilationInfo =
getCompilationInfo(rootOp)) {
- // If the op already has a lowering config coming from the IR use this and
- ... |
codereview_new_cpp_data_9506 | int main(int argc, char **argv) {
mlir::writeCodeToFile(module, outputFile->os()) outputFile->keep();
return success();
}
- llvm::errs() << "Unkonwn output format" << outputFormat << "\n";
return failure();
};
```suggestion
llvm::errs() << "Unknown output format" << outputFormat <... |
codereview_new_cpp_data_9507 | int main(int argc, char **argv) {
mlir::writeCodeToFile(module, outputFile->os()) outputFile->keep();
return success();
}
- llvm::errs() << "Unkonwn output format" << outputFormat << "\n";
return failure();
};
```suggestion
llvm::errs() << "Unknown output format" << outputFormat <... |
codereview_new_cpp_data_9508 | int main(int argc, char **argv) {
mlir::writeCodeToFile(module, outputFile->os()) outputFile->keep();
return success();
}
- llvm::errs() << "Unkonwn output format" << outputFormat << "\n";
return failure();
};
```suggestion
llvm::errs() << "Unknown output format" << outputFormat <... |
codereview_new_cpp_data_9510 | struct ScatterOpImplicitBatch : public OpRewritePattern<mhlo::ScatterOp> {
auto indices = op.scatter_indices();
auto indicesTy = indices.getType().cast<ShapedType>();
- // Check whether indices
if (!indicesTy.hasRank()) return failure();
if (indicesTy.getRank() != 1 && indexVectorDim != 0) {
... |
codereview_new_cpp_data_9512 | spirv::DeviceType getDeviceType(const TargetTriple &triple) {
/// Returns the Vulkan version for the given target `triple`.
Vulkan::Version getVersion(const TargetTriple &triple) {
- // Android 11/12 stays at Vulkan 1.1.
if (triple.getOS() == TargetTripleOS::Android30 ||
triple.getOS() == TargetTripleOS... |
codereview_new_cpp_data_9513 | LogicalResult setAMDCodeGenConfig(const spirv::TargetEnv &targetEnv,
int subgroupSize = targetEnv.getResourceLimits().getSubgroupSize();
if (auto linalgOp = dyn_cast<linalg::LinalgOp>(rootOp)) {
- if (linalg::isaContractionOpInterface(linalgOp) &&
- llvm::is_contained({2u, 3u}, linalgOp.getNumParalle... |
codereview_new_cpp_data_9514 | static bool isTransposeOp(linalg::LinalgOp linalgOp) {
return false;
}
- // Only transpose static sizes
- if (inputShape[0] == ShapedType::kDynamicSize ||
- inputShape[1] == ShapedType::kDynamicSize ||
- outputShape[0] == ShapedType::kDynamicSize ||
- outputShape[1] == ShapedType::kDynamicSi... |
codereview_new_cpp_data_9997 |
// SPDX - License - Identifier: GPL - 3.0 +
#include "MantidQtWidgets/Common/QtJobRunner.h"
-#include "MantidAPI/AlgorithmRuntimeProps.h"
-#include "MantidAPI/IAlgorithm.h"
#include "MantidQtWidgets/Common/BatchAlgorithmRunner.h"
#include "MantidQtWidgets/Common/ConfiguredAlgorithm.h"
#include "MantidQtWidgets/... |
codereview_new_cpp_data_9999 | TimeSplitter::TimeSplitter(const Mantid::API::MatrixWorkspace_sptr &ws) {
const auto X = ws->binEdges(0);
const auto &Y = ws->y(0);
if (X.size() != Y.size() + 1) {
throw std::runtime_error(
"Size of x values must be one more than size of y values to construct TimeSplitter from MatrixWorkspace.... |
codereview_new_cpp_data_10002 | static int start_process( struct vine_process *p, struct link *manager )
list_push_tail(coprocess_list, p->coprocess);
hash_table_insert(features, duty_name, (void **) 1);
send_features(manager);
- send_message(manager, "duty-update %d %s\n", p->task->task_id, "STARTED");
send_resource_update(manager... |
codereview_new_cpp_data_10003 | static vine_msg_code_t vine_manager_recv_no_retry(struct vine_manager *q, struct
result = handle_cache_update(q, w, line);
} else if (string_prefix_is(line, "cache-invalid")) {
result = handle_cache_invalid(q, w, line);
- }
-// else if (string_prefix_is(line, "worker-init")) {
-// result = handle_worker_init... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.