Skip to content

[future] 1904-generate_floorplanningpy-and-floorplanning-ui-must-use-configjson-instead-of-vprxml#173

Draft
w0lek wants to merge 13 commits into
developfrom
1904-generate_floorplanningpy-and-floorplanning-ui-must-use-configjson-instead-of-vprxml
Draft

[future] 1904-generate_floorplanningpy-and-floorplanning-ui-must-use-configjson-instead-of-vprxml#173
w0lek wants to merge 13 commits into
developfrom
1904-generate_floorplanningpy-and-floorplanning-ui-must-use-configjson-instead-of-vprxml

Conversation

@w0lek

@w0lek w0lek commented Jun 8, 2026

Copy link
Copy Markdown

No description provided.

@w0lek w0lek requested a review from lalit-quicklogic June 8, 2026 20:14

// Load configFile and return the set of missing required keys. On a load/parse
// failure returns false and sets error (the keys set is then meaningless).
bool checkConfig(const std::filesystem::path& configFile,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkConfig() always fails for encrypted files

FileUtils::GetFileContent(configFile) - raw ciphertext - json::parse() throws. checkConfig() returns false for every encrypted device unconditionally. The VPR fallback runs on every single GUI load even when config.json.en is perfectly valid. The fast path is completely broken for encrypted devices.

Fix needed: Replace the raw read with QLDeviceManager::getInstance()->loadDeviceConfigJSON() which already handles the full decrypt-in-memory pipeline.

constexpr int kFirstCoreColumn = 1;

// The keys DeviceGridDescriptor / generate_floorplanning need.
const std::vector<std::string>& requiredKeys() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requiredKeys() references DSP_SIZE/BRAM_SIZE which don't exist in any current config.json

Even if fix #1 is applied, checkConfig() will still find DSP_SIZE and BRAM_SIZE missing - because no config.json in device_data/ has those keys yet. Fast path still never fires. VPR fallback still always runs.

Fix needed: Either add DSP_SIZE/BRAM_SIZE to the device_data source config.json files, or remove them from requiredKeys().

@w0lek w0lek Jun 10, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DSP_SIZE/BRAM_SIZE are already part of config.json. they were recently added. At least i see them for GF12nm 3030 device.
If we remove them fromr equired that we have to use hardcoded sizes.


} // namespace

std::filesystem::path FloorplanningConfigProvider::getEffectiveConfig() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raw file read breaks once checkConfig() is fixed

const QByteArray content = QByteArray::fromStdString(
FOEDAG::FileUtils::GetFileContent(deviceConfigFile));
Currently getEffectiveConfig() never returns a .en path because checkConfig() is broken (bug above). Once that is fixed, getEffectiveConfig() will return config.json.en for encrypted devices, and this GetFileContent() call will also read ciphertext - QJsonDocument::fromJson() fails - floorplanning cannot start.

getEffectiveConfig() should guarantee it never returns a .en path to callers -decrypt to a temporary plaintext file first, then return that path.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, i agree, i didn't aware that config.json will be under encryption, need review this

#endif // DISABLE_COMPILER_TEMP_FILES_GUARD_WORKAROUND

BaseVprCommand(); // we need this call in order to decrypt arch file and store it as m_architectureFile
std::filesystem::path CompilerOpenFPGA_ql::deviceConfigFilePath(const QLDeviceTarget& device) const

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deviceConfigFilePath() hardcodes "config.json", misses encrypted variant

std::filesystem::path CompilerOpenFPGA_ql::deviceConfigFilePath(const QLDeviceTarget& device) const {
return QLDeviceManager::getInstance()->deviceTypeDirPath(device) / std::string("config.json");
}
For encrypted devices only config.json.en exists - config.json does not. So FileUtils::FileExists() on this path returns false, and bram_type reading is silently skipped. Should use QLDeviceManager::getInstance()->deviceConfigJSONPath(device) instead, which already handles both variants.

args.push_back("--fpga_layout");
args.push_back(QLSettingsManager::getStringValue("general", "device", "layout"));
args.push_back("--device_config_file");
args.push_back(FloorplanningConfigProvider::getEffectiveConfig().string());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No empty-path guard before pushing to args

args.push_back(FloorplanningConfigProvider::getEffectiveConfig().string());
main_window_ql.cpp correctly guards against an empty return from getEffectiveConfig(). This call site does not - if both the config check and VPR fallback fail, an empty string is pushed as a generate_floorplanning.py argument and the error surfaces only as a cryptic script failure. Add the same empty-path check here.

@w0lek w0lek marked this pull request as draft June 15, 2026 17:08
@w0lek w0lek changed the title 1904-generate_floorplanningpy-and-floorplanning-ui-must-use-configjson-instead-of-vprxml [future] 1904-generate_floorplanningpy-and-floorplanning-ui-must-use-configjson-instead-of-vprxml Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants