00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef COMPONENTS_TRIG_CPU_PORTALS_H
00014 #define COMPONENTS_TRIG_CPU_PORTALS_H
00015
00016 #include <vector>
00017 #include <list>
00018 #include <map>
00019 #include <queue>
00020
00021 #include "portals_types.h"
00022 #include <sst/core/sst.h>
00023
00024 #include "sst/elements/portals4_sm/trig_nic/trig_nic_event.h"
00025
00026 class trig_cpu;
00027
00028 class portals {
00029
00030 public:
00031 void PtlCTAlloc(ptl_ct_type_t ct_type, ptl_handle_ct_t& ct_handle);
00032 void PtlCTFree(ptl_handle_ct_t ct_handle);
00033 void PtlCTSet(ptl_handle_ct_t ct_handle, ptl_ct_event_t new_ct);
00034 bool PtlCTWait(ptl_handle_ct_t ct_handle, ptl_size_t test);
00035
00036 bool PtlCTCheckThresh(ptl_handle_ct_t ct_handle, ptl_size_t test);
00037
00038 void PtlCTInc(ptl_handle_ct_t ct_handle, ptl_size_t increment);
00039 void PtlCTGet(ptl_handle_ct_t ct_handle, ptl_ct_event_t* event);
00040
00041 void PtlMDBind(ptl_md_t md, ptl_handle_md_t *md_handle);
00042 void PtlMDRelease(ptl_handle_md_t md_handle);
00043
00044 void PtlMEAppend(ptl_pt_index_t pt_index, ptl_me_t me, ptl_list_t ptl_list,
00045 void *user_ptr, ptl_handle_me_t& me_handle);
00046 void PtlMEUnlink(ptl_handle_me_t me_handle);
00047
00048 void PtlPut(ptl_handle_md_t md_handle, ptl_size_t local_offset,
00049 ptl_size_t length, ptl_ack_req_t ack_req,
00050 ptl_process_id_t target_id, ptl_pt_index_t pt_index,
00051 ptl_match_bits_t match_bits, ptl_size_t remote_offset,
00052 void *user_ptr, ptl_hdr_data_t hdr_data);
00053
00054 void PtlAtomic(ptl_handle_md_t md_handle, ptl_size_t local_offset,
00055 ptl_size_t length, ptl_ack_req_t ack_req,
00056 ptl_process_id_t target_id, ptl_pt_index_t pt_index,
00057 ptl_match_bits_t match_bits, ptl_size_t remote_offset,
00058 void *user_ptr, ptl_hdr_data_t hdr_data,
00059 ptl_op_t operation, ptl_datatype_t datatype);
00060
00061 void PtlTriggeredPut(ptl_handle_md_t md_handle, ptl_size_t local_offset,
00062 ptl_size_t length, ptl_ack_req_t ack_req,
00063 ptl_process_id_t target_id, ptl_pt_index_t pt_index,
00064 ptl_match_bits_t match_bits, ptl_size_t remote_offset,
00065 void *user_ptr, ptl_hdr_data_t hdr_data,
00066 ptl_handle_ct_t trig_ct_handle, ptl_size_t threshold);
00067
00068 void PtlTriggeredAtomic(ptl_handle_md_t md_handle, ptl_size_t local_offset,
00069 ptl_size_t length, ptl_ack_req_t ack_req,
00070 ptl_process_id_t target_id, ptl_pt_index_t pt_index,
00071 ptl_match_bits_t match_bits, ptl_size_t remote_offset,
00072 void *user_ptr, ptl_hdr_data_t hdr_data,
00073 ptl_op_t operation, ptl_datatype_t datatype,
00074 ptl_handle_ct_t trig_ct_handle, ptl_size_t threshold);
00075
00076 void PtlTriggeredCTInc(ptl_handle_ct_t ct_handle, ptl_size_t increment,
00077 ptl_handle_ct_t trig_ct_handle, ptl_size_t threshold);
00078
00079 void PtlGet ( ptl_handle_md_t md_handlde, ptl_size_t local_offset,
00080 ptl_size_t length, ptl_process_id_t target_id,
00081 ptl_pt_index_t pt_index, ptl_match_bits_t match_bits,
00082 void *user_ptr, ptl_size_t remote_offset );
00083
00084 void PtlTriggeredGet ( ptl_handle_md_t md_handle, ptl_size_t local_offset,
00085 ptl_size_t length, ptl_process_id_t target_id,
00086 ptl_pt_index_t pt_index, ptl_match_bits_t match_bits,
00087 void *user_ptr, ptl_size_t remote_offset,
00088 ptl_handle_ct_t ct_handle, ptl_size_t threshold);
00089
00090
00091 portals(trig_cpu* my_cpu);
00092
00093 void scheduleUpdateHostCT(ptl_handle_ct_t ct_handle);
00094
00095 bool processMessage(SST::trig_nic_event* ev);
00096
00097
00098 bool progressPIO();
00099
00100 private:
00101 #define MAX_PORTAL_TABLE_ENTRY 32
00102 ptl_entry_t* ptl_table[MAX_PORTAL_TABLE_ENTRY];
00103
00104 #define MAX_CT_EVENTS 32
00105
00106 ptl_int_ct_t ptl_ct_cpu_events[MAX_CT_EVENTS];
00107
00108 trig_cpu* cpu;
00109
00110
00111
00112 std::queue<ptl_int_trig_op_t*> already_triggered_q;
00113
00114
00115
00116
00117
00118 ptl_handle_me_t next_handle_me;
00119
00120
00121 void* pio_start;
00122 int pio_current_offset;
00123 int pio_length_rem;
00124 int pio_dest;
00125 ptl_handle_ct_t pio_ct_handle;
00126
00127 };
00128
00129 #endif // COMPONENTS_TRIG_CPU_PORTALS_H