id stringlengths 27 29 | content stringlengths 226 3.24k |
|---|---|
codereview_new_cpp_data_12008 | TEST_F(ModelFixture, 4678_SurfaceGlassUFactorSqlError) {
ASSERT_TRUE(surface->uFactor());
double uFactor = surface->uFactor().get();
- EXPECT_TRUE(openstudio::equal(0.310, uFactor, 1.0E-3));
ASSERT_TRUE(surface->thermalConductance());
double thermalConductance = surface->thermalConductance().get();
- ... |
codereview_new_cpp_data_12009 | namespace model {
OptionalDouble()},
{"SurfacePropertySurroundingSurfaces", "Surrounding Surface Temperature Schedule", "surroundingSurfaceTemperatureSchedule", true, "Temperature",
OptionalDouble(), OptionalDouble()},
- {"SurfacePropertyGroundSurfaces", "Ground Surface Temperature Schedule... |
codereview_new_cpp_data_12010 | namespace model {
OptionalDouble()},
{"SurfacePropertySurroundingSurfaces", "Surrounding Surface Temperature Schedule", "surroundingSurfaceTemperatureSchedule", true, "Temperature",
OptionalDouble(), OptionalDouble()},
- {"SurfacePropertyGroundSurfaces", "Ground Surface Temperature Schedule... |
codereview_new_cpp_data_12011 | namespace energyplus {
}
// Rated Cooling Coefficient of Performance
- if ((value = modelObject.ratedCoolingCoefficientofPerformance())) {
- idfObject.setDouble(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::GrossRatedCoolingCOP, *value);
- }
// Rated Entering Water Temperature
- i... |
codereview_new_cpp_data_12012 | namespace model {
}
double CoilHeatingDXSingleSpeed::ratedSupplyFanPowerPerVolumeFlowRate() const {
return getImpl<detail::CoilHeatingDXSingleSpeed_Impl>()->ratedSupplyFanPowerPerVolumeFlowRate2017();
}
bool CoilHeatingDXSingleSpeed::setRatedSupplyFanPowerPerVolumeFlowRate(double ratedSupplyFanPow... |
codereview_new_cpp_data_12013 | namespace energyplus {
TableLookup tableLookup(model);
// Name
- if (s = tableMulti.nameString()) {
- tableLookup.setName(*s);
- }
for (WorkspaceObject source : tableMulti.sources()) {
for (unsigned index : source.getSourceIndices(tableMulti.handle())) {
```suggestio... |
codereview_new_cpp_data_12014 | namespace openstudio {
namespace energyplus {
boost::optional<IdfObject> ForwardTranslator::translateOutputControlTableStyle(OutputControlTableStyle& modelObject) {
- IdfObject idfObject(openstudio::IddObjectType::OutputControl_Table_Style);
- m_idfObjects.push_back(idfObject);
- OptionalString s = ... |
codereview_new_cpp_data_12015 | namespace openstudio {
namespace energyplus {
boost::optional<IdfObject> ForwardTranslator::translateOutputControlTableStyle(OutputControlTableStyle& modelObject) {
- IdfObject idfObject(openstudio::IddObjectType::OutputControl_Table_Style);
- m_idfObjects.push_back(idfObject);
- OptionalString s = ... |
codereview_new_cpp_data_12016 | namespace openstudio {
namespace energyplus {
boost::optional<IdfObject> ForwardTranslator::translateOutputControlTableStyle(OutputControlTableStyle& modelObject) {
- IdfObject idfObject(openstudio::IddObjectType::OutputControl_Table_Style);
- m_idfObjects.push_back(idfObject);
- OptionalString s = ... |
codereview_new_cpp_data_12017 | namespace openstudio {
namespace energyplus {
boost::optional<IdfObject> ForwardTranslator::translateOutputControlTableStyle(OutputControlTableStyle& modelObject) {
- IdfObject idfObject(openstudio::IddObjectType::OutputControl_Table_Style);
- m_idfObjects.push_back(idfObject);
- OptionalString s = ... |
codereview_new_cpp_data_12018 | namespace energyplus {
boost::optional<IdfObject> ForwardTranslator::translateOutputSQLite(model::OutputSQLite& modelObject) {
- IdfObject idfObject(openstudio::IddObjectType::Output_SQLite);
- m_idfObjects.push_back(idfObject);
- std::string optionType = modelObject.optionType();
- idfObject.setS... |
codereview_new_cpp_data_12019 | namespace model {
/// @cond
OutputSQLite::OutputSQLite(std::shared_ptr<detail::OutputSQLite_Impl> impl) : ModelObject(impl) {}
OutputSQLite::OutputSQLite(Model& model) : ModelObject(OutputSQLite::iddObjectType(), model) {
- setOptionType("SimpleAndTabular");
- setUnitConversionforTabularData("UseOutputC... |
codereview_new_cpp_data_12020 |
#include "../core/Assert.hpp"
#include "../core/Json.hpp"
-#include "../geometry/point3d.hpp"
-#include "../geometry/vector3d.hpp"
#include "../geometry/Geometry.hpp"
-#include "../geometry/intersection.hpp"
#include <iomanip>
Ubuntu (and optionally Mac) are using case-sensitive filesystems.
```suggestio... |
codereview_new_cpp_data_12021 | void CompareTwoModels(Model& model, Model& baseline) {
// Compare stories
// Match by name,compare properties
// Compare shading count
- double tol = 0.001; // Same tolerance as defaulyts for circularEqual
auto thermalZones1 = model.getModelObjects<ThermalZone>();
auto thermalZones2 = baseline.get... |
codereview_new_cpp_data_12022 | namespace energyplus {
idfObject.setDouble(Material_AirGapFields::ThermalResistance, modelObject.thermalResistance());
- // Call the translation of these objects, which has two advantages:
- // * will not translate them if they are orphaned (=not referencing a material), and,
- // * makes the order o... |
codereview_new_cpp_data_12023 | namespace energyplus {
idfObject.setDouble(WindowMaterial_BlindFields::MaximumSlatAngle, *d);
}
- // Call the translation of these objects, which has two advantages:
- // * will not translate them if they are orphaned (=not referencing a material), and,
- // * makes the order of these objects in... |
codereview_new_cpp_data_12024 | namespace energyplus {
result->setDouble(WindowMaterial_BlindFields::MaximumSlatAngle, 60);
}
- // Call the translation of these objects, which has two advantages:
- // * will not translate them if they are orphaned (=not referencing a material), and,
- // * makes the order of these objects in t... |
codereview_new_cpp_data_12025 | namespace energyplus {
idfObject.setString(Material_RoofVegetationFields::MoistureDiffusionCalculationMethod, *s);
}
- // Call the translation of these objects, which has two advantages:
- // * will not translate them if they are orphaned (=not referencing a material), and,
- // * makes the orde... |
codereview_new_cpp_data_12026 | TEST_F(ModelFixture, UniqueModelObjectCachedGetters) {
EXPECT_TRUE(m.getOptionalUniqueModelObject<RunPeriodControlDaylightSavingTime>());
EXPECT_EQ(i++, m.getModelObjects<ModelObject>().size());
- EXPECT_FALSE(m.getOptionalUniqueModelObject<YearDescription>());
EXPECT_EQ(i, m.getModelObjects<ModelObject>()... |
codereview_new_cpp_data_12027 | namespace model {
if (resultingObjects.empty()) {
return boost::none;
}
- OS_ASSERT(resultingObjects.size() <= component.numObjects()); // we may not be adding unique object(s) to the workspace
for (const WorkspaceObject& wo : resultingObjects) {
- LOG(Warn, wo.nameString());... |
codereview_new_cpp_data_12030 |
#ifdef AMREX_TINY_PROFILING
#include <AMReX_TinyProfiler.H>
#else
-struct MemStat {};
#endif
#include <utility>
Could we add `namespace amrex` here?
#ifdef AMREX_TINY_PROFILING
#include <AMReX_TinyProfiler.H>
#else
+namespace amrex {
+ struct MemStat {};
+}
#endif
#include <utility> |
codereview_new_cpp_data_12031 | MFIter::Finalize ()
#pragma omp single
#endif
m_fa->clearThisBD();
m_fa.reset(nullptr);
}
}
```suggestion
}
if (m_fa) {
m_fa.reset(nullptr);
}
```
MFIter::Finalize ()
#pragma omp single
#endif
m_fa->clearThisBD();
+ }
+ if (m_fa) {
m_fa.re... |
codereview_new_cpp_data_12032 | Arena::Initialize ()
// see reason on allowed reuse of the default CPU BArena in Arena::Finalize
BL_ASSERT(the_arena == nullptr || the_arena == The_BArena());
BL_ASSERT(the_async_arena == nullptr);
- BL_ASSERT(the_device_arena == nullptr || the_arena == The_BArena());
- BL_ASSERT(the_managed_arena... |
codereview_new_cpp_data_12033 | Arena::Initialize ()
// see reason on allowed reuse of the default CPU BArena in Arena::Finalize
BL_ASSERT(the_arena == nullptr || the_arena == The_BArena());
BL_ASSERT(the_async_arena == nullptr);
- BL_ASSERT(the_device_arena == nullptr || the_arena == The_BArena());
- BL_ASSERT(the_managed_arena... |
codereview_new_cpp_data_12034 | Arena::Initialize ()
// see reason on allowed reuse of the default CPU BArena in Arena::Finalize
BL_ASSERT(the_arena == nullptr || the_arena == The_BArena());
BL_ASSERT(the_async_arena == nullptr);
- BL_ASSERT(the_device_arena == nullptr || the_arena == The_BArena());
- BL_ASSERT(the_managed_arena... |
codereview_new_cpp_data_12035 | MLTensorOp::compVelGrad (int amrlev, const Array<MultiFab*,AMREX_SPACEDIM>& flux
Box const zbx = mfi.nodaltilebox(2);)
AMREX_D_TERM(Array4<Real> const fxfab = fluxes[0]->array(mfi);,
Array4<Real> const fyfab = fluxes[1]->array(mfi);,
- Array4<Rea... |
codereview_new_cpp_data_12036 | MLTensorOp::compVelGrad (int amrlev, const Array<MultiFab*,AMREX_SPACEDIM>& flux
Box const zbx = mfi.nodaltilebox(2);)
AMREX_D_TERM(Array4<Real> const fxfab = fluxes[0]->array(mfi);,
Array4<Real> const fyfab = fluxes[1]->array(mfi);,
- Array4<Rea... |
codereview_new_cpp_data_12037 | BuildFromChkptFile (std::string const& fname,
int max_coarsening_level, int ngrow, bool build_coarse_level_by_coarsening,
bool a_extend_domain_face, int a_num_coarsen_opt)
{
- AMREX_ALWAYS_ASSERT_WITH_MESSAGE(a_num_coarsen_opt == 0,
- "C... |
codereview_new_cpp_data_12038 | IndexSpaceChkptFile::IndexSpaceChkptFile (const ChkptFile& chkpt_file,
if (build_coarse_level_by_coarsening) {
amrex::Abort("Failed to build required coarse EB level "+std::to_string(ilev));
} else {
- m_chkpt_file_level.emplace_back(this, chkpt... |
codereview_new_cpp_data_12039 | ChkptFileLevel::set_invalid_ghost_data_covered ()
for (int idim = 0; idim < AMREX_SPACEDIM; ++idim)
{
auto& edgecent = m_edgecent[idim];
#ifdef AMREX_USE_OMP
#pragma omp parallel if (Gpu::notInLaunchRegion())
#endif
{
- BoxArray const& covered_edge_grids = amrex::convert(m_cov... |
codereview_new_cpp_data_12040 | StateData::FillBoundary (Box const& bx,
{
BL_PROFILE("StateData::FillBoundary(geom)");
- if (domain.contains(enclosedCells(bx))) return;
Vector<BCRec> bcr(num_comp);
What if the domain is nodal type like Press_Type in IAMR?
StateData::FillBoundary (Box const& bx,
{
BL_PROFILE("... |
codereview_new_cpp_data_12054 | int procinfo_setup(PROC_MAP& pm) {
// };
//
double total_cpu_time() {
- static natural_t processorCount = 0;
processor_cpu_load_info_t cpuLoad;
mach_msg_type_number_t processorMsgCount;
static double scale;
uint64_t totalUserTime = 0;
- if (processorCount == 0) {
long hz = sysco... |
codereview_new_cpp_data_12055 | wxPanel* CDlgAdvPreferencesBase::createProcessorTab(wxNotebook* notebook) {
m_txtMaxLoad = new wxTextCtrl(
box, ID_TXTMAXLOAD, wxEmptyString, wxDefaultPosition, getTextCtrlSize(wxT("100.00")), wxTE_RIGHT
);
addNewRowToSizer(box_sizer,
- wxString (_("Suspend computing when your computer i... |
codereview_new_cpp_data_12056 | wxPanel* CDlgAdvPreferencesBase::createProcessorTab(wxNotebook* notebook) {
box, ID_DEFAULT, _("Use at most"), wxDefaultPosition, wxDefaultSize, 0
);
m_txtProcUseProcessors = new wxTextCtrl(box, ID_TXTPROCUSEPROCESSORS, wxEmptyString, wxDefaultPosition, textCtrlSize, wxTE_RIGHT );
wxStaticText*... |
codereview_new_cpp_data_12057 | void CDlgAdvPreferences::ReadPreferenceSettings() {
// 0 means "no restriction" but we don't use a checkbox here
if (prefs.max_ncpus_pct == 0.0) prefs.max_ncpus_pct = 100.0;
DisplayValue(prefs.max_ncpus_pct, m_txtProcUseProcessors);
DisplayValue(prefs.niu_max_ncpus_pct, m_txtProcUseProcessorsNotInU... |
codereview_new_cpp_data_12058 | void CDlgAdvPreferences::ReadPreferenceSettings() {
// 0 means "no restriction" but we don't use a checkbox here
if (prefs.max_ncpus_pct == 0.0) prefs.max_ncpus_pct = 100.0;
DisplayValue(prefs.max_ncpus_pct, m_txtProcUseProcessors);
DisplayValue(prefs.niu_max_ncpus_pct, m_txtProcUseProcessorsNotInU... |
codereview_new_cpp_data_12059 | int VBOX_BASE::get_scratch_directory(string& dir) {
int VBOX_BASE::get_slot_directory(string& dir) {
char slot_dir[256];
- if (getcwd(slot_dir, sizeof(slot_dir))) {;}
dir = slot_dir;
if (!dir.empty()) {
Maybe instead of this weird looking code is better to check for an error? In case of functio... |
codereview_new_cpp_data_12061 |
#define COLUMN_PROGRESS 2
#define COLUMN_SIZE 3
#define COLUMN_TIME 4
-#define COLUMN_TOCOMPLETION 5
-#define COLUMN_SPEED 6
-#define COLUMN_STATUS 7
// DefaultShownColumns is an array containing the
// columnIDs of the columns to ... |
codereview_new_cpp_data_12063 | static void filename_hash(const char* filename, int fanout, char* dir) {
//
int check_download_file(const char* file_path, const char* dl_hier_path) {
bool md5_file_exists = false;
- char md5_file_path[256];
- char md5_hash_src[33], md5_hash_dst[33];
double nbytes;
std::string file_content, file... |
codereview_new_cpp_data_12064 | static void filename_hash(const char* filename, int fanout, char* dir) {
//
int check_download_file(const char* file_path, const char* dl_hier_path) {
bool md5_file_exists = false;
- char md5_file_path[256];
- char md5_hash_src[33], md5_hash_dst[33];
double nbytes;
std::string file_content, file... |
codereview_new_cpp_data_12335 | void initONNXBindings(PyObject* module) {
ONNXShapeTypeInference(graph, params_dict, opset_version);
}),
py::arg("graph"),
- py::arg("params_dict") = true,
py::arg("opset_version"))
.def(
"_jit_pass_onnx_set_dynamic_input_shape",
1. Shou... |
codereview_new_cpp_data_12336 | static bool cb_dirsrc(void *user, void *data) {
static bool cb_cfgsanbox_grain(void *user, void *data) {
RConfigNode *node = (RConfigNode*) data;
if (strstr (node->value, "?")) {
- eprintf ("comma separated grain types to be masked out by the sandbox.\n");
- eprintf ("all, none, disk, files, exec, socket, exec\... |
codereview_new_cpp_data_12337 | static void anop_esil(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len,
R_LOG_ERROR ("unknown operand size: %d", gop.insn->detail->x86.operands[0].size);
val = 256;
}
- // experimental simplified expression
esilprintf (op,
"%s,0x%"PFMT64x",&,POP,$z,cf,:=,"
"%s,%s,<<=,"
```suggestion
/... |
codereview_new_cpp_data_12338 | R_API bool r_project_rename(RProject *p, const char *newname) {
return true;
}
}
return false;
}
same here it will leak
R_API bool r_project_rename(RProject *p, const char *newname) {
return true;
}
}
+ free (newprjdir);
return false;
}
|
codereview_new_cpp_data_12339 | static bool esil_float_ceil(REsil *esil) {
ret = esil_pushnum_float (esil, ceil(s));
}
} else {
- ERR ("esil_float_ceil: invalid parameters.");
}
free (src);
} else {
```suggestion
ERR ("esil_float_ceil: invalid parameters");
```
static bool esil_float_ceil(REsil *esil) {
ret = esil_... |
codereview_new_cpp_data_12340 | static int cmd_print(void *data, const char *input) {
cmd_pCx (core, input + 2, "pc");
break;
default:
- R_LOG_ERROR ("Usage: pC[dDaAxwc] - column output for pxa, pxA, pxw, .. ");
break;
}
break;
```suggestion
eprintf ("Usage: pC[dDaAxwc] - column output for pxa, pxA, pxw, ..\n");
```
st... |
codereview_new_cpp_data_12341 | R_API int r_main_ravc2(int argc, const char **argv) {
printf ("Branch: %s\n", current_branch);
RList *uncommitted = rvc->get_uncommitted (rvc);
if (r_list_empty (uncommitted)) {
- printf ("All files are committed\n");
} else {
- printf ("The following files were NOT committed:\n");
RListIter... |
codereview_new_cpp_data_12342 | int file_reset(RMagic *ms) {
ms->haderr = 0;
ms->error = -1;
if (!ms->mlist) {
- eprintf ("no magic files loaded, nothing to scan\n");
return -1;
}
return 0;
```suggestion
// eprintf ("no magic files loaded, nothing to scan\n");
```
int file_reset(RMagic *ms) {
ms->haderr = 0;
ms->error = -1;
... |
codereview_new_cpp_data_12343 | R_API void r_core_diff_show_json(RCore *c, RCore *c2) {
fcns = r_anal_get_fcns (c->anal);
if (r_list_empty (fcns)) {
- R_LOG_INFO ("No functions found, try running with -A or load a project");
return;
}
Yes, error seems more correct indeed.
R_API void r_core_diff_show_json(RCore *c, RCore *c2) {
... |
codereview_new_cpp_data_12344 | static inline bool write_num_sz(ut64 n, int byte_sz, ut8 *outbuf, int outsz) {
int bits = r_num_to_bits (NULL, n);
// TODO: signedness prbly wrong...
if (bits > byte_sz * 8) {
- R_LOG_ERROR ("Arg 0x" PFMT64x " more then %d bits\n", n, bits);
false;
}
switch (byte_sz) {
```suggestion
R_LOG_ERROR ("Arg... |
codereview_new_cpp_data_12345 | static bool subvar(RParse *p, RAnalFunction *f, ut64 addr, int oplen, char *data
ripend = "]";
}
char * maybe_num = neg? neg+1 : rip;
- if( r_is_valid_input_num_value(NULL, maybe_num)){
if (neg) {
- repl_num -= r_num_get(NULL, maybe_num);
} else {
- repl_num += r_num_get(NULL, maybe_nu... |
codereview_new_cpp_data_12346 | static bool subvar(RParse *p, RAnalFunction *f, ut64 addr, int oplen, char *data
ripend = "]";
}
char * maybe_num = neg? neg+1 : rip;
- if( r_is_valid_input_num_value(NULL, maybe_num)){
if (neg) {
- repl_num -= r_num_get(NULL, maybe_num);
} else {
- repl_num += r_num_get(NULL, maybe_nu... |
codereview_new_cpp_data_12347 | static bool cmd_onn(RCore *core, const char* input) {
*arg_perm++ = 0;
perms = r_str_rwx (arg_perm);
}
- Onn on = {arg0, core, ptr};
ut64 addr = 0LL;
// check if file is opened already
if (r_str_startswith (input, "nnu")) {
```suggestion
Onn on = {arg0, NULL, core};
```
static bool cmd_onn(RCore *c... |
codereview_new_cpp_data_12348 | static inline RBinWasmSection *sections_first_custom_name(RBinWasmObj *bin) {
RBinWasmSection *sec;
r_list_foreach (bin->g_sections, iter, sec) {
if (sec->id == R_BIN_WASM_SECTION_CUSTOM && sec->size > 6) {
- ut8 _tmp[CUST_NAME_START_LEN];
r_buf_read_at (buf, sec->offset, _tmp, CUST_NAME_START_LEN);
i... |
codereview_new_cpp_data_12349 | RBinAddr *r_bin_mz_get_main_vaddr (struct r_bin_mz_obj_t *bin) {
}
ZERO_FILL (b);
if (r_buf_read_at (bin->b, entry->paddr, b, sizeof (b)) < 0) {
- R_LOG_WARN ("Warning: Cannot read entry at 0x%16" PFMT64x "", (ut64)entry->paddr);
free (entry);
return NULL;
}
```suggestion
R_LOG_WARN ("Warning: Canno... |
codereview_new_cpp_data_12350 | static st32 parse_type(Context *ctx, const ut64 offset, RStrBuf *strbuf, ut64 *s
*visited = su;
}
if (visited && set_u_contains (*visited, offset)) {
- R_LOG_WARN ("Warning: anal.dwarf.parse_type: infinite recursion detected.");
return -1;
}
set_u_add (*visited, offset);
Remove Warning: too
static st... |
codereview_new_cpp_data_12351 | R_API bool r_core_anal_fcn(RCore *core, ut64 at, ut64 from, int reftype, int dep
if (core->io->va) {
if (!r_io_is_valid_offset (core->io, at, !core->anal->opt.noncode)) {
if (core->anal->verbose) {
- R_LOG_WARN ("Warning: Address not mapped or not executable at 0x%08"PFMT64x"", at);
}
return false;... |
codereview_new_cpp_data_12352 | R_API bool r_anal_function_add_bb(RAnal *a, RAnalFunction *fcn, ut64 addr, ut64
return false;
}
if (size > a->opt.bb_max_size) {
- R_LOG_WARN ("can't allocate such big bb of %"PFMT64d" bytes at 0x%08"PFMT64x"", (st64)size, addr);
r_warn_if_reached ();
return false;
}
```suggestion
R_LOG_WARN ("can'... |
codereview_new_cpp_data_12353 | static const char *recovery_apply_complete_object_locator(RRTTIMSVCAnalContext *
if (!col->td) {
if (context->vt_context->anal->verbose) {
- R_LOG_WARN ("no td for col at 0x%"PFMT64x"", col->addr);
}
return NULL;
}
```suggestion
R_LOG_WARN ("no td for col at 0x%"PFMT64x, col->addr);
```
static... |
codereview_new_cpp_data_12354 | static int i8080_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int le
char out[32];
int ilen = i8080_disasm (data, out, len);
if (mask & R_ANAL_OP_MASK_DISASM) {
- op->mnemonic = strndup (out, sizeof(out));
}
op->addr = addr;
op->type = R_ANAL_OP_TYPE_UNK;
```suggestion
op->mnemonic = r_str... |
codereview_new_cpp_data_12355 | static int archinfo(RAnal *anal, int q) {
case R_ANAL_ARCHINFO_MIN_OP_SIZE:
return 2;
case R_ANAL_ARCHINFO_DATA_ALIGN:
const char *cpu = anal->config->cpu;
if (strstr (cpu, "68030") || strstr (cpu, "68040") || strstr (cpu, "68060")) {
return 1;
- } else {
- return 2;
}
}
return 2;
```sugges... |
codereview_new_cpp_data_12356 | static int cmd_info(void *data, const char *input) {
r_cons_printf ("agn %s\n", cls->name);
}
}
- }
- else if (fullGraph) {
r_list_foreach (obj->classes, iter, cls) {
if (cls->super) {
r_cons_printf ("agn %s\n", cls->super);
never use naked blocks. this shuo... |
codereview_new_cpp_data_12778 | get_signal_state(PyObject *module)
static inline int
compare_handler(PyObject *func, PyObject *dfl_ign_handler)
{
if (func == NULL || dfl_ign_handler == NULL) {
return 0;
}
It's not really clear to me _why_ this situation could arise but it is a valid check regardless.
get_signal_state(PyObjec... |
codereview_new_cpp_data_12779 | test_code_extra(PyObject* self, PyObject *Py_UNUSED(callable))
goto finally;
}
assert ((uintptr_t)extra == 77);
- // Need to reset code extra value.
res = PyUnstable_Code_SetExtra(test_func_code, code_extra_index, NULL);
if (res < 0) {
goto finally;
```suggestion
// Rever... |
codereview_new_cpp_data_12780 | winreg_QueryValueEx_impl(PyObject *module, HKEY key, const Py_UNICODE *name)
while (1) {
Py_BEGIN_ALLOW_THREADS
- rc = RegQueryValueExW(key, name, NULL, &typ, pbuf,
- &size);
Py_END_ALLOW_THREADS
if (rc != ERROR_MORE_DATA) {
break;
```... |
codereview_new_cpp_data_12781 |
# include <process.h> // getpid()
#endif
-#ifdef MS_WINDOWS_NON_DESKTOP
-# include <windows.h>
#endif
/* Period parameters -- These are all magic. Don't change. */
Any harm in making this `MS_WINDOWS`? That would be obvious, but using a more specific flag suggests that something weird is going o... |
codereview_new_cpp_data_12782 |
/* Include symbols from _socket module */
#include "socketmodule.h"
-#ifdef MS_WINDOWS_GAMES
# include <wincrypt.h>
#endif
Similarly, any harm in just making this `MS_WINDOWS`?
/* Include symbols from _socket module */
#include "socketmodule.h"
+#ifdef MS_WINDOWS
# include <wincrypt.h>
#endif
|
codereview_new_cpp_data_12783 | _Py_abspath(const wchar_t *path, wchar_t **abspath_p)
// The Windows Games API family does not provide these functions
// so provide our own implementations. Remove them in case they get added
// to the Games API family
#if defined(MS_WINDOWS) && !defined(MS_WINDOWS_APP) && !defined(MS_WINDOWS_SYSTEM)
HRESULT
Pa... |
codereview_new_cpp_data_12784 | _PyGen_FetchStopIterationValue(PyObject **pvalue)
PyObject *value = NULL;
if (PyErr_ExceptionMatches(PyExc_StopIteration)) {
PyObject *exc = PyErr_GetRaisedException();
- if (exc) {
- /* exception will usually be normalised already */
- value = Py_NewRef(((PyStopIteratio... |
codereview_new_cpp_data_12787 | positional_only_passed_as_keyword(PyThreadState *tstate, PyCodeObject *co,
int posonly_conflicts = 0;
PyObject* posonly_names = PyList_New(0);
if (posonly_names == NULL)
- return 1;
for(int k=0; k < co->co_posonlyargcount; k++){
PyObject* posonly_name = PyTuple_GET_ITEM(co->co_local... |
codereview_new_cpp_data_12788 | _io__WindowsConsoleIO___init___impl(winconsoleio *self, PyObject *nameobj,
int fd_is_own = 0;
HANDLE handle = NULL;
- assert(PyObject_TypeCheck((self), (PyTypeObject *)&PyWindowsConsoleIO_Type));
if (self->fd >= 0) {
if (self->closefd) {
/* Have to close the existing file firs... |
codereview_new_cpp_data_12791 | bytearrayiter_reduce(bytesiterobject *it, PyObject *Py_UNUSED(ignored))
/* _PyEval_GetBuiltin can invoke arbitrary code.
* calls must be *before* access of `it` pointers,
- * since C/C++ parameter eval order is undefined.
* see issue #101765 */
if (it->it_seq != NULL) {
```suggestion
... |
codereview_new_cpp_data_12792 | odict_repr(PyODictObject *self)
result = PyUnicode_FromFormat("%s(%R)",
_PyType_Name(Py_TYPE(self)),
dcopy);
Done:
Py_ReprLeave((PyObject *)self);
- Py_XDECREF(dcopy);
return result;
}
You can move it above the `Done` label ... |
codereview_new_cpp_data_12794 | typedef struct {
static inline itertools_state *
get_module_state(PyObject *mod)
{
- void *state = PyModule_GetState(mod);
assert(state != NULL);
return (itertools_state *)state;
}
```suggestion
void *state = _PyModule_GetState(mod);
```
typedef struct {
static inline itertools_state *
get_... |
codereview_new_cpp_data_12801 | _Py_Specialize_CompareAndBranch(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *inst
{
assert(_PyOpcode_Caches[COMPARE_AND_BRANCH] == INLINE_CACHE_ENTRIES_COMPARE_OP);
_PyCompareOpCache *cache = (_PyCompareOpCache *)(instr + 1);
int next_opcode = _Py_OPCODE(instr[INLINE_CACHE_ENTRIES_COMPARE_OP + 1]);
... |
codereview_new_cpp_data_12806 | PyCode_GetFreevars(PyCodeObject *code)
int
_PyCode_GetNumFrameSlots(PyCodeObject *code)
{
- /* This function needs to remain in sync with Tools/build/deepfreeze.py */
assert(code->co_framesize >= (int)FRAME_SPECIALS_SIZE);
return code->co_framesize - FRAME_SPECIALS_SIZE;
}
Odd that one line needs an ... |
codereview_new_cpp_data_12807 | PyCode_GetFreevars(PyCodeObject *code)
int
_PyCode_GetNumFrameSlots(PyCodeObject *code)
{
- /* This function needs to remain in sync with Tools/build/deepfreeze.py */
assert(code->co_framesize >= (int)FRAME_SPECIALS_SIZE);
return code->co_framesize - FRAME_SPECIALS_SIZE;
}
```suggestion
/* This ... |
codereview_new_cpp_data_12808 | int___sizeof___impl(PyObject *self)
{
Py_ssize_t res;
- res = offsetof(PyLongObject, ob_digit) + Py_MAX(Py_ABS(Py_SIZE(self)), 1)*sizeof(digit);
return res;
}
Minor suggestion: break this up to avoid the long line (we try but don't always succeed to keep line length to 79 characters), and add a com... |
codereview_new_cpp_data_12810 | 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_12821 | void addMmt4dTilingExpertPassPipeline(OpPassManager &passManager,
{
LinalgSingleTilingExpertPassOptions options;
options.vectorize = true;
- options.vectorize = enableVectorMasking;
nestedModulePM.addNestedPass<func::FuncOp>(
createLinalgSingleTilingExpertPass(options));
}
This should... |
codereview_new_cpp_data_12822 | struct SwitchStoreOfIfResultValue
auto resultNumber = storeOp.getValue().cast<OpResult>().getResultNumber();
auto moveStoreInsideBody = [&](Block *body) {
- OpBuilder::InsertionGuard g2(rewriter);
auto yieldOp = cast<scf::YieldOp>(body->getTerminator());
rewriter.setInsertionPoint(yieldO... |
codereview_new_cpp_data_12827 | 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_12828 | static LogicalResult adaptComputeConsumerToAvoidStackAllocation(
/// of tensor.unpack op for more details.
static LogicalResult replaceUnpackEmptyWithAllocTensor(OpBuilder &b,
func::FuncOp funcOp) {
- funcOp.walk<WalkOrder::PreOrder>([&](tensor::EmptyOp emptyO... |
codereview_new_cpp_data_12829 | static unsigned decideFusableLinalgOps(FunctionOpInterface funcOp,
for (Operation &op : llvm::reverse(block)) {
// If it is part of a fusion group or root op, ignore it.
if (hasFusionGroupsAttribute(&op) || hasRootOpAttribute(&op)) continue;
- // Only look for Linalg ops here. Avoid moving `lin... |
codereview_new_cpp_data_12830 | static FailureOr<IREE::Codegen::MicroKernelOpInterface> matchDAGForMicroKernel(
Type outElemType = outType.getElementType();
if (lhsElemType.isSignlessInteger(8) && rhsElemType.isSignlessInteger(8) &&
outElemType.isSignlessInteger(32)) {
- fnName = "vmvx.matmul.i8i8i32";
} else if (lhsElemType.isF32... |
codereview_new_cpp_data_12834 | static iree_status_t iree_hal_cuda_driver_create_internal(
iree_status_t status =
iree_hal_cuda_dynamic_symbols_initialize(host_allocator, &driver->syms);
- if (!iree_status_is_ok(status)) {
- iree_hal_driver_release((iree_hal_driver_t*)driver);
- return status;
- }
-
if (iree_status_is_ok(statu... |
codereview_new_cpp_data_12838 | 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_12841 | iree_status_t iree_hal_heap_buffer_wrap(
IREE_ASSERT_ARGUMENT(out_buffer);
IREE_TRACE_ZONE_BEGIN(z0);
- if (!iree_host_size_has_alignment((uintptr_t)data.data_length,
IREE_HAL_HEAP_BUFFER_ALIGNMENT)) {
IREE_TRACE_ZONE_END(z0);
return iree_make_status(
IR... |
codereview_new_cpp_data_12842 | 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_12843 | static LogicalResult isEquivalentToOpImpl(PatternRewriter &rewriter,
linalg::OpOperandVector opOutputs = linalgOp.getOutputOperands();
linalg::OpOperandVector modelOutputs = linalgModelOp.getOutputOperands();
auto notEqualFn = [](std::tuple<OpOperand *, OpOperand *> in) -> bool {
- return std::get<... |
codereview_new_cpp_data_12844 | static SmallVector<T> interchange(ArrayRef<T> elements,
SmallVector<T> rearrangedElements = llvm::to_vector(elements);
if (interchangeVector.empty())
return rearrangedElements;
- // assert((rearrangedElements.size() - offset) == interchangeVector.size() &&
- // "number of elements must equal number... |
codereview_new_cpp_data_12846 | static bool contractOpFilter(Operation *op) {
auto linalgOp = dyn_cast<linalg::LinalgOp>(op);
if (!linalgOp) return false;
- // Can't promote dynamic shapes.
if (linalgOp.hasDynamicShape()) return false;
SmallVector<unsigned> dims;
I think it makes sense to do when doing specialization. I would add a... |
codereview_new_cpp_data_12847 | SmallVector<Value, 4> getTileSizes(OpBuilder &b, Operation *op,
}));
}
void setLoweringConfig(Operation *op,
IREE::Codegen::LoweringConfigAttr config) {
op->setAttr(kConfigAttrName, config);
nit: while line
SmallVector<Value, 4> getTileSizes(OpBuilder &b, Operation *op,
... |
codereview_new_cpp_data_12848 | 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_12849 | static SmallVector<int64_t> getMinTilingSizesForEachDim(
std::max<int64_t>(minTileSizes[fastestVaryingDim], tileSize);
}
- // Limit unroll factor. For know, we assume the rightmost non-one tiled
// dimension is for vectorization and any other non-one dimension is for
// unrolling.
auto limitUnr... |
codereview_new_cpp_data_12850 | static LogicalResult setTranslationInfoAndRootConfig(
for (auto computeOp : computeOps) {
if (IREE::Codegen::CompilationInfoAttr compilationInfo =
getCompilationInfo(computeOp)) {
- (void)setUserConfig(entryPointFn, computeOp, compilationInfo);
}
}
We need to surface errors up if i... |
codereview_new_cpp_data_12851 | static LogicalResult setTransposeConfig(func::FuncOp entryPoint,
// Check alignment with tile size for each transpose.
if (auto genericOp = dyn_cast<linalg::GenericOp>(op)) {
- for (auto operandIndexPair :
- llvm::zip(genericOp.getOperands(), genericOp.getIndexingMapsArray())) {
- if (isSharedM... |
codereview_new_cpp_data_12852 | static iree_status_t iree_cpu_has_required_target_features(
iree_string_view_t required_feature = iree_yaml_node_as_string(item_node);
if (iree_string_view_is_empty(required_feature)) continue;
int64_t feature_is_supported = 0;
- fprintf(stderr, "Looking up feature by key: %.*s\n",
- (int)... |
codereview_new_cpp_data_12853 | class WGSLReplacePushConstantsPass
alignmentAttr = constantLoadOps[0].getAlignmentAttr();
}
- // hal.interface.binding.subspan -> !flow.dispatch.tensor<readonly:i32>
// * Group all push constants into a single tensor<Nxi32>
// * If individual data types differ, they'll be bitcast when ex... |
codereview_new_cpp_data_12854 | static bool isTransposeOp(linalg::LinalgOp linalgOp) {
static LogicalResult setTransposeConfig(func::FuncOp entryPoint,
Operation *op) {
TileSizesListType tileSizes;
- tileSizes.push_back({32, 32});
// Check alignment with tile size
if (auto genericOp = dyn_cast<... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.