-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for RDMA Atomics + Support for user-defined initiator and responder resources on connect/accept #51
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the pull request! It generally looks good to me, however I don't like introducing a new connect and accept call (see inline comments).
* Method: _connectV2 | ||
* Signature: (JJ)V | ||
*/ | ||
JNIEXPORT void JNICALL Java_com_ibm_disni_verbs_impl_NativeDispatcher__1connectV2( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the idea of multiple connect implementations. Why not only keep V2 and expose query_device to Java. This solves multiple problems at once: 1) setting initiator/responder resource without knowing what the max are 2) two implementations of the same function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. However, since the libdisni is shipped separately, it may force some developers to recompile their java code which uses the library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be ok. Developers can always choose to use an old version of the library if needed.
* Method: _acceptV2 | ||
* Signature: (JJ)V | ||
*/ | ||
JNIEXPORT void JNICALL Java_com_ibm_disni_verbs_impl_NativeDispatcher__1acceptV2( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment to connectV2
connParam.getRnr_retry_count(), connParam.getPrivate_data(), connParam.getPrivate_data_len()); | ||
|
||
MemBuf memBuf = memAlloc.allocate(connParam.CSIZE); | ||
connParam.writeBack(memBuf.getBuffer()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong indentation
@@ -76,6 +76,12 @@ public void runRDMA() throws Exception { | |||
//create a EndpointGroup. The RdmaActiveEndpointGroup contains CQ processing and delivers CQ event to the endpoint.dispatchCqEvent() method. | |||
endpointGroup = new RdmaActiveEndpointGroup<CustomClientEndpoint>(1000, false, 128, 4, 128); | |||
endpointGroup.init(this); | |||
|
|||
RdmaConnParam connParam = new RdmaConnParam(); | |||
connParam.setResponder_resources((byte) 16); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use query_device to set initiator/responder resources (see connectV2 comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I did not check that Disni did not implement it. I usually check the params manually using ibv_devinfo -v. I can add it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the new query_device function here? Otherwise this code will not work on device where responder or initiator depth is less than 16.
/* | ||
* DiSNI: Direct Storage and Networking Interface | ||
* | ||
* Author: Patrick Stuedi <[email protected]> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Obviously, Patrick is not the author of this file so please remove him and add yourself. Also please remove the IBM copyright of this file (I assume you are not an IBM employee)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. it was copy-pasted based implementation. Do I need to include his name though, as 99% of the code there is his?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree if that is the case keep his name.
/* | ||
* DiSNI: Direct Storage and Networking Interface | ||
* | ||
* Author: Patrick Stuedi <[email protected]> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above (change author, remove copyright)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong byte format of RdmaConnParam
buffer.put(retry_count); | ||
buffer.put(rnr_retry_count); | ||
buffer.put(srq); | ||
buffer.put((byte)0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cq_num is u32 not u8, so this should be putInt(0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here I do not agree. Actually, buffer.put((byte)0); is a padding. cq_num field is 8 byte aligned. To add cq_num the code should be: buffer.put(srq); buffer.put((byte)0); buffer.putInt(cq_num);
I did not add cq_num as it is ignored anyway and does not cause any problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
Hey, I have applied the suggested changes, but the one with removing old connect/accept. |
* Signature: (J)I | ||
*/ | ||
JNIEXPORT jint JNICALL | ||
Java_com_ibm_disni_verbs_impl_NativeDispatcher__1queryMaxResponderResources( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is not what I had in mind. I would like to be able to get all device attributes in Java. Otherwise we will be adding new JNI functions for every member of the struct along the way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. it was just more work.
* Signature: (J)I | ||
*/ | ||
JNIEXPORT jint JNICALL | ||
Java_com_ibm_disni_verbs_impl_NativeDispatcher__1queryMaxInitiatorDepth(JNIEnv *env, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment queryMaxResponderResources
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes. It generally looks good. I just have a few comments:
I still believe we should merge the two JNI connect and accept functions. We can keep the upper level DiSNi API consistent by setting max responder/initiator depth when no connection parameters are set.
Please also update the native library version we use to check for compatibility
@@ -76,6 +76,12 @@ public void runRDMA() throws Exception { | |||
//create a EndpointGroup. The RdmaActiveEndpointGroup contains CQ processing and delivers CQ event to the endpoint.dispatchCqEvent() method. | |||
endpointGroup = new RdmaActiveEndpointGroup<CustomClientEndpoint>(1000, false, 128, 4, 128); | |||
endpointGroup.init(this); | |||
|
|||
RdmaConnParam connParam = new RdmaConnParam(); | |||
connParam.setResponder_resources((byte) 16); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the new query_device function here? Otherwise this code will not work on device where responder or initiator depth is less than 16.
@@ -58,6 +58,11 @@ public ReadClient(String host, int port, int size, int loop) throws IOException{ | |||
private void run() throws Exception { | |||
System.out.println("ReadClient, size " + size + ", loop " + loop); | |||
|
|||
RdmaConnParam connParam = new RdmaConnParam(); | |||
connParam.setResponder_resources((byte) 0); | |||
connParam.setInitiator_depth((byte) 16); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
query_device (see other comment)
@@ -57,6 +57,11 @@ public ReadServer(String host, int port, int size, int loop) throws IOException{ | |||
private void run() throws Exception { | |||
System.out.println("ReadServer, size " + size + ", loop " + loop); | |||
|
|||
RdmaConnParam connParam = new RdmaConnParam(); | |||
connParam.setResponder_resources((byte) 16); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
query_device (see other comment)
|
||
RdmaConnParam connParam = new RdmaConnParam(); | ||
connParam.setResponder_resources((byte) 0); | ||
connParam.setInitiator_depth((byte) 16); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
query_device (see other comment)
@@ -49,6 +49,12 @@ public void run() throws Exception { | |||
//create a EndpointGroup. The RdmaActiveEndpointGroup contains CQ processing and delivers CQ event to the endpoint.dispatchCqEvent() method. | |||
endpointGroup = new RdmaActiveEndpointGroup<CustomServerEndpoint>(1000, false, 128, 4, 128); | |||
endpointGroup.init(this); | |||
|
|||
RdmaConnParam connParam = new RdmaConnParam(); | |||
connParam.setResponder_resources((byte) 16); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
query_device (see other comment)
Ok. I pushed the changes. Regarding having single accept vs. having 2 accepts in JNI. I do not think it is a good idea to keep only one call and lose back-compatibility. However, I respect your will to have a single call in the master. You are free to modify my changes and remove the second call before merging the pull request. For my personal use I need to be back-compatible and I will simply keep using my version. |
Can you please explain the use case where you need this backwards compatibility? |
The problem is that libdisini.so is not included in disni.jar and has to be installed separately. |
If we would "include" libdisni.so in the disni.jar like proposed here: #17 |
Yes, it would. |
I haven't read all the comments, and I'm fine with whatever the outcome is related to the connect/accept changes. As for including libdisni.so in disni.jar, that's something we've discussed many times and my opinion remains the same, let's not include shared libraries with the jar. For the time being, increment the version of libdisni after your changes, and similarly make sure in NativeDispatcher you increment the version of libdisni that is required. |
@patrickstuedi I want to make sure that I understood you correctly. Do you propose to have only the new accept/connect and lose back compatibility? Or are you fine with having both old and new accept/connect in the libdisni.so? |
I still need to look at the accept/connect changes in more detail, I haven't so far. But keeping an old and new version at the same time doesn't sound too appealing. I'm not so worried about backward compatibility if the changes are required and can be combined with a version bump. |
Hi,
The following changes add:
For RDMA atomics I followed implementation of NatRdma and made similar implementation of NatAtomic. Depending on opcode, the writeBack of NatIbvSendWR will append Rdma or Atomic data.
I have also implemented a simple test in com.ibm.disni.examples.AtomicServer and com.ibm.disni.examples.AtomicClient.
For the second change I added extra functions in JNI to connect and accept using all fields of RdmaConnParam. Therefore, the JNI disni library supports both old and new way of establishing connections. In addition, I fixed other parts of the code to support custom RdmaConnParam instead of the default one with zeros for initiator and responder depths.
Cheers,
Konstantin