Skip to content

#151: Renamed some fields for future expansion#150

Closed
cliffburdick wants to merge 1 commit into
mainfrom
cburdick/stream-engine-config
Closed

#151: Renamed some fields for future expansion#150
cliffburdick wants to merge 1 commit into
mainfrom
cburdick/stream-engine-config

Conversation

@cliffburdick

Copy link
Copy Markdown
Collaborator

No description provided.

@cliffburdick cliffburdick changed the title Renamed some fields for future expansion #151: Renamed some fields for future expansion Jun 10, 2026
@cliffburdick cliffburdick force-pushed the cburdick/stream-engine-config branch from 4da3d9c to 5add1c6 Compare June 10, 2026 22:29
Signed-off-by: Cliff Burdick <cburdick@nvidia.com>
@cliffburdick cliffburdick force-pushed the cburdick/stream-engine-config branch from 5add1c6 to ea46c9a Compare June 10, 2026 22:56
@cliffburdick cliffburdick marked this pull request as ready for review June 11, 2026 15:25
@greptile-apps

greptile-apps Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR renames the YAML protocol: config field to engine: and replaces separate local_ip/local_port/remote_ip/remote_port fields with URI-scheme endpoint strings (tcp://, udp://, roce://) on socket_config.local_addr and socket_config.remote_addr. The old fields are preserved as legacy fallbacks, and all example YAMLs, docs, and Python bindings are updated in lockstep.

  • Adds config_engine_from_string/config_engine_to_string, is_explicit_manager_type, and the manager_type_supports_* predicates to types.h; extends CommonConfig with an engine field and SocketConfig with local_addr_/remote_addr_.
  • Rewrites parse_socket_config to infer SocketProtocol from URI schemes (via a new anonymous-namespace URI parser in src/common.cpp), and updates ManagerFactory::get_manager_type to consult the engine: key and endpoint URI schemes before falling back to stream_type resolution.
  • Changes rdma_.port_ assignment for RoCE clients: now set from local_port_ (falling back to remote_port_), which is 0 for the new roce://host URI form — see inline note for clarification.

Confidence Score: 5/5

Safe to merge after addressing the commit-title nit; the logic changes are well-contained and backward-compatible legacy paths are preserved.

The changes are a well-scoped config-layer refactor with no new code paths in the packet I/O hot path. Backward compatibility is maintained for existing YAML configs via legacy field support. One clarification question remains open around rdma_.port_ being 0 for RoCE clients, but this appears to be an intentional design change moving the server endpoint to the application layer.

The rdma_.port_ assignment in include/daqiri/common.h (around the RoCE client port resolution) and the corresponding RDMA manager usage deserve a second look to confirm port-0 is valid for client RDMA CM binds.

Important Files Changed

Filename Overview
include/daqiri/types.h Adds config_engine_from_string/config_engine_to_string, new helper predicates (is_explicit_manager_type, manager_type_supports_stream_type, manager_type_supports_socket_protocol), adds engine and default-initialises manager_type on CommonConfig, and adds local_addr_/remote_addr_ to SocketConfig. Updates get_rdma_configs_enabled to detect RDMA via URI schemes.
include/daqiri/common.h Major refactor of YAML decode: drops the required top-level protocol: field in favour of URI schemes inferred from local_addr/remote_addr. Adds resolve_manager_type lambda called twice (before and after per-interface parse_socket_config). Backward compat via legacy local_ip/local_port + top-level protocol: preserved. rdma_.port_ assignment for RoCE clients changed — see comment.
src/common.cpp Adds URI endpoint parser (parse_endpoint_addr, apply_endpoint_addr, parse_endpoint_query, make_endpoint_addr) in an anonymous namespace; extends parse_socket_config to accept the protocol by ref and infer it from URI schemes. Validation logic is thorough; RoCE client remote_addr is explicitly rejected with a clear error.
src/manager.cpp Extends get_manager_type to check the new engine: field first, then fall back to protocol inference from local_addr/remote_addr URI schemes. config_engine_from_string can still throw inside the existing catch(std::exception) that silently returns default (pre-existing issue flagged in a prior review thread).
src/managers/socket/daqiri_socket_mgr.cpp Minimal change: reformats is_roce_protocol() and updates an error message string to reference roce:// endpoints instead of protocol=roce.
python/daqiri_common_pybind.cpp Exposes new engine field on CommonConfig and local_addr/remote_addr on SocketConfig to Python bindings. Straightforward additive change.
examples/daqiri_bench_rdma_tx_rx.yaml Converts all socket configs from local_ip/local_port/remote_ip/remote_port + top-level protocol: "roce" to local_addr: "roce://host[:port]" URI form. Also fills in rdma_bench_client.client_address which was empty in the old file.
docs/api-reference/configuration.md Replaces protocol: key documentation with engine: and URI scheme guidance; documents socket_config.local_addr/remote_addr alongside legacy fields; marks the RoCE example using the new URI form.

Reviews (3): Last reviewed commit: "Renamed some fields for future expansion" | Re-trigger Greptile

Comment thread include/daqiri/types.h
Comment on lines +453 to +461
if (is_known_but_unavailable) {
throw std::invalid_argument(
"Engine '" + str + "' is not available in this build. "
"Available engines: " + available_engines + ". "
"To enable '" + str + "', rebuild with CMake option: "
"-DDAQIRI_MGR=\"" + available_engines + " " +
(str == DAQIRI_ENGINE_STR__IBVERBS ? DAQIRI_MGR_STR__RDMA : str) +
"\"");
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 CMake rebuild suggestion uses YAML engine name instead of CMake module name

The available_engines string is built from YAML-layer names ("dpdk", "socket", "ibverbs"), but it is then embedded verbatim inside a -DDAQIRI_MGR="..." CMake suggestion. The YAML name for the RDMA engine is "ibverbs", but the corresponding DAQIRI_MGR value is "rdma". On a build that has SOCKET and RDMA compiled in but not DPDK, a user who writes engine: "dpdk" will see the instruction to rebuild with -DDAQIRI_MGR="socket ibverbs dpdk". Passing "ibverbs" to DAQIRI_MGR is not a valid CMake token; the correct command is -DDAQIRI_MGR="socket rdma dpdk". The (str == DAQIRI_ENGINE_STR__IBVERBS ? DAQIRI_MGR_STR__RDMA : str) expression on line 459 fixes the requested engine, but leaves the already-present engines in available_engines with their YAML names. A separate available_cmake_names string (substituting DAQIRI_MGR_STR__RDMA for DAQIRI_ENGINE_STR__IBVERBS) should be used in the CMake suggestion.

Comment thread include/daqiri/common.h
Comment on lines +950 to +952
if (node["engine"].IsDefined()) {
input_spec.common_.engine =
daqiri::config_engine_from_string(node["engine"].as<std::string>());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 config_engine_from_string throws but the YAML decode path has no try/catch here

Every other validation in this decode function follows the pattern DAQIRI_LOG_ERROR(…); return false;. config_engine_from_string breaks that contract by throwing std::invalid_argument for any unrecognised or unavailable engine value. The call on line 952 is not wrapped in a try/catch, so an invalid engine: field propagates as an unhandled exception out of the YAML decode function — bypassing the structured error log and producing an opaque crash instead of a clean parse failure. Either catch the exception here (logging it via DAQIRI_LOG_ERROR and returning false), or change config_engine_from_string to return a sentinel (ManagerType::UNKNOWN) and let the caller emit the diagnostic in the usual way.

Comment thread src/manager.cpp
Comment on lines +163 to +166
const std::string engine_str = node["engine"].template as<std::string>("");
if (!engine_str.empty() && engine_str != DAQIRI_MGR_STR__DEFAULT) {
return config_engine_from_string(engine_str);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Invalid engine: is silently swallowed here, returning the wrong manager type

config_engine_from_string throws std::invalid_argument on an unknown or unavailable engine string. This call sits inside the try { … } catch (const std::exception& e) { return get_default_manager_type(); } block at line 157, so an invalid YAML engine: field silently returns the default manager type instead of surfacing an error. The caller proceeds to instantiate and initialize a manager that does not match the user's intent, and the root cause — the bad engine string — is never logged. Consider returning ManagerType::UNKNOWN on error (rather than throwing) in config_engine_from_string, or re-throw/log the exception before returning the default.

Comment on lines 491 to 496
| --- | --- |
| `manager_type_from_string(str)` / `manager_type_to_string(type)` | Convert manager types. |
| `stream_type_from_string(str)` / `stream_type_to_string(type)` | Convert stream types. |
| `socket_protocol_from_string(str)` / `socket_protocol_to_string(protocol)` | Convert socket protocols. |
| `reorder_data_type_from_string(str)` / `reorder_data_type_to_string(type)` | Convert reorder data types. |
| `reorder_endianness_from_string(str)` / `reorder_endianness_to_string(endianness)` | Convert reorder endianness values. |
| `log_level_from_string(str)` / `log_level_to_string(level)` | Convert log levels. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Python docs remove SocketProtocol / socket_protocol_from_string / IPPROTO_UDP, but the pybind code still exposes them

python/daqiri_common_pybind.cpp still binds the SocketProtocol enum (lines 348-352), IPPROTO_UDP (line 665), and socket_protocol_from_string/socket_protocol_to_string (lines 712-713). The CommonConfig.protocol attribute (which this PR preserves) returns a SocketProtocol value, so the enum remains necessary for any code that inspects parsed config programmatically. Removing it from the docs while keeping it in the bindings is a confusing API contract: callers inspecting .protocol on a CommonConfig returned by parse_network_config will encounter values of an undocumented type. Either restore the SocketProtocol table entry (treating the old protocol-based API as deprecated), or remove the corresponding pybind bindings and deprecate CommonConfig.protocol access in the same PR.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@cliffburdick cliffburdick force-pushed the cburdick/stream-engine-config branch 2 times, most recently from aa63c1e to ea46c9a Compare June 11, 2026 21:00
cliffburdick added a commit that referenced this pull request Jun 11, 2026
…l field

Port the field-expansion model (originally ea46c9a / PR #150) onto the
engine-rename branch, expressed in engine naming:

- Endpoints carry the protocol as a URI scheme (tcp://, udp://, roce://)
  in socket_config.local_addr / remote_addr. The separate protocol: YAML
  field is removed; protocol is derived from the address scheme
  (protocol_from_endpoint_addr in engine.cpp).
- Optional engine: override field (config_engine_from_string); accepts
  dpdk / socket / ibverbs, rejects 'rdma' in favor of 'ibverbs'. When
  unset, engine is auto-resolved from stream_type + protocol.
- CommonConfig gains 'engine' (override) alongside 'engine_type'
  (resolved). pybind exposes both.
- Example socket/RDMA YAMLs converted to URI endpoints. Docs updated:
  configuration.md drops protocol and documents engine; concepts.md,
  configuration-walkthrough.md, README, benchmarks, socket_benchmarking
  use URI schemes.
- Fix a rename-introduced bug: the legacy-key check now rejects the old
  'manager:' key (the mechanical rename had made it wrongly reject the
  new 'engine:' field).

Verified: full container rebuild (DAQIRI_ENGINE="dpdk ibverbs", exit 0);
socket UDP run parses udp:// endpoints and derives protocol from the
scheme; raw sw-loopback TX==RX.

Signed-off-by: Cliff Burdick <cburdick@nvidia.com>
@cliffburdick cliffburdick deleted the cburdick/stream-engine-config branch June 12, 2026 17:08
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.

1 participant