{"action":"created","comment":{"url":"https://api.github.com/repos/openucx/ucx/pulls/comments/39026523","id":39026523,"diff_hunk":"@@ -131,30 +196,84 @@ ucs_status_t uct_mm_ep_am_short(uct_ep_h tl_ep, uint8_t id, uint64_t header,\n     status = uct_mm_ep_get_remote_elem(ep, head, &elem);\n \n     if (status == UCS_OK) {\n-        /* write to the remote fifo */\n-        *(uint64_t*)(elem + 1) = header;\n-        memcpy((void*)(elem + 1) + sizeof(header), payload, length);\n-        elem->am_id  = id;\n-        elem->flags |= UCT_MM_FIFO_ELEM_FLAG_INLINE;\n-        elem->length = length + sizeof(header);\n+        if (is_short == 1) {\n+            /* AM_SHORT */\n+            /* write to the remote FIFO */\n+            *(uint64_t*) (elem + 1) = header;\n+            memcpy((void*) (elem + 1) + sizeof(header), payload, length);\n+\n+            elem->flags |= UCT_MM_FIFO_ELEM_FLAG_INLINE;\n+            elem->length = length + sizeof(header);\n+        } else {\n+            /* AM_BCOPY */\n+            /* write to the remote descriptor */\n+            /* get the base_address: local ptr to remote memory chunk after attaching to it */\n+            base_address = uct_mm_ep_attach_remote_seg(ep, iface, elem);\n+            pack_cb(base_address + elem->desc_offset, arg, length);\n+\n+            elem->flags &= ~UCT_MM_FIFO_ELEM_FLAG_INLINE;\n+            elem->length = length;\n+\n+        }\n+        elem->am_id = am_id;\n \n         /* memory barrier - make sure that the memory is flushed before setting the\n          * 'writing is complete' flag which the reader checks */\n         ucs_memory_cpu_store_fence();\n \n         /* change the owner bit to indicate that the writing is complete.\n-         * the owner bit flips after every fifo wraparound */\n+         * the owner bit flips after every FIFO wraparound */\n         if (head & iface->config.fifo_size) {\n             elem->flags |= UCT_MM_FIFO_ELEM_FLAG_OWNER;\n         } else {\n             elem->flags &= ~UCT_MM_FIFO_ELEM_FLAG_OWNER;\n         }\n+    }\n+\n+    return status;\n+}\n+\n+ucs_status_t uct_mm_ep_am_short(uct_ep_h tl_ep, uint8_t id, uint64_t header,\n+                                const void *payload, unsigned length)\n+{\n+    uct_mm_iface_t *iface = ucs_derived_of(tl_ep->iface, uct_mm_iface_t);\n+    uct_mm_ep_t *ep = ucs_derived_of(tl_ep, uct_mm_ep_t);\n+    ucs_status_t status;\n+\n+    UCT_CHECK_LENGTH(length + sizeof(header),\n+                     iface->elem_size - sizeof(uct_mm_fifo_element_t), \"am_short\");\n+\n+    status = uct_mm_ep_am_common_send(1, ep, iface, id, length, header, payload,\n+                                (void*)ucs_empty_function_return_success, (void*)0x0);\n+    if (status == UCS_OK) {\n+        ucs_trace_data(\"MM: AM_SHORT [%p] am_id: %d buf=%p length=%u\",\n+                        iface, id, payload, length);\n     } else {\n-        /* couldn't get an available fifo element */\n-        return status;\n+        ucs_debug(\"Couldn't get an available FIFO element in am_short\");\n     }\n-    ucs_trace_data(\"MM: AM_SHORT am_id: %d buf=%p length=%u\", id, payload, length);\n-    return UCS_OK;\n+\n+    return status;\n+}\n+\n+ucs_status_t uct_mm_ep_am_bcopy(uct_ep_h tl_ep, uint8_t id,\n+                                uct_pack_callback_t pack_cb, void *arg,\n+                                size_t length)\n+{\n+    uct_mm_iface_t *iface = ucs_derived_of(tl_ep->iface, uct_mm_iface_t);\n+    uct_mm_ep_t *ep = ucs_derived_of(tl_ep, uct_mm_ep_t);\n+    ucs_status_t status;\n+\n+    UCT_CHECK_LENGTH(length, iface->config.seg_size, \"am_bcopy\");\n+\n+    status = uct_mm_ep_am_common_send(0, ep, iface, id, length, 0, (void*)0x0, pack_cb, arg);\n+    if (status == UCS_OK) {\n+        ucs_trace_data(\"MM: AM_BCOPY [%p] am_id: %d buf=%p length=%u\",\n+                        iface, id, arg, (int)length);\n+    } else {\n+        ucs_debug(\"Couldn't get an available FIFO element in am_bcopy\");","path":"src/uct/sm/mm/mm_ep.c","position":219,"original_position":219,"commit_id":"133946b93ea035bda9c42ef135e9c9d1a8a00be6","original_commit_id":"133946b93ea035bda9c42ef135e9c9d1a8a00be6","user":{"login":"yosefe","id":2255631,"avatar_url":"https://avatars.githubusercontent.com/u/2255631?v=3","gravatar_id":"","url":"https://api.github.com/users/yosefe","html_url":"https://github.com/yosefe","followers_url":"https://api.github.com/users/yosefe/followers","following_url":"https://api.github.com/users/yosefe/following{/other_user}","gists_url":"https://api.github.com/users/yosefe/gists{/gist_id}","starred_url":"https://api.github.com/users/yosefe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yosefe/subscriptions","organizations_url":"https://api.github.com/users/yosefe/orgs","repos_url":"https://api.github.com/users/yosefe/repos","events_url":"https://api.github.com/users/yosefe/events{/privacy}","received_events_url":"https://api.github.com/users/yosefe/received_events","type":"User","site_admin":false},"body":"because it would be printed all the time, when re-trying to send","created_at":"2015-09-09T10:13:58Z","updated_at":"2015-09-09T10:13:58Z","html_url":"https://github.com/openucx/ucx/pull/383#discussion_r39026523","pull_request_url":"https://api.github.com/repos/openucx/ucx/pulls/383","_links":{"self":{"href":"https://api.github.com/repos/openucx/ucx/pulls/comments/39026523"},"html":{"href":"https://github.com/openucx/ucx/pull/383#discussion_r39026523"},"pull_request":{"href":"https://api.github.com/repos/openucx/ucx/pulls/383"}}},"pull_request":{"url":"https://api.github.com/repos/openucx/ucx/pulls/383","id":44415597,"html_url":"https://github.com/openucx/ucx/pull/383","diff_url":"https://github.com/openucx/ucx/pull/383.diff","patch_url":"https://github.com/openucx/ucx/pull/383.patch","issue_url":"https://api.github.com/repos/openucx/ucx/issues/383","number":383,"state":"open","locked":false,"title":"SM/MM: added support for active messaging for bcopy messaging.","user":{"login":"alinask","id":2405183,"avatar_url":"https://avatars.githubusercontent.com/u/2405183?v=3","gravatar_id":"","url":"https://api.github.com/users/alinask","html_url":"https://github.com/alinask","followers_url":"https://api.github.com/users/alinask/followers","following_url":"https://api.github.com/users/alinask/following{/other_user}","gists_url":"https://api.github.com/users/alinask/gists{/gist_id}","starred_url":"https://api.github.com/users/alinask/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alinask/subscriptions","organizations_url":"https://api.github.com/users/alinask/orgs","repos_url":"https://api.github.com/users/alinask/repos","events_url":"https://api.github.com/users/alinask/events{/privacy}","received_events_url":"https://api.github.com/users/alinask/received_events","type":"User","site_admin":false},"body":null,"created_at":"2015-09-08T10:25:01Z","updated_at":"2015-09-09T10:13:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"00a6bb33efc34bd6de5d5dd0f384d17766bc1cd1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openucx/ucx/pulls/383/commits","review_comments_url":"https://api.github.com/repos/openucx/ucx/pulls/383/comments","review_comment_url":"https://api.github.com/repos/openucx/ucx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openucx/ucx/issues/383/comments","statuses_url":"https://api.github.com/repos/openucx/ucx/statuses/133946b93ea035bda9c42ef135e9c9d1a8a00be6","head":{"label":"alinask:topic/uct-mm-am-bcopy","ref":"topic/uct-mm-am-bcopy","sha":"133946b93ea035bda9c42ef135e9c9d1a8a00be6","user":{"login":"alinask","id":2405183,"avatar_url":"https://avatars.githubusercontent.com/u/2405183?v=3","gravatar_id":"","url":"https://api.github.com/users/alinask","html_url":"https://github.com/alinask","followers_url":"https://api.github.com/users/alinask/followers","following_url":"https://api.github.com/users/alinask/following{/other_user}","gists_url":"https://api.github.com/users/alinask/gists{/gist_id}","starred_url":"https://api.github.com/users/alinask/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alinask/subscriptions","organizations_url":"https://api.github.com/users/alinask/orgs","repos_url":"https://api.github.com/users/alinask/repos","events_url":"https://api.github.com/users/alinask/events{/privacy}","received_events_url":"https://api.github.com/users/alinask/received_events","type":"User","site_admin":false},"repo":{"id":39071172,"name":"ucx","full_name":"alinask/ucx","owner":{"login":"alinask","id":2405183,"avatar_url":"https://avatars.githubusercontent.com/u/2405183?v=3","gravatar_id":"","url":"https://api.github.com/users/alinask","html_url":"https://github.com/alinask","followers_url":"https://api.github.com/users/alinask/followers","following_url":"https://api.github.com/users/alinask/following{/other_user}","gists_url":"https://api.github.com/users/alinask/gists{/gist_id}","starred_url":"https://api.github.com/users/alinask/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alinask/subscriptions","organizations_url":"https://api.github.com/users/alinask/orgs","repos_url":"https://api.github.com/users/alinask/repos","events_url":"https://api.github.com/users/alinask/events{/privacy}","received_events_url":"https://api.github.com/users/alinask/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alinask/ucx","description":"Unified Communication X : ","fork":true,"url":"https://api.github.com/repos/alinask/ucx","forks_url":"https://api.github.com/repos/alinask/ucx/forks","keys_url":"https://api.github.com/repos/alinask/ucx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alinask/ucx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alinask/ucx/teams","hooks_url":"https://api.github.com/repos/alinask/ucx/hooks","issue_events_url":"https://api.github.com/repos/alinask/ucx/issues/events{/number}","events_url":"https://api.github.com/repos/alinask/ucx/events","assignees_url":"https://api.github.com/repos/alinask/ucx/assignees{/user}","branches_url":"https://api.github.com/repos/alinask/ucx/branches{/branch}","tags_url":"https://api.github.com/repos/alinask/ucx/tags","blobs_url":"https://api.github.com/repos/alinask/ucx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alinask/ucx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alinask/ucx/git/refs{/sha}","trees_url":"https://api.github.com/repos/alinask/ucx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alinask/ucx/statuses/{sha}","languages_url":"https://api.github.com/repos/alinask/ucx/languages","stargazers_url":"https://api.github.com/repos/alinask/ucx/stargazers","contributors_url":"https://api.github.com/repos/alinask/ucx/contributors","subscribers_url":"https://api.github.com/repos/alinask/ucx/subscribers","subscription_url":"https://api.github.com/repos/alinask/ucx/subscription","commits_url":"https://api.github.com/repos/alinask/ucx/commits{/sha}","git_commits_url":"https://api.github.com/repos/alinask/ucx/git/commits{/sha}","comments_url":"https://api.github.com/repos/alinask/ucx/comments{/number}","issue_comment_url":"https://api.github.com/repos/alinask/ucx/issues/comments{/number}","contents_url":"https://api.github.com/repos/alinask/ucx/contents/{+path}","compare_url":"https://api.github.com/repos/alinask/ucx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alinask/ucx/merges","archive_url":"https://api.github.com/repos/alinask/ucx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alinask/ucx/downloads","issues_url":"https://api.github.com/repos/alinask/ucx/issues{/number}","pulls_url":"https://api.github.com/repos/alinask/ucx/pulls{/number}","milestones_url":"https://api.github.com/repos/alinask/ucx/milestones{/number}","notifications_url":"https://api.github.com/repos/alinask/ucx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alinask/ucx/labels{/name}","releases_url":"https://api.github.com/repos/alinask/ucx/releases{/id}","created_at":"2015-07-14T11:34:14Z","updated_at":"2015-07-14T11:34:16Z","pushed_at":"2015-09-08T10:25:00Z","git_url":"git://github.com/alinask/ucx.git","ssh_url":"git@github.com:alinask/ucx.git","clone_url":"https://github.com/alinask/ucx.git","svn_url":"https://github.com/alinask/ucx","homepage":" http://www.openucx.org","size":2426,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openucx:master","ref":"master","sha":"24d50e57654f4a2468ea2f8ca2bdb6be206c3b6a","user":{"login":"openucx","id":13118737,"avatar_url":"https://avatars.githubusercontent.com/u/13118737?v=3","gravatar_id":"","url":"https://api.github.com/users/openucx","html_url":"https://github.com/openucx","followers_url":"https://api.github.com/users/openucx/followers","following_url":"https://api.github.com/users/openucx/following{/other_user}","gists_url":"https://api.github.com/users/openucx/gists{/gist_id}","starred_url":"https://api.github.com/users/openucx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openucx/subscriptions","organizations_url":"https://api.github.com/users/openucx/orgs","repos_url":"https://api.github.com/users/openucx/repos","events_url":"https://api.github.com/users/openucx/events{/privacy}","received_events_url":"https://api.github.com/users/openucx/received_events","type":"Organization","site_admin":false},"repo":{"id":25379390,"name":"ucx","full_name":"openucx/ucx","owner":{"login":"openucx","id":13118737,"avatar_url":"https://avatars.githubusercontent.com/u/13118737?v=3","gravatar_id":"","url":"https://api.github.com/users/openucx","html_url":"https://github.com/openucx","followers_url":"https://api.github.com/users/openucx/followers","following_url":"https://api.github.com/users/openucx/following{/other_user}","gists_url":"https://api.github.com/users/openucx/gists{/gist_id}","starred_url":"https://api.github.com/users/openucx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openucx/subscriptions","organizations_url":"https://api.github.com/users/openucx/orgs","repos_url":"https://api.github.com/users/openucx/repos","events_url":"https://api.github.com/users/openucx/events{/privacy}","received_events_url":"https://api.github.com/users/openucx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openucx/ucx","description":"Unified Communication X  (ucx-group@elist.ornl.gov): ","fork":false,"url":"https://api.github.com/repos/openucx/ucx","forks_url":"https://api.github.com/repos/openucx/ucx/forks","keys_url":"https://api.github.com/repos/openucx/ucx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openucx/ucx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openucx/ucx/teams","hooks_url":"https://api.github.com/repos/openucx/ucx/hooks","issue_events_url":"https://api.github.com/repos/openucx/ucx/issues/events{/number}","events_url":"https://api.github.com/repos/openucx/ucx/events","assignees_url":"https://api.github.com/repos/openucx/ucx/assignees{/user}","branches_url":"https://api.github.com/repos/openucx/ucx/branches{/branch}","tags_url":"https://api.github.com/repos/openucx/ucx/tags","blobs_url":"https://api.github.com/repos/openucx/ucx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openucx/ucx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openucx/ucx/git/refs{/sha}","trees_url":"https://api.github.com/repos/openucx/ucx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openucx/ucx/statuses/{sha}","languages_url":"https://api.github.com/repos/openucx/ucx/languages","stargazers_url":"https://api.github.com/repos/openucx/ucx/stargazers","contributors_url":"https://api.github.com/repos/openucx/ucx/contributors","subscribers_url":"https://api.github.com/repos/openucx/ucx/subscribers","subscription_url":"https://api.github.com/repos/openucx/ucx/subscription","commits_url":"https://api.github.com/repos/openucx/ucx/commits{/sha}","git_commits_url":"https://api.github.com/repos/openucx/ucx/git/commits{/sha}","comments_url":"https://api.github.com/repos/openucx/ucx/comments{/number}","issue_comment_url":"https://api.github.com/repos/openucx/ucx/issues/comments{/number}","contents_url":"https://api.github.com/repos/openucx/ucx/contents/{+path}","compare_url":"https://api.github.com/repos/openucx/ucx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openucx/ucx/merges","archive_url":"https://api.github.com/repos/openucx/ucx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openucx/ucx/downloads","issues_url":"https://api.github.com/repos/openucx/ucx/issues{/number}","pulls_url":"https://api.github.com/repos/openucx/ucx/pulls{/number}","milestones_url":"https://api.github.com/repos/openucx/ucx/milestones{/number}","notifications_url":"https://api.github.com/repos/openucx/ucx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openucx/ucx/labels{/name}","releases_url":"https://api.github.com/repos/openucx/ucx/releases{/id}","created_at":"2014-10-17T22:17:24Z","updated_at":"2015-09-08T19:41:11Z","pushed_at":"2015-09-09T07:13:54Z","git_url":"git://github.com/openucx/ucx.git","ssh_url":"git@github.com:openucx/ucx.git","clone_url":"https://github.com/openucx/ucx.git","svn_url":"https://github.com/openucx/ucx","homepage":" http://www.openucx.org","size":5516,"stargazers_count":18,"watchers_count":18,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":11,"mirror_url":null,"open_issues_count":33,"forks":11,"open_issues":33,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openucx/ucx/pulls/383"},"html":{"href":"https://github.com/openucx/ucx/pull/383"},"issue":{"href":"https://api.github.com/repos/openucx/ucx/issues/383"},"comments":{"href":"https://api.github.com/repos/openucx/ucx/issues/383/comments"},"review_comments":{"href":"https://api.github.com/repos/openucx/ucx/pulls/383/comments"},"review_comment":{"href":"https://api.github.com/repos/openucx/ucx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openucx/ucx/pulls/383/commits"},"statuses":{"href":"https://api.github.com/repos/openucx/ucx/statuses/133946b93ea035bda9c42ef135e9c9d1a8a00be6"}}}}