1414. ftr VB CB
1515. ftr VBI CBI
1616.\}
17- .TH "fi_mr" "3" "2024\- 10\- 11 " "Libfabric Programmer\[cq ] s Manual" "#VERSION#"
17+ .TH "fi_mr" "3" "2024\- 10\- 15 " "Libfabric Programmer\[cq ] s Manual" "#VERSION#"
1818.hy
1919.SH NAME
2020.PP
@@ -152,6 +152,17 @@ mode bits, specified through the domain attributes (mr_mode field).
152152Each mr_mode bit requires that an application take specific steps in
153153order to use memory buffers with libfabric interfaces.
154154.PP
155+ As a special case, a new memory region can be created from an existing
156+ memory region.
157+ Such a new memory region is called a sub-MR, and the existing memory
158+ region is called the base MR.
159+ Sub-MRs may be used to shared hardware resources, such as virtual to
160+ physical address translations and page pinning.
161+ This can improve performance when creating and destroying sub-regions
162+ that need different access rights.
163+ The base MR itself can also be a sub-MR, allowing for a hierarchy of
164+ memory regions.
165+ .PP
155166The following apply to memory registration.
156167.TP
157168\f[I] Default Memory Registration \f[ R ]
@@ -630,8 +641,8 @@ passed directly into calls as function parameters.
630641\f[ C ]
631642struct fi_mr_attr {
632643 union {
633- const struct iovec *mr_iov;
634- const struct fi_mr_dmabuf *dmabuf;
644+ const struct iovec *mr_iov;
645+ const struct fi_mr_dmabuf *dmabuf;
635646 };
636647 size_t iov_count;
637648 uint64_t access;
@@ -650,6 +661,8 @@ struct fi_mr_attr {
650661 } device;
651662 void *hmem_data;
652663 size_t page_size;
664+ const struct fid_mr *base_mr;
665+ size_t sub_mr_cnt;
653666};
654667
655668struct fi_mr_auth_key {
@@ -880,6 +893,32 @@ failed transfers to or from the region.
880893.PP
881894Providers may choose to ignore page size.
882895This will result in a provider selected page size always being used.
896+ .SS base_mr
897+ .PP
898+ If non-NULL, create a sub-MR from an existing memory region specified by
899+ the base_mr field.
900+ .PP
901+ The sub-MR must be fully contained within the base MR; however, the
902+ sub-MR has its own authorization keys and access rights.
903+ The following attributes are inherited from the base MR, and as a
904+ result, are ignored when creating the sub-MR:
905+ .PP
906+ iface, device, hmem_data, page_size
907+ .PP
908+ The sub-MR should hold a reference to the base MR.
909+ When fi_close is called on the base MR, the call would fail if there are
910+ any outstanding sub-MRs.
911+ .PP
912+ The base_mr field must be NULL if the FI_MR_DMABUF flag is set.
913+ .SS sub_mr_cnt
914+ .PP
915+ The number of sub-MRs expected to be created from the memory region.
916+ This value is not a limit.
917+ Instead, it is a hint to the provider to allow provider specific
918+ optimization for sub-MR creation.
919+ For example, the provider may reserve access keys or pre-allocation
920+ fid_mr objects.
921+ The provider may ignore this hint.
883922.SS fi_hmem_ze_device
884923.PP
885924Returns an hmem device identifier for a level zero <driver, device>
@@ -979,6 +1018,13 @@ fi_mr_attr structure.
9791018This flag is only usable for domains opened with FI_HMEM capability
9801019support.
9811020.TP
1021+ \f[I] FI_MR_SINGLE_USE \f[ R ]
1022+ This flag indicates that the memory region is only used for a single
1023+ operation.
1024+ After the operation is complete, the key associated with the memory
1025+ region is automatically invalidated and can no longer be used for remote
1026+ access.
1027+ .TP
9821028\f[I] FI_AUTH_KEY \f[ R ]
9831029Only valid with domains configured with FI_AV_AUTH_KEY.
9841030When used with fi_mr_regattr, this flag denotes that the
0 commit comments